Main Archive Specials Wiki | FAQ Links Submit Forum


Easy noise generation

Type : White Noise
References : Posted by mail[AT]ihsan-dsp[DOT]com

Notes :
Easy noise generation,
in .hpp,
b_noise = 19.1919191919191919191919191919191919191919;

alternatively, the number 19 below can be replaced with a number of your choice, to get that particular flavour of noise.

Regards,
Ove Karlsen.


Code :
b_noise = b_noise * b_noise;
int i_noise = b_noise;
b_noise = b_noise - i_noise;

double b_noiseout;
b_noiseout = b_noise - 0.5;

b_noise = b_noise + 19;



Comments


Added on : 16/07/06 by zyxoas[ AT ]gmail[ DOT ]com
Comment :
              This is quite a good PRNG! The numbers it generates exhibit a slight a pattern (obviously, since it's not very sophisticated) but they seem quite usable! The real FFT spectrum is very flat and "white" with just one or two aberrant spikes while the imaginary spectrum is almost perfect (as is the case with most PRNGs). Very nice! Either that or I need more practice with MuPad...



Added on : 16/01/07 by arifovekarlsen[ AT ]hotmail[ DOT ]com
Comment :
Alternatively you can do:

        double b_noiselast = b_noise;
        b_noise = b_noise + 19;
        b_noise = b_noise * b_noise;
        b_noise = b_noise + ((-b_noise + b_noiselast) * 0.5);
        int i_noise = b_noise;
        b_noise = b_noise - i_noise;

This will remove the patterning.




Added on : 16/01/07 by nobody[ AT ]nowhere[ DOT ]com
Comment :
>>b_noise = b_noise + ((-b_noise + b_noiselast) * 0.5);

That seems to reduce to just:

b_noise=(b_noise+b_noiselast) * 0.5;




Added on : 18/01/07 by mymail[ AT ]com
Comment :
Hi, is this integer? Please do not disturb the forum, rather send me an email.

B.i.T




Added on : 01/02/07 by arifovekarlsen[ AT ]hotmail[ DOT ]com
Comment :
The line is written like that, so you can change 0.5, to for instance 0.19.



Added on : 01/02/07 by nobody[ AT ]nowhere[ DOT ]com
Comment :
>>The line is written like that, so you can change 0.5, to for instance 0.19.

OK. Why would I do that? What's that number control?




Added on : 03/02/07 by arifovekarlsen[ AT ]hotmail[ DOT ]com
Comment :
It controls the patterning. I usually write my algorithms tweakable.

You could try even lower aswell, maybe 1e-19.





Add your own comment
Comments are displayed in fixed width, no HTML code allowed!
Email:

Comment:

Are you human?



Site created and maintained by Bram
Graphic design by line.out | Server sponsered by fxpansion