Gaussian white noise code in C

Started by Jess December 7, 2003
Hello all,

I'm in need of a C program which implements the Gaussian white noise
algorithm in C. The program is to accept a binary file as input and
alter it according to the algorithm.
I'm affraid this project must run on Windoze :( 
Thank you in advance

Jess
"Jess" <jessex@kmfms.com> wrote in message
news:63bbea8b.0312070148.4a07e00@posting.google.com...
> Hello all, > > I'm in need of a C program which implements the Gaussian white noise > algorithm in C. The program is to accept a binary file as input and > alter it according to the algorithm. > I'm affraid this project must run on Windoze :(
Jess, What does Windows have to do with your question? Presumably you have an ANSI C compiler that's suitable for generating code that will run on the usual platforms, no? What does the "binary file as input" have to do with the question? Are you meaning to add the noise to the input data or.....? If you intend to add it, then you'll be concerned with scaling the noise to match the intended application. This includes the number represenation you'll be using (fixed, floating, etc.) Check out: http://www.dspguru.com/howto/tech/wgn.htm http://www.mathtools.net/Java/Random_numbers/C_and_C++/ Fred
On Sun, 07 Dec 2003 09:48:52 +0000, Jess wrote:

> Hello all, > > I'm in need of a C program which implements the Gaussian white noise > algorithm in C. The program is to accept a binary file as input and > alter it according to the algorithm. > I'm affraid this project must run on Windoze :( Thank you in advance >
Although I have not tried it, white noise should have a flat spectrum. You could try setting all values to 1 in a complex array and performing an inverse FFT on it. Possibly a tweak or two is in order. This should be guaranteed white noise !
Robin48gx <robin48gx@hotmail.com> wrote in message > 
> Although I have not tried it, white noise should have a flat spectrum. > You could try setting all values to 1 in a complex array and performing > an inverse FFT on it. > > Possibly a tweak or two is in order. > > This should be guaranteed white noise !
Well, if you do this, you'll get an impulse - autocorrelation of white noise! Kiran
Robin48gx wrote:

> Although I have not tried it, white noise should have a flat spectrum. > You could try setting all values to 1 in a complex array and performing > an inverse FFT on it. > > Possibly a tweak or two is in order. > > This should be guaranteed white noise !
This can not be less white noise!! This is not even noise!! This is a deterministic signal!! Maybe (and only *maybe* -- as in, I'm almost sure that it won't work, but there's a slight chance that it might) if you set the magnitudes of the FFT to 1, and set the phase to uniformly distributed random values between -pi and pi... Maybe you'll get something similar to white noise... And BTW, how do you expect this to produce *Gaussian* white noise? How do you know that it's not going to be uniformly distributed white noise? Carlos --
Robin48gx wrote:

> On Sun, 07 Dec 2003 09:48:52 +0000, Jess wrote: > > >>Hello all, >> >>I'm in need of a C program which implements the Gaussian white noise >>algorithm in C. The program is to accept a binary file as input and >>alter it according to the algorithm. >>I'm affraid this project must run on Windoze :( Thank you in advance >> > > > > Although I have not tried it, white noise should have a flat spectrum. > You could try setting all values to 1 in a complex array and performing > an inverse FFT on it. > > Possibly a tweak or two is in order. > > This should be guaranteed white noise !
Don't offer guarantees too freely. With one set of phases, it could be the spectrum of an impulse. With another, of a chirp. Anyhow, summing 12 to 20 random numbers is easier than a broadband IFFT. Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
What you need to search for is the Box-Muller algorithm. So simpe that even
the meanest programmer should be able to implement it in C.

Nick Felgate

"Jess" <jessex@kmfms.com> wrote in message
news:63bbea8b.0312070148.4a07e00@posting.google.com...
> Hello all, > > I'm in need of a C program which implements the Gaussian white noise > algorithm in C. The program is to accept a binary file as input and > alter it according to the algorithm. > I'm affraid this project must run on Windoze :( > Thank you in advance > > Jess