[PD-dev] cos and large amplitude signal in?

Miller Puckette msp at ucsd.edu
Sat Nov 26 14:59:10 CET 2016


I dno't know how well known it is (it really should be mentioned in
the documentation) but taking cosines of large numbers fails.  In fact,
accuracy starts to drop audibly when the input exceeds about 100 in
absolute value, because you are then eating 8 bits of the 24-bit mantissa
to specify teh integer part of teh index, leaving only about 16 for the
fraction.  The situation degrades steadily as the numbers grow past that.

cheers
Miller

On Sat, Nov 26, 2016 at 02:44:13PM +0100, Nicolas Danet wrote:
> Hi, 
> 
> The cos signal object seems to give bad results for a large amplitude signal in (> 1024). As far as i understand it is limited to (2^19 / COSTABSIZE) due to the fractional trick here < https://sourceforge.net/p/pure-data/pure-data/ci/master/tree/src/d_osc.c#l176 >.
> 
> Is it a well known limitation?
> 
> #N canvas 188 157 698 331 12;
> #X obj 25 170 cos~;
> #X obj 25 219 snapshot~;
> #X floatatom 25 245 0 0 0 0 - - -;
> #X obj 92 185 metro 500;
> #X obj 92 159 r metro;
> #X msg 387 92 \; metro 0;
> #X msg 368 38 \; pd dsp 1 \; metro 1;
> #X text 455 53 <-Click to start;
> #X text 456 98 <-Click to stop;
> #X msg 83 34 1025;
> #X obj 25 122 sig~ 1023;
> #X msg 25 33 1024;
> #X msg 146 34 1026;
> #X connect 0 0 1 0;
> #X connect 1 0 2 0;
> #X connect 1 0 2 0;
> #X connect 3 0 1 0;
> #X connect 4 0 3 0;
> #X connect 9 0 10 0;
> #X connect 10 0 0 0;
> #X connect 11 0 10 0;
> #X connect 12 0 10 0;
> #X coords 0 0 1 1 200 140 0;
> 
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at lists.iem.at
> https://lists.puredata.info/listinfo/pd-dev



More information about the Pd-dev mailing list