august wrote:
can someone please examine the attatched patch for me and see why I get WAY different values for [cos~] and [expr~ cos($v1)] ?
because [expr~] is mathematically correct and takes values from 0..2pi (and wraps)
[cos~] is a there to make an oscillator with a [phasor~] and thus takes values from 0..1 (it is very invconvenient if you have to scale the phasor~ to -pi..+pi if you want to make a sine out of it.
the attached patch shows how to make them the same (note that they do not exactly make the same, since [expr~] really evaluates the cosine of the argument, while [cos~] just does a table-lookup and some interpolation)
mfg.ad.r IOhannes
#N canvas 0 0 664 535 10; #X obj 24 140 cos~; #X obj 24 301 snapshot~; #X obj 126 101 sig~; #X floatatom 24 336 0 0 0 0 - - -; #X obj 126 56 * 0.01; #X floatatom 126 33 0 0 0 0 - - -; #X obj 107 229 metro 500; #X obj 107 208 r metro; #X floatatom 126 80 5 0 0 0 - - -; #X obj 219 261 expr~ cos($v1); #X obj 218 293 snapshot~; #X floatatom 218 324 0 0 0 0 - - -; #X obj 414 48 loadbang; #X msg 414 83 ; pd dsp 1 ; metro 1; #X obj 213 124 sig~; #X floatatom 213 103 5 0 0 0 - - -; #N canvas 0 0 450 300 denormalize 0; #X obj 92 48 inlet; #X obj 92 264 outlet; #X obj 149 63 loadbang; #X obj 149 130 atan; #X msg 149 93 1; #X obj 141 158 * 8; #X obj 92 205 *; #X text 130 38 0..1; #X text 142 262 0..2pi; #X connect 0 0 6 0; #X connect 2 0 4 0; #X connect 3 0 5 0; #X connect 4 0 3 0; #X connect 5 0 6 1; #X connect 6 0 1 0; #X restore 211 81 pd denormalize; #X obj 99 399 -; #X floatatom 100 427 8 0 0 0 - - -; #X obj 105 251 t b b; #X connect 0 0 1 0; #X connect 1 0 3 0; #X connect 1 0 3 0; #X connect 2 0 0 0; #X connect 3 0 17 0; #X connect 4 0 8 0; #X connect 5 0 4 0; #X connect 6 0 19 0; #X connect 7 0 6 0; #X connect 8 0 2 0; #X connect 8 0 16 0; #X connect 9 0 10 0; #X connect 10 0 11 0; #X connect 10 0 11 0; #X connect 11 0 17 1; #X connect 12 0 13 0; #X connect 14 0 9 0; #X connect 15 0 14 0; #X connect 16 0 15 0; #X connect 17 0 18 0; #X connect 19 0 1 0; #X connect 19 1 10 0;