If I have this function:
while (true)
{
frequency = 8000;
wave = sin(sampleNumber*2*PI*frequency/sampleRate)
sampleNumber++;
}
it will produce an 8kHz sine wave.
For white noise I have:
noise = 1-2*rand()/RAND_MAX; // produces random numbers between -1 and 1
The white noise is in all frequencies obviously.
How can I have noise only in a specified range of frequencies (freq1 and freq2) ?
Note: I don't want to filter white noise in the range freq1-freq2 i asked how to PRODUCE it in that range.. (perhaps adding N sines of 1Hz with random amplitudes in the range?)
randn
to produce white noise. Finally: the way to produce noise in a frequency range is by filtering. $\endgroup$