Miller, Steve wrote: > > Howdy, > > Has anyone tried to make a PIC produce white noise in the audio range? Just > like Dilbert, they have "Upgraded" us from offices to cubicles. The noise level > makes thinking difficult. I want to make a system to produce modulated white > noise as a masking signal. I have used audio tapes of the ocean that work ok as > a masking signal, but rewinding the tapes gets to be a hassle when you have to > do it all day long. I have a circuit to do this via analog means, but it > requires a ton of resistors and caps. Therefore I would like to use a PIC to > generate all of the signals and then just have a resistive summer and an output > amp to drive a set of headphones. Any thoughts on how to make the PIC generate > white noise, or "pink" noise? I can write all of the loops etc, I just do not > know how to randomize it. Thanks. > An easy way to make white noise is to use a "psuedo-noise sequence," also called a PN sequence or maximal length sequence. This is done by XORing taps on a shift register and feeding this output back to the input. You must choose the taps correctly if you want a true PN sequence and you must not allow the all 0 state or it will get stuck there. I suggest look at a table in a communication book. The frequency spectrum will consist of spectral lines (discrete frequencies) spaced at an interval of fc/(2^N - 1) with nulls at intervals of fc, where fc is the shift register clock frequency and N is the register length. You want fc higher than (at least 2 times) the highest audio frequency you want to cover but you also want N big enough so that the spectral line frequencies are not audible. A true PN sequence will go through all possible states except the all 0 state once and only once and then repeat. These sequences are commonly used for spread-spectrum communications systems because their autocorrelation properties allow for easy synchronization. If you want pink noise--noise that decreases as the frequency rises--just filter the output with an RC filter with a low cutoff frequency. You will have to amplify to get the signal level back to where it was without the filter. Having said all this it's probably easier not to use a PIC but just use some shift registers and XOR gates or a PAL. Dan Mulally