[PD] Box Muller Gaussian noise

Andy Farnell padawan12 at obiwannabe.co.uk
Sun Mar 16 23:12:14 CET 2008




I just neatened that up into an abstration + help

All vanilla 
Replaced [abs~]
More efficient [q8-sqrt~] seens fine
No need for pi multiplier as is implicit in [cos~] radians (?)
Martins histogram in separate GOP abs

If I made a mistake please correct and repost.

a.



On Sun, 16 Mar 2008 21:13:04 +0000
Andy Farnell <padawan12 at obiwannabe.co.uk> wrote:

> 
> Wow, that's a gorgeous demonstraton Martin!
> 
> Everything becomes clear as time -> infinity :)
> 
> And somehow our little Earthling brains are able to
> spot this signature distribution as we listen to rainfall.
> 
> Now I'm getting how uniform fall leads to 
> a Gaussian bell around the mean for an area over time.
> 
> Thanks.
> 
> 
> Chuck, I'm sorry I couldn't follow all of your derivation
> of Box Muller, but thanks for the analysis. I think we agree
> it's a neat trick for an efficient source of WGN.
> 
> thanks all,
> 
> Andy
> 
> 
> On Sun, 16 Mar 2008 16:54:29 -0400
> Martin Peach <martin.peach at sympatico.ca> wrote:
> 
> > Here's a histogram generator (binner) that shows the distribution of 
> > [gaussianoise]. Using it I can quickly see that [gaussianoise2] is too 
> > peaked around zero and that [gaussianoise3] chops the tails off when the 
> > scale is low.
> > If you have uniformly distributed raindrops falling, any given area will 
> > receive a number of raindrops that clusters about the mean in a normal 
> > distribution, just as if you first bin the number of occurrences of each 
> > value of white noise, then bin the resulting counts, the histogram of 
> > the counts will look like a bell curve centered at the mean count.
> > 
> > Martin
> > 
> > Andy Farnell wrote:
> > > 
> > > GEM is broken here, but thanks for the info Marius. 
> > > I'm reading through the docs for R at the moment.
> > > It makes lovely plots, but haven't figured how to get
> > > my data in to it yet...
> > > 
> > > JFYI the application is rainfall. Many papers I read describe
> > > rainfall as Gaussian.
> > > 
> > > I know from physical analysis that raindrops are uniform in size
> > > and velocity for any local sample, so I've realised this distribution
> > > is about how they fall within an area and pondering how a 
> > > distribution can be Gaussian in 2D. 
> > > 
> > > Thing is, I can't figure out any good reason why rain should
> > > by anything other than uniformly distributed ! :(
> > > 
> > > When I use Martins second patch with a thresholding function
> > > to trigger droplet sounds, it does sound a lot more like
> > > real rainfall than a uniformly triggered model.
> > > 
> > > I'm in one of those grey areas where I half understand what I'm
> > > doing, which is a dangerous place to be. 
> > > 
> > > Anybody know of cool papers I might have missed on the
> > > distribution of rain drops and the effect on their sound?
> > > 
> > > Thanks,
> > > 
> > > Andy
> > > 
> > > 
> > > 
> > > 
> > > On Sun, 16 Mar 2008 15:43:34 -0400
> > > marius schebella <marius.schebella at gmail.com> wrote:
> > > 
> > >> from the first equation that andy posted, I produced a gem 
> > >> representation. the box muller noise seems wrong, because it does not 
> > >> use the whole range but is shifted to the negative side.
> > >> note, this is not a distribution of frequencies, but of noise values..
> > >> marius.
> > >>
> > >> Martin Peach wrote:
> > >>> 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
> > >>>
> > >>> ------------------------------------------------------------------------
> > >>>
> > >>> _______________________________________________
> > >>> PD-list at iem.at mailing list
> > >>> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
> > >>
> > > 
> > > 
> > 
> > 
> 
> 
> -- 
> Use the source
> 
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list


-- 
Use the source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: guassian-noise.tar.gz
Type: application/octet-stream
Size: 2163 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20080316/22868733/attachment.obj>


More information about the Pd-list mailing list