White noise

I have an idea for a project but don't know how to go about it. I want to use a Uno to output short bursts (about one second each) of white noise to simulate the puffing of a steam locomotive. I presume I can't use a piezo as they only output one note at a time and white noise is many multiple notes. I also presume that I'd have to record and store a recording of white noise on an SD card. Can anyone give me some pointers, please.

Assuming that can be done, how could I get the output to fade from one speaker to another to simulate the locomotive moving? I envisage 3 or 4 speakers over a distance of about 16 feet.

The timing of the 'puffs' would be tied to the loco's speed, which is controlled by the Uno using a motor shield. High fidelity isn't a problem here. :)

After posting the above I found a white noise generator circuit here: http://www.google.co.uk/url?sa=i&source=images&cd=&cad=rja&docid=BI2WwFkVE9vZgM&tbnid=TwA8e64PSHiUDM:&ved=0CAgQjRwwAA&url=http%3A%2F%2Fwww.montalk.net%2Femwng.html&ei=xUQQUqeIBKXP0AWDwoD4Bg&psig=AFQjCNFb_etd9H3izj5hpMluxqmLihlVkg&ust=1376884293109042

So now it's only a matter of pulsing the output from the Uno with a transistor. I still have no idea how to cross fade the output from one speaker to another.

I remember reading an article in Wireless World many years ago in which a white noise generator was made by clocking a linear feedback shift register at an ultrasonic frequency. The shift register output was fed into a filter (AFAIR it was a simple low-pass filter) to give white noise. You could emulate the linear feedback shift register in software. See http://en.wikipedia.org/wiki/Linear_feedback_shift_register which even provides some C code.

Yes that is how random number generators work, which essentially is white noise. However the quality of the noise to be steam like will depend on the attack and decay of the envelope so you will need some form of amplitude control to make it sound nice. Maybe you would be better off with a wave shield and some audio samples of the noises you want.

If you care, the shift register with feedback is simply pseudo-random, since it repeats. This is unlike the linked circuit (with paired transistors), which is truly random. If pseudo-random is good enough, it seems to me you could call a pseudo-random number generator at fixed intervals and output the resulting data exactly as you would the successive data points of a wave file. Envelope is simply a function of multipying by the appropriate (cosine?) function.

OR, output the series of pseudo-random numbers to a PWM pin connected to a low-pass filter. Now the values set the frequency, rather than amplitude. This is like a (digitally-driven) class-D audio amp!

Henry, let me know what you did when you are finished. I am thinking of trying the same thing for my railroad.

thepenguin: Henry, let me know what you did when you are finished. I am thinking of trying the same thing for my railroad.

The amplifier IC arrived today and I've breadboarded the circuit, but it's not working yet. =( I'll have another try tomorrow. I think the 9V battery is a bit low on charge, but didn't have my meter handy to test it.

When I get it going, I know that I can switch it on and off with an Arduino pin through a transistor to produce the 'chuffs' and relate that to the speed of the motor. Long, slow 'chuffs' as it starts to move, faster, shorter 'chuffs' at full speed. What I've no idea how to do is cross-fading between two or more speakers. I'm thinking of using PWM, but I'll leave that until I have one speaker working properly.

Please share summarized result & solution with me when you done. I need them for my college final year project...