# Question regarding narrowband noise

So I have a dilemma and after attempting a few different options I am stumped and am hoping somebody on this forum can assist me.

Here is what I would like to do: Create a 300 ms narrowband noise with center frequency x, a 1/4 octave bandwidth, and a cosine squared rise/fall envelope.

Any help is greatly appreciated!

Select part of the track where you want to make the noise,
then copy and paste this code into the Nyquist Prompt effect (See: http://manual.audacityteam.org/o/man/nyquist_prompt.html)

``````(setf cf 1000) ;centre frequency
(setf bw 0.25) ;bandwidth in octaves

(defun raised-cosine ()
(mult 0.5
(sum 1
(osc (hz-to-step (get-duration 1)) 1 *table* -90))))

(defun bandpass (sig hz width)
(let ((high-hz (* hz (power 2.0 (* 0.5 width))))
(low-hz (/ hz (power 2.0 (* 0.5 width)))))
(highpass8
(lowpass8 sig high-hz)
low-hz)))

(mult (bandpass (noise) cf bw)(raised-cosine))
``````

The first line sets the centre frequency and the second line sets the bandwidth in octaves.
The filter is an 8th order Butterworth highpass / lowpass in series, which should give pretty good narrowband performance.
Apply the Amplify effect as required after generating the noise (see: http://manual.audacityteam.org/o/man/amplify.html).

Note that we also have a forum board specifically for discussion about Nyquist: http://forum.audacityteam.org/viewforum.php?f=39

If the raised cosine has to be squared, just duplicate the variable in the last line like so:

``````(mult (bandpass (noise) cf bw)(raised-cosine) (raised-cosine))
``````

Hello again,

I was hoping to get some help with the previous Nyquist script that you have written me. Just as a catch up (and some more detail than I provided last time) I am hoping to create a 300 ms NBN signal centered around a given frequency with a 1/4 octave bandwidth. I would like to apply a cosine squared envelope with a rise time of 10 ms at the onset of the stimulus (0-10 ms) and a fall time of 1 ms (299-300 ms) at the offset of the stimulus.

My original plan was to then enter in a silent gap of variable duration immediately following the 300 ms NBN signal and then another 300 ms NBN signal following the silent gap which is the exact same as the previously described signal except with a rise time of 1 ms and a fall time of 10 ms. I have been playing around with Nyquist (in addition to attempting to learn LISP) and Audacity for some time but cannot figure out just the right solution. It seems my complete lack of knowledge of computer languages has halted my progress.

When I enter the Nyquist script in this thread for 1000 Hz (as an example) and amplify the result I end up with something looking like the attached file.
1000 Hz.aup (1.43 KB)
It appears that the Nyquist script applies one long rise envelope such that it takes the entire 300 ms for the signal to reach peak amplitude.

Is there any way that I can alter the Nyquist script to meet my needs? Any help would be greatly appreciated. Thank you.