[PD] Box Muller Gaussian noise

Martin Peach martin.peach at sympatico.ca
Sun Mar 16 20:11:14 CET 2008


Oh no that's wrong isn't it :(
The log is necessary to keep the distribution normal, and the range is 
going to get wider the closer to zero the radius is allowed to get.
The attached patch has a scale adjustment...
Still I wonder what kind of distribution gaussianoise2 gives, it's not 
just white.

Martin


Martin Peach wrote:
> 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
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list

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


More information about the Pd-list mailing list