# [audacity4blind] Re: Noise Generator

• From: Steve the Fiddle <stevethefiddle@xxxxxxxxx>
• To: audacity4blind@xxxxxxxxxxxxx
• Date: Sun, 18 Oct 2015 23:30:57 +0100

The part of the code that generates the sound is the function FMOSC.
This function is described in the Nyquist manual here:
http://www.cs.cmu.edu/~rbd/doc/nyquist/part8.html#index378

In our example we don't use the optional "table" or "phase"
parameters. Most of the code is to create the modulation signal.

If you want to create a tone that goes up and down between say 100 Hz
and 1000 Hz, then you need to create a modulation signal that goes up
and down between values of 100 and 1000.

The HZOSC function produces a sine wav that goes up and down between +/- 1.
HZOSC is described here:
http://www.cs.cmu.edu/~rbd/doc/nyquist/part8.html#index368

As you will see from the above link, to make a signal that goes up and
down repeatedly once every 4 seconds, we can use this code:

(hzosc (/ 1.0 4.0))

You wont be able to hear this because the "note" has a frequency of
0.25 Hz, which is far too low to hear, but it is part way to creating
a suitable modulation signal. All that we need to do is to scale it so
that rather than going between +/- 1 it will go between 100 and 1000.

Adding "1" will make it go between 0 and 2.
(sum 1 (hzosc (/ 1.0 4.0)))

Then if we multiply by 450 it will go between 0 and 900
(mult 450 (sum 1 (hzosc (/ 1.0 4.0))))

Then if we add 100, it will be shifted up to go between 100 and 1000.
(sum 100 (mult 450 (sum 1 (hzosc (/ 1.0 4.0)))))

We now have a modulation signal that goes between 100 and 1000.
To make it easier to use, we can assign this as the value of a variable:
(setf mod (sum 100 (mult 450 (sum 1 (hzosc (/ 1.0 4.0))))))

We can now use the variable "mod" in the FMOSC function like this:

(setf mod (sum 100 (mult 450 (sum 1 (hzosc (/ 1.0 4.0))))))
(fmosc 0 mod)

Try substituting different numbers to get a different pitch and
different high/low speed.

Hope that helps to get you started.

Steve

On 18 October 2015 at 20:33, Annabelle Susan Morison
<foristnights@xxxxxxxxxxx> wrote:

I got it to work, however, it only does the windup side of the siren. How
would I make the wind-down of the siren? Would I reverse the order of
frequencies? How about the yelp and piercer tones? Would they be made with the
same code?

-----Original Message-----
From: audacity4blind-bounce@xxxxxxxxxxxxx
[mailto:audacity4blind-bounce@xxxxxxxxxxxxx] On Behalf Of Steve the Fiddle
Sent: Thursday, June 04, 2015 12:10 PM
To: audacity4blind@xxxxxxxxxxxxx
Subject: [audacity4blind] Re: Noise Generator

That code is written for the Nyquist Prompt.

Steve

On 4 June 2015 at 18:53, Annabelle Susan Morison
<foristnights@xxxxxxxxxxx> wrote:
And I would put this in the Nyquist Prompt? Or would that be the Nyquist
Generate Prompt?

-----Original Message-----
From: audacity4blind-bounce@xxxxxxxxxxxxx
[mailto:audacity4blind-bounce@xxxxxxxxxxxxx] On Behalf Of Steve the Fiddle
Sent: Thursday, June 04, 2015 10:47 AM
To: audacity4blind@xxxxxxxxxxxxx
Subject: [audacity4blind] Re: Noise Generator

Attached is some code that may help to get you started.
The code came from this forum topic and there is additional information
there:
http://forum.audacityteam.org/viewtopic.php?p=159187

Steve

On 4 June 2015 at 17:24, Annabelle Susan Morison <foristnights@xxxxxxxxxxx>
wrote:
Hi, it's Annabelle.
I know this might sound strange but, I wonder if there's a way for me
to make a noise generator that generates the four common siren tones,
wail, yelp, hyperyelp, and hi-lo? If there is, what would be the code
for me to make these? Also, being blind, how would I make this into a
plugin?

The audacity4blind web site is at
//www.freelists.org/webpage/audacity4blind

Subscribe and unsubscribe information, message archives,
Audacity keyboard commands, and more...

To unsubscribe from audacity4blind, send an email to
audacity4blind-request@xxxxxxxxxxxxx
with subject line
unsubscribe

The audacity4blind web site is at
//www.freelists.org/webpage/audacity4blind

Subscribe and unsubscribe information, message archives,
Audacity keyboard commands, and more...

To unsubscribe from audacity4blind, send an email to
audacity4blind-request@xxxxxxxxxxxxx
with subject line
unsubscribe

The audacity4blind web site is at
//www.freelists.org/webpage/audacity4blind

Subscribe and unsubscribe information, message archives,
Audacity keyboard commands, and more...

To unsubscribe from audacity4blind, send an email to
audacity4blind-request@xxxxxxxxxxxxx
with subject line
unsubscribe

The audacity4blind web site is at
//www.freelists.org/webpage/audacity4blind

Subscribe and unsubscribe information, message archives,
Audacity keyboard commands, and more...

To unsubscribe from audacity4blind, send an email to
audacity4blind-request@xxxxxxxxxxxxx
with subject line
unsubscribe