[PD] Box Muller Gaussian noise

Martin Peach martin.peach at sympatico.ca
Sun Mar 16 19:33:52 CET 2008


Charles Henry wrote:
> On Sun, Mar 16, 2008 at 11:16 AM, Martin Peach
> <martin.peach at sympatico.ca> wrote:
>>  (gaussianoise has occasional values that exceed [-1 ... 1], which I
>>  suppose is normal...white noise is always on [-1...1])
> 
> That's true.  With the Box-Muller method, there is the log(~U1) term,
> but you can always just add a small value to U1, which will truncate
> your distribution.  The size of the small value can be calculated to
> fit with any given threshold.
> 

I think it's really because the Box-Muller method selects random numbers 
  in pairs which map to points in a unit square on the plane, but then 
selects only those points which are inside the unit circle, something 
that the pd patch doesn't do (how to resample points in a dsp vector 
until they are in range?). The attached patch shows the straightforward 
way of doing it by simply selecting a random radius and angle and 
returning the resulting y coordinate as the random number. The results 
are always on [-1,1].
I don't think sin~ will be any slower than log~.

Martin
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gaussianoise2.pd
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20080316/5c6dbc29/attachment.asc>


More information about the Pd-list mailing list