#N canvas 383 34 523 567 12;
#X declare -stdpath ./;
#X obj 23 12 cos~;
#X obj 86 358 snapshot~;
#X obj 86 241 sig~;
#X floatatom 86 384 10 0 0 0 - - - 0;
#X floatatom 86 210 10 0 0 0 - - - 0;
#X text 6 532 see also:;
#X obj 146 532 osc~;
#X obj 182 532 tabread4~;
#X obj 74 532 cos;
#X obj 103 532 expr~;
#X msg 191 274 \; pd dsp \$1;
#X obj 3 43 cnv 1 515 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#N canvas 683 179 572 208 reference 0;
#X obj 10 44 cnv 5 550 5 empty empty INLET: 8 18 0 13 #202020 #000000 0;
#X obj 10 96 cnv 2 550 2 empty empty OUTLET: 8 12 0 13 #202020 #000000 0;
#X obj 10 146 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 10 183 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X obj 28 15 cos~;
#X text 75 14 - cosine wavetable.;
#X text 88 64 signal(s) - input from 0-1 (wraps into 0-1 if outside this range)., f 67;
#X text 88 113 signal(s) - cosine output according to the input., f 63;
#X text 157 156 1) float - sets a single input value.;
#X restore 396 12 pd reference;
#X text 328 11 click =>;
#X obj 86 282 cos~;
#X text 263 181 <-- scroll to set input value, f 16;
#X text 64 11 - cosine wavetable;
#X obj 89 182 hsl 162 19 0 1 0 0 empty empty empty -2 -10 0 12 #dfdfdf #000000 #000000 0 1;
#X text 30 127 For a proper cosine function with input in radians and other trigonometric functions \, see [expr~]., f 64;
#X obj 191 238 set-dsp-tgl;
#X text 222 242 DSP on/off;
#N canvas 748 225 517 356 phasemod 0;
#X obj 102 137 +~;
#X obj 102 184 cos~;
#X obj 102 232 output~;
#X obj 97 310 declare -stdpath ./;
#X floatatom 102 57 5 0 0 0 - - - 0;
#X obj 102 98 phasor~ 400;
#X obj 217 98 osc~ 50;
#X obj 217 149 *~;
#X obj 294 173 line~;
#X msg 294 144 \$1 10;
#X floatatom 294 113 8 0 0 0 - - - 0;
#X obj 297 84 hsl 162 19 0 1 0 0 empty empty empty -2 -10 0 12 #dfdfdf #000000 #000000 0 1;
#X obj 294 27 loadbang;
#X msg 294 56 0.5;
#X floatatom 217 57 5 0 0 0 - - - 0;
#X text 96 36 carrier;
#X text 203 34 modulator;
#X text 356 114 index;
#X text 283 222 This is a simple phase modulation patch., f 22;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 4 0 5 0;
#X connect 5 0 0 0;
#X connect 6 0 7 0;
#X connect 7 0 0 1;
#X connect 8 0 7 1;
#X connect 9 0 8 0;
#X connect 10 0 9 0;
#X connect 11 0 10 0;
#X connect 12 0 13 0;
#X connect 13 0 11 0;
#X connect 14 0 6 0;
#X restore 364 475 pd phasemod;
#X obj 104 323 r bang;
#N canvas 695 116 398 422 multichannel 0;
#X obj 77 311 snapshot~;
#X floatatom 77 112 5 0 0 0 - - - 0;
#X floatatom 165 112 5 0 0 0 - - - 0;
#X obj 132 230 metro 100;
#X obj 132 203 loadbang;
#X obj 132 271 s bang;
#X obj 77 209 cos~;
#X text 93 30 [cos~] works with multichannel signals \, here's an example., f 31;
#X msg 263 179 \; pd dsp \$1;
#X obj 263 143 set-dsp-tgl;
#X text 294 147 DSP on/off;
#X listbox 77 348 20 0 0 0 - - - 0;
#X obj 77 154 sig~ 0.5 0.75;
#X connect 0 0 11 0;
#X connect 1 0 12 0;
#X connect 2 0 12 1;
#X connect 3 0 5 0;
#X connect 3 0 0 0;
#X connect 4 0 3 0;
#X connect 6 0 0 0;
#X connect 9 0 8 0;
#X connect 12 0 6 0;
#X restore 365 373 pd multichannel;
#X text 214 358 mutichannel signal support ----------->, f 20;
#X obj 254 532 wrap~;
#X text 30 50 The [cos~] object is a cosine wavetable reader. The input is a linear index from 0 to 1 and you can also consider it a cosine trigonometric function of the input multiplied by two pi. Values outside the 0-1 range get wrapped inside this range like in the [wrap~] object., f 64;
#X text 42 425 You can use [cos~] in conjunction with [phasor~] to implement an osicllator just like [osc~] \, but you then have access to the phase signal and this way you can also achieve phase modulation \, see example in the subpatch -->, f 61;
#N canvas 572 234 443 244 compatibility 0;
#X msg 61 177 \; pd compatibility 0.54;
#X msg 257 177 \; pd compatibility 0.55;
#X text 73 153 (old table size);
#X text 273 153 (new table size);
#X text 38 22 Up to version 0.54 \, [cos~] relied on a 512-point cosine table \, which was adequate for most "computer music" applications in the 90s with a signal-to-noise ratio of about 110 dB. The default table size is now increased to 2048 points \, improving signal-to-noise by an additional 36 dB. To get the original 512-point tables you can run Pd with compatibility level set to 0.54., f 56;
#X restore 339 285 pd compatibility;
#X text 345 247 compatibility note (open):, f 13;
#X text 320 531 updated for Pd version 0.55;
#X obj 3 515 cnv 1 515 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X connect 1 0 3 0;
#X connect 2 0 14 0;
#X connect 4 0 2 0;
#X connect 14 0 1 0;
#X connect 17 0 4 0;
#X connect 19 0 10 0;
#X connect 22 0 1 0;
