[PD-dev] Random method in noise~ question....

Tim Blechmann TimBlechmann at gmx.net
Fri Oct 22 10:06:23 CEST 2004


> static t_int *noise_perform(t_int *w)
> {
>     t_float *out = (t_float *)(w[1]);
>     int *vp = (int *)(w[2]);
>     int n = (int)(w[3]);
getting arguments ...

>     int val = *vp;
setting seed

>     while (n--)
>     {
looping over the dsp block

>         *out++ = ((float)((val & 0x7fffffff) - 0x40000000)) *
>             (float)(1.0 / 0x40000000);
scaling the random number between -1 and 1

>         val = val * 435898247 + 382842987;
generating new random number

>     }
>     *vp = val;
dont forget it

>     return (w+4);
> }
done ...

if you are interested in different noise generators most of the noise
generators from supercollider (quite a log actually) are part of sc4pd
... an sc header file contains the inline functions for the rngs ...

cheers ... tim

-- 
mailto:TimBlechmann at gmx.de    ICQ: 96771783
http://www.mokabar.tk

After one look at this planet any visitor from outer space 
would say "I want to see the manager."
				      William S. Burroughs




More information about the Pd-dev mailing list