On 4/9/06, David Golightly wrote:
However, if you wish to invert the phase for a given partial, simply prefix it with a '-':
sinesum 256 1 -0.5 0.333 -0.25
for instance - each negative partial is flipped 180º.
(Too bad there's no way to make intermediate phases with such a simple statement - you'd have to do that by hand with a counter & a formula.)
-david
Hi, I'm a relative newbie to Pd. I have tried to build a patch that lets you create an array, summing partials at any phase/amplitude (as an learning exercise).
I kept getting stack overflow with my first attempt because my array was too large so i had to put a delay into the circuit. Is this a reasonable workaround or is there a better way?
Anyway, if anyone can suggest improvements to my patch i would appreciate it. I'm guessing someone will have the answer using half the number of objects.
My next step is to add some receive objects so that a message can be sent of the form: [; const 0.5; partial 1 0.4 0.7; partial 3 0.8 0.5 ( to set up an array in one go.
Cheers Garry. =====================================
#N canvas 57 9 706 686 10; #N canvas 0 0 450 300 graph1 0; #X array $0array 100 float 0; #X coords 0 1 99 -1 200 140 1; #X restore 472 38 graph; #X symbolatom 395 61 10 0 0 0 - - -; #X floatatom 30 227 20 0 0 0 - - -; #X floatatom 44 80 5 0 0 0 - - -; #X obj 395 81 t s s; #X obj 290 -90 f 0; #X obj 432 213 pack f f s; #X msg 290 -111 0; #X obj 165 -90 + 1; #X msg 359 240 ; $3 $2 $1; #X obj 149 -22 f; #X obj 95 -44 delay 1; #X text 168 -63 counter; #X obj 286 -37 t f f f b; #X obj 370 9 f $0; #X obj 331 35 makefilename %darray; #X obj 81 -66 select 100; #X floatatom 150 81 5 0 0 0 - - -; #X obj 452 -88 f $0; #X obj 438 -113 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 427 -59 ; $1array const 0; #X floatatom 195 80 5 0 0 0 - - -; #X text 192 118 amp; #X floatatom 264 76 5 0 0 0 - - -; #X obj 254 27 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X text 419 255 symbol , index+1 , exprResult; #X text 108 119 init phase; #X text 19 116 index; #X obj 36 169 expr $s5[$f1] + ($f3 * sin(2*3.14157*$f2+ 2*3.14157* ($f1*($f4))/100)); #X text 434 185 index; #X obj 275 318 f $0; #X obj 261 293 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 259 364 f $0; #X obj 245 339 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 317 332 ; $1array read table.txt; #X msg 317 376 ; $1array write table.txt; #X text 258 119 partial; #X connect 1 0 4 0; #X connect 3 0 28 0; #X connect 4 0 28 4; #X connect 4 1 6 2; #X connect 5 0 13 0; #X connect 6 0 9 0; #X connect 7 0 5 0; #X connect 8 0 10 1; #X connect 8 0 16 0; #X connect 10 0 5 0; #X connect 11 0 10 0; #X connect 13 0 8 0; #X connect 13 1 3 0; #X connect 13 2 6 1; #X connect 13 3 14 0; #X connect 13 3 24 0; #X connect 14 0 15 0; #X connect 15 0 1 0; #X connect 16 1 11 0; #X connect 17 0 28 1; #X connect 18 0 20 0; #X connect 19 0 18 0; #X connect 21 0 28 2; #X connect 23 0 28 3; #X connect 24 0 17 0; #X connect 24 0 21 0; #X connect 24 0 23 0; #X connect 28 0 2 0; #X connect 28 0 6 0; #X connect 30 0 34 0; #X connect 31 0 30 0; #X connect 32 0 35 0;
On 4/8/06, Frank Barknecht <fbar at footils.org> wrote:
Hallo, alexandre matheson hat gesagt: // alexandre matheson wrote:
does sinesum automatically offset the phase of each partial by 180º?
No, every partial starts with phase=0. You can see for yourself with:
sinesum 256 1 sinesum 256 0 1 sinesum 256 0 0 1 sinesum 256 0 0 0 1 sinesum 256 0 0 0 0 1 etc.
sinesum is just a sum of sines. ;)
Ciao
Frank Barknecht _ ______footils.org_ __goto10.org__
PD-list at iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
G Quested wrote:
I kept getting stack overflow with my first attempt because my array was too large so i had to put a delay into the circuit. Is this a reasonable workaround or is there a better way?
no, the workaround is not reasonable.
why not using a "real" counter (as found in doc/02.control.examples/05.counter) combined with an [until]? this way you get an iterative counter instead of a recursive one, which would allow you to use big arrays (>200 :-)) without stack overflows with the additional benefit that it happens in logical null-time.
mfg.asd.r IOhannes