Re: [PD] Issue with Gaussian Noise

2010-08-11 Thread Roman Haefeli
On Wed, 2010-08-11 at 00:17 -0400, Martin Peach wrote:
> On 2010-08-10 04:32, Frank Barknecht wrote:

> Also an uncertain execution order in the log divide part needs one of 
> those [tff]s.

HAHAHA, I would have never dreamed that once someone would be saying
that to Frank.

(Frank, please get me right: I meant to laugh with you, not at you).

Cheers
Roman




___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Issue with Gaussian Noise

2010-08-11 Thread Frank Barknecht
On Wed, Aug 11, 2010 at 09:44:13AM +0200, Roman Haefeli wrote:
> On Wed, 2010-08-11 at 00:17 -0400, Martin Peach wrote:
> > On 2010-08-10 04:32, Frank Barknecht wrote:
> 
> > Also an uncertain execution order in the log divide part needs one of 
> > those [tff]s.
> 
> HAHAHA, I would have never dreamed that once someone would be saying
> that to Frank.
> 
> (Frank, please get me right: I meant to laugh with you, not at you).

Yeah, it's funny! Lesson learned here: If you start with DSP code and
convert it to messages, look very, very closely for fanning connections.

Ciao
-- 
Frank

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Issue with Gaussian Noise

2010-08-11 Thread Roman Haefeli
On Wed, 2010-08-11 at 10:01 +0200, Frank Barknecht wrote:
> On Wed, Aug 11, 2010 at 09:44:13AM +0200, Roman Haefeli wrote:
> > On Wed, 2010-08-11 at 00:17 -0400, Martin Peach wrote:
> > > On 2010-08-10 04:32, Frank Barknecht wrote:
> > 
> > > Also an uncertain execution order in the log divide part needs one of 
> > > those [tff]s.
> > 
> > HAHAHA, I would have never dreamed that once someone would be saying
> > that to Frank.
> > 
> > (Frank, please get me right: I meant to laugh with you, not at you).
> 
> Yeah, it's funny! Lesson learned here: If you start with DSP code and
> convert it to messages, look very, very closely for fanning connections.

Ah, I understand. There must have been a plausible explanation for
that ;-)

Roman


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Issue with Gaussian Noise

2010-08-11 Thread Frank Barknecht
Hi,

On Wed, Aug 11, 2010 at 12:17:14AM -0400, Martin Peach wrote:
> Yes it is the reason for the valleys. Your random is on [-0.5,0.5]
> instead of [-1,1]. 

Ah, of course, how silly.

> Also an uncertain execution order in the log divide part needs one
> of those [tff]s.

Oops, I overlooked this while converting the DSP version to floats,
thanks for pointing it out. Now the bell sounds like a bell!

Ciao
-- 
Frank

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Issue with Gaussian Noise

2010-08-10 Thread Martin Peach

On 2010-08-10 04:32, Frank Barknecht wrote:

Hi,

I made two generators for Gaussian white noise, one using DSP, the other
as message based version. Both use the same algorithm, but the histogram
analysis of both shows a defect with the message version: The histogram
has a visible "valley" around the central expectation value, so it
doesn't look like a real gaussian bell curve anymore.

The message version is based on [random] not [noise~], and I "faked" a
true frand by taking and scaling random values from the range 0-10.
Could this be the reason for the valleys or is the reason the custom
algorithm [random] uses or is it, that two [random]s are not
sufficiently independent?



Yes it is the reason for the valleys. Your random is on [-0.5,0.5] 
instead of [-1,1]. The random needs to be multiplied by 2 million before 
 subtracting one million then dividing by one million. Then it works.
Also an uncertain execution order in the log divide part needs one of 
those [tff]s.

The DSP version looks normal to me if I sample it a few times.

Martin

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


[PD] Issue with Gaussian Noise

2010-08-10 Thread Frank Barknecht
Hi,

I made two generators for Gaussian white noise, one using DSP, the other
as message based version. Both use the same algorithm, but the histogram
analysis of both shows a defect with the message version: The histogram
has a visible "valley" around the central expectation value, so it
doesn't look like a real gaussian bell curve anymore.

The message version is based on [random] not [noise~], and I "faked" a
true frand by taking and scaling random values from the range 0-10.
Could this be the reason for the valleys or is the reason the custom
algorithm [random] uses or is it, that two [random]s are not
sufficiently independent?

Ciao
-- 
Frank
#N canvas 96 55 817 467 10;
#X floatatom 81 182 5 0 0 0 - - -;
#N canvas 484 63 422 413 histogram-view 0;
#X obj 119 119 int;
#X obj 119 181 t f f;
#X obj 119 203 tabread \$0-histo;
#X obj 119 323 tabwrite \$0-histo;
#X obj 119 64 * 1;
#X obj 119 86 + 1;
#X obj 119 245 + 0.05;
#X obj 119 24 inlet;
#X obj 119 272 clip 0 1;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 1 1 3 1;
#X connect 2 0 6 0;
#X connect 4 0 5 0;
#X connect 5 0 0 0;
#X connect 6 0 8 0;
#X connect 7 0 4 0;
#X connect 8 0 3 0;
#X restore 249 235 pd histogram-view;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-histo 2 float 0;
#X coords 0 1 1 0 200 140 1;
#X restore 465 177 graph;
#X msg 81 118 bang;
#X obj 307 117 s \$0-histo;
#X obj 249 150 until;
#X obj 249 127 max;
#X msg 307 94 const 0;
#X obj 249 178 gaussian-random 0 0.01;
#X msg 249 94 1;
#X msg 212 45 seed1 12 \, seed2 192313;
#X obj 81 145 gaussian-random;
#X connect 3 0 11 0;
#X connect 5 0 8 0;
#X connect 6 0 5 0;
#X connect 7 0 4 0;
#X connect 8 0 1 0;
#X connect 9 0 6 0;
#X connect 10 0 8 0;
#X connect 11 0 0 0;
#N canvas 309 24 864 609 10;
#X text 337 37 Simplified Box-Muller method as described on: 
http://www.dspguru.com/dsp/howtos/how-to-generate-white-gaussian-noise
;
#X text 53 143 V1;
#X text 211 143 V2;
#X text 136 212 S;
#X text 84 482 X;
#X obj 320 176 inlet;
#X text 325 152 variance;
#X obj 108 384 sqrt;
#X obj 266 178 inlet;
#X text 270 153 mean;
#X obj 318 210 loadbang;
#X obj 318 263 select 0;
#X msg 318 291 1;
#X obj 318 239 f \$2;
#X obj 82 144 t f f f;
#X obj 146 144 t f f;
#X obj 135 178 *;
#X obj 101 178 *;
#X obj 101 210 +;
#X obj 102 237 log;
#X obj 102 264 /;
#X obj 102 291 * -2;
#X obj 102 318 sqrt;
#X obj 83 354 *;
#X obj 83 409 * 1;
#X obj 83 433 + \$1;
#X obj 83 458 outlet;
#X obj 82 77 t b b;
#X obj 82 48 route bang seed1 seed2;
#X msg 134 74 seed \$1;
#X msg 205 76 seed \$1;
#X obj 82 18 inlet;
#N canvas 0 0 645 530 frand 0;
#X obj 119 183 outlet;
#X obj 119 41 inlet;
#X obj 119 105 random 1e+06;
#X obj 119 151 / 1e+06;
#X obj 119 128 - 50;
#X connect 1 0 2 0;
#X connect 2 0 4 0;
#X connect 3 0 0 0;
#X connect 4 0 3 0;
#X restore 146 111 pd frand;
#N canvas 0 0 645 530 frand 0;
#X obj 119 183 outlet;
#X obj 119 41 inlet;
#X obj 119 105 random 1e+06;
#X obj 119 151 / 1e+06;
#X obj 119 128 - 50;
#X connect 1 0 2 0;
#X connect 2 0 4 0;
#X connect 3 0 0 0;
#X connect 4 0 3 0;
#X restore 82 112 pd frand;
#X connect 5 0 7 0;
#X connect 7 0 24 1;
#X connect 8 0 25 1;
#X connect 10 0 13 0;
#X connect 11 0 12 0;
#X connect 11 1 7 0;
#X connect 12 0 7 0;
#X connect 13 0 11 0;
#X connect 14 0 23 0;
#X connect 14 1 17 0;
#X connect 14 2 17 1;
#X connect 15 0 16 0;
#X connect 15 1 16 1;
#X connect 16 0 18 1;
#X connect 17 0 18 0;
#X connect 18 0 19 0;
#X connect 18 0 20 1;
#X connect 19 0 20 0;
#X connect 20 0 21 0;
#X connect 21 0 22 0;
#X connect 22 0 23 1;
#X connect 23 0 24 0;
#X connect 24 0 25 0;
#X connect 25 0 26 0;
#X connect 27 0 33 0;
#X connect 27 1 32 0;
#X connect 28 0 27 0;
#X connect 28 1 29 0;
#X connect 28 2 30 0;
#X connect 29 0 33 0;
#X connect 30 0 32 0;
#X connect 31 0 28 0;
#X connect 32 0 15 0;
#X connect 33 0 14 0;
#N canvas 426 51 797 591 10;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-gaussian 2 float 2;
#X coords 0 1 2 -1 200 140 1;
#X restore 355 158 graph;
#X obj 79 189 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X floatatom 162 70 5 0 500 1 variance - -;
#X obj 162 89 / 100;
#X obj 217 116 tgl 15 0 empty empty switch 17 7 0 10 -262144 -1 -1
0 1;
#X floatatom 108 32 5 0 0 1 mean - -;
#X obj 108 51 / 100;
#X obj 107 216 tabwrite~ \$0-gaussian;
#X text 254 15 Gaussian White Noise;
#X obj 230 141 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#N canvas 484 63 814 486 histogram-view 0;
#N canvas 0 0 450 300 countto 0;
#X obj 99 58 inlet;
#X obj 99 177 f 0;
#X obj 127 177 + 1;
#X msg 142 143 0;
#X obj 99 208 outlet;
#X obj 99 142 until;
#X obj 99 117 t a b;
#X obj 99 96 max;
#X connect 0 0 7 0;
#X connect 1 0 2 0;
#X connect 1 0 4 0;
#X connect 2 0 1 1;
#X connect 3 0 1 1;
#X connect 5 0 1 0;
#X connect 6 0 5 0;
#X connect 6 1 3 0;
#X connect 7 0 6 0;
#X restore 119 117 pd countto;
#X obj 119 162 tabread \$0-gaussian;
#X obj 119 249 int;
#X obj 119 271 t f f;
#X obj 119 293 tabread \$0-histo;
#X obj 119 383 tabwrit