#N canvas 416 23 563 711 10;
#X declare -stdpath ./;
#X obj 5 689 cnv 15 552 21 empty empty empty 20 12 0 14 #e0e0e0 #202020 0;
#X obj 2 349 cnv 3 550 3 empty empty inlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 5 538 cnv 3 550 3 empty empty outlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 6 574 cnv 3 550 3 empty empty arguments 8 12 0 13 #dcdcdc #000000 0;
#X obj 70 358 cnv 17 3 147 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 70 511 cnv 17 3 17 empty empty 1 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 89 548 cnv 17 3 17 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X text 178 549 signal;
#X obj 233 166 cyclone/cycle~ 440;
#X text 142 511 float/signal;
#X text 142 357 float/signal;
#X text 196 407 set;
#X text 223 407 - only a "set" message sets to the default cosine wave;
#X text 113 579 1) float;
#X text 113 594 2) symbol;
#X text 113 622 3) float;
#X text 189 622 - sets offset within the given array (default 0);
#X obj 233 138 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X text 292 137 frequency in hertz;
#X text 124 440 setall <symbol>;
#X text 124 457 buffer <symbol>;
#X text 225 440 - sets an array using its entire length;
#X text 224 424 - sets array name and offset (reads only 512 points);
#X text 225 457 - sets array (analogous to the setall message);
#X text 223 356 - sets frequency in hertz (negative values allowed);
#X text 223 372 - sets frequency in hertz;
#X text 82 490 buffer_sizeinsamps <f>;
#X obj 6 645 cnv 3 550 3 empty empty attributes 8 12 0 13 #dcdcdc #000000 0;
#X text 139 653 @frequency <float> | @phase <float> | @buffer <symbol>;
#X text 139 668 @buffer_offset <float> | @buffer_sizeinsamps <float>;
#N canvas 482 85 817 617 attributes 0;
#X text 37 100 This is different than the "set" message or setting the array name as the second argument \, in which cases [cycle~] only reads 512 points from the buffer. This is because [cycle~] could historically only read 512 \, so it still works that way for backwards compatibility issues.;
#X text 37 23 @buffer:;
#X text 35 185 @buffer_offset:;
#X text 435 10 @buffer_sizeinsamps:;
#X text 433 37 This attribute allows other buffer sizes than 512 points (when using the set message or by specifying the buffer as the second argument) or the entire array (via the setall message or the buffer attribute).;
#X text 434 98 Thus \, the @buffer_sizeinsamps attribute (also setable via the "buffer_sizeinsamps" message) sets to size values in powers of two from 16 to 65536 (13 values from 2^4 to 2^16).;
#X obj 512 147 cnv 15 200 84 empty empty empty 20 12 0 14 #e0e0e0 #404040 0;
#X text 522 148 Possible values \; - 16 \; - 32 \; - 64 \; - 128 \; - 256 \; - 512;
#X text 642 147 - 1024 \; - 2048 \; - 4096 \; - 8192 \; - 16384 \; - 32768 \; - 65536;
#X text 37 213 The @buffer_offset attribute (also as the "buffer_offset" message) followed by a float sets the sample offset into the buffer. If your offset is too large and close to the end of the table) \, the remainder is filled with zeros.;
#X text 37 44 The @buffer attribute (also setable via the "buffer" message) is analogous to the "setall" message. This means that the buffer attribute followed by an array name sets that entire array to be used as the waveform., f 60;
#X obj 441 236 cnv 15 364 33 empty empty empty 20 12 0 14 #e0e0e0 #404040 0;
#X text 448 239 Other possible values are: "-1" \, which sets to the entire buffer's length \, and "0" \, which sets to 512 samples.;
#X text 446 283 Below we have [cycle~] reading 4096 points from the buffer with an offset of 1 sample. This means it doesn't read the first and the last 2 samples from this 4099 points buffer \, which are \, by the way \, the guardpoints generated by the "sineseum" command for interpolation in the other subpatch ([pd set/setall]).;
#X text 547 512 Other attributes are: @frequency (nothing special about it) and @phase (see the next subpatch example on phase)., f 33;
#X msg 42 346 buffer_offset \$1;
#X obj 45 291 hsl 128 15 0 4096 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 42 316 nbx 8 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X text 128 315 offset;
#X obj 550 383 cyclone/cycle~ 110 \$0-saw @buffer_offset 1 @buffer_sizeinsamps 4096, f 26;
#X obj 42 375 cyclone/cycle~ 110 @buffer \$0-saw;
#X obj 42 487 output~;
#X obj 194 423 cnv 19 260 142 empty empty empty 20 12 0 12 #e0e0e0 #404040 0;
#N canvas 0 50 450 250 (subpatch) 0;
#X array \$0-offset 441 float 0;
#X coords 0 1 440 -1 262 144 1 0 0;
#X restore 193 422 graph;
#X obj 69 429 metro 250;
#X obj 69 408 loadbang;
#X obj 56 453 tabwrite~ \$0-offset;
#X obj 550 434 output~;
#X connect 15 0 20 0;
#X connect 16 0 17 0;
#X connect 17 0 15 0;
#X connect 19 0 27 0;
#X connect 20 0 21 0;
#X connect 20 0 26 0;
#X connect 24 0 26 0;
#X connect 25 0 24 0;
#X restore 463 213 pd attributes;
#N canvas 277 64 819 587 phase 0;
#X obj 539 398 *~;
#X msg 620 386 \$1 10;
#X obj 620 406 line~;
#X obj 620 363 nbx 4 14 0 10 0 1 empty indice empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 623 341 hsl 128 15 0 2 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X text 635 341 Modulation Index;
#X text 34 19 The second inlet in [cycle~] can set a phase offset with values between 0 and 1 (but values over this boundaries are wrapped internally to the 0-1 range)., f 56;
#X obj 203 374 cyclone/cycle~;
#X obj 284 344 phasor~ 440;
#X msg 552 130 \; pd dsp 0 \, dsp 1;
#X text 420 278 Phase modulation:;
#X text 449 311 [cycle~] conveniently allows phase modulation with its second inlet.;
#X obj 539 368 cycle~ 50;
#X obj 434 432 cyclone/cycle~ 220;
#X text 400 369 mod frequency (50 Hz);
#X text 554 433 carrier frequency (220 hz);
#X obj 77 531 cyclone/cycle~ @frequency 440 @phase 0.5;
#X text 38 503 Frequency and phase set as attributes:;
#X text 474 186 The phase is also resset in many operations in edit mode - so nevermind if you hear "clicks" when editing the patch!, f 43;
#X text 42 344 [cycle~] being driven by phase only =>;
#X obj 146 148 cyclone/cycle~ 440;
#X msg 273 127 \$1 10;
#X obj 273 148 line~;
#X obj 273 107 nbx 4 14 0 10 0 1 empty indice empty 0 -8 0 10 #dcdcdc #000000 #000000 0.125984 256;
#X obj 276 86 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X text 317 85 phase;
#X obj 131 114 cyclone/cycle~ 440;
#X obj 434 478 output~;
#X obj 203 417 output~;
#X obj 131 180 +~;
#X obj 131 221 output~;
#X text 471 56 You can't resset the phase of [cycle~] as you can with [osc~] \, but note that the the phase gets resseted to the beggining of the cycle when you turn the DSP off and then on again, f 46;
#X connect 0 0 13 1;
#X connect 1 0 2 0;
#X connect 2 0 0 1;
#X connect 3 0 1 0;
#X connect 4 0 3 0;
#X connect 7 0 28 0;
#X connect 8 0 7 1;
#X connect 12 0 0 0;
#X connect 13 0 27 0;
#X connect 20 0 29 1;
#X connect 21 0 22 0;
#X connect 22 0 20 1;
#X connect 23 0 21 0;
#X connect 24 0 23 0;
#X connect 26 0 29 0;
#X connect 29 0 30 0;
#X restore 405 235 pd phase;
#X text 35 84 [cycle~] is a linear interpolating oscillator* that reads repeatedly through one cycle of a waveform. The default internal waveform is one cycle of a cosine wave (16k in size \, 64 bits) \, but you can set other waveforms from given arrays., f 69;
#X text 100 423 set <symbol \, float>;
#X text 136 390 phase <float>;
#X text 112 373 frequency <float>;
#X text 88 474 buffer_offset <float>;
#X text 225 549 - a periodically repeating waveform;
#X text 189 579 - sets frequency in Hz (default 0);
#X text 225 490 - changes the buffer size to powers of 2 (16 to 65536);
#X text 189 594 -;
#X text 201 594 sets array used as the wavetable (but only reads 512 points from the buffer) \, default: internal cosine table, f 55;
#X text 20 170 *;
#X text 36 165 [cyclone/wave~] provides other interpolation types., f 26;
#X obj 497 71 cyclone/dsponoff~;
#N canvas 824 151 413 277 [buffer~] 0;
#X msg 137 81 open;
#X text 15 15 The [cycle~] object works with any kind of array set in Pd as well with arrays set in the [buffer~] object. In the case of a multi channel [buffer~] \, [cycle~] will only read its first channel.;
#X obj 86 131 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 174 109 cyclone/buffer~ \$0-sine @samps 512;
#X obj 174 81 cyclone/loadmess fill sin;
#X obj 86 158 cyclone/cycle~ 440 \$0-sine;
#X obj 86 192 output~;
#X connect 0 0 3 0;
#X connect 2 0 5 0;
#X connect 4 0 3 0;
#X connect 5 0 6 0;
#X restore 463 235 pd [buffer~];
#X text 223 389 - sets phase offset;
#X text 225 474 - sets offset into buffer;
#X text 225 511 - phase offset;
#N canvas 403 23 880 723 set/setall 0;
#X obj 28 378 hsl 396 22 0 4096 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X text 156 481 sets buffer and offset;
#X obj 26 235 cnv 15 398 138 empty empty empty 20 12 0 14 #e0e0e0 #404040 0;
#N canvas 0 50 450 250 (subpatch) 0;
#X array \$0-wavetable 4099 float 4;
#X coords 0 1 4098 -1 400 140 1;
#X restore 25 234 graph;
#N canvas 317 53 392 189 generate 0;
#X obj 44 102 send \$0-wavetable;
#X obj 44 54 loadbang;
#X msg 44 77 sinesum 4096 0 0 0 1 0.7 1 0.4 1 1 1 \, normalize;
#X connect 1 0 2 0;
#X connect 2 0 0 0;
#X restore 301 218 pd generate waveform;
#X obj 93 426 nbx 9 18 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X text 192 428 Offset;
#X msg 52 490 set;
#X text 12 469 internal;
#X text 15 489 wave;
#X obj 93 521 cyclone/cycle~ 440 \$0-wavetable 512;
#X text 34 17 The set message with no arguments sets the internal waveform (16k cosine \, 64 bits). A set message followed by a symbol sets the array to be used as a waveform. After the name \, you can also optionally set an offset for that table.;
#X obj 93 454 cyclone/prepend set \$0-wavetable;
#X obj 110 481 print;
#X text 36 113 If you have an array with more than 512 samples \, you can scroll through the array with an offset index value \, but it'll only read 512 samples from it. If not enough table points are available (as if you have a table smaller than 512 samples or if your offset is too large and close to the end of the table) \, the remainder is filled with zeros. Below we have a table with 4099 points to use with [cycle~].;
#X text 36 70 With the set message \, [cycle~] reads only 512 points in a table (because historically it could only deal with 512 points tables - other new messages allow more points).;
#X obj 622 328 cyclone/loadmess setall \$0-saw;
#X obj 622 387 cyclone/cycle~ 110;
#N canvas 927 315 441 227 generate-saw 0;
#X obj 44 46 loadbang;
#X msg 44 77 sinesum 4096 1 0.5 0.333333 0.25 0.2 0.166667 0.125 \, normalize;
#X obj 44 129 send \$0-saw;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X restore 769 138 pd generate-saw;
#X obj 464 155 cnv 15 398 138 empty empty empty 20 12 0 14 #e0e0e0 #404040 0;
#N canvas 0 50 450 250 (subpatch) 0;
#X array \$0-saw 4099 float 4;
#X coords 0 1 4098 -1 400 140 1 0 0;
#X restore 463 154 graph;
#X obj 621 507 cyclone/cycle~ 110 @buffer \$0-saw;
#X obj 555 334 nbx 4 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X text 483 45 The "setall" message behaves the same as the buffer method or attribute. Hence \, followed by an array name \, it sets that entire array to be used as a waveform (a 4099 points wavetable in this case). This is quite different than the "set" message or the second argument \, which only reads 512 points from the buffer.;
#X obj 93 625 output~;
#X obj 622 420 output~;
#X obj 621 545 output~;
#X obj 266 568 cnv 19 310 110 empty empty empty 20 12 0 12 #e0e0e0 #404040 0;
#N canvas 0 50 450 250 (subpatch) 0;
#X array \$0-cycle 441 float 0;
#X coords 0 1 440 -1 312 112 1 0 0;
#X restore 265 567 graph;
#X obj 125 569 metro 250;
#X obj 125 548 loadbang;
#X obj 112 593 tabwrite~ \$0-cycle;
#X connect 0 0 5 0;
#X connect 5 0 12 0;
#X connect 7 0 10 0;
#X connect 10 0 24 0;
#X connect 10 0 31 0;
#X connect 12 0 10 0;
#X connect 12 0 13 0;
#X connect 16 0 17 0;
#X connect 17 0 25 0;
#X connect 21 0 26 0;
#X connect 22 0 17 0;
#X connect 22 0 21 0;
#X connect 29 0 31 0;
#X connect 30 0 29 0;
#X restore 375 213 pd set/setall;
#X obj 233 204 output~;
#X obj 2 5 ./header cycle~;
#X text 19 58 Wavetable oscillator;
#X obj 54 223 declare -stdpath ./;
#X text 32 280 see also:;
#X obj 429 310 open-else;
#X text 496 289 click;
#X obj 26 303 cyclone/wave~;
#X msg 429 288 wavetable~;
#X obj 126 302 tabosc4~;
#X text 203 288 Plugdata users or those with ELSE can also use [else/wavetable~] as a more powerful alternative, f 34;
#X connect 8 0 50 0;
#X connect 17 0 8 0;
#X connect 58 0 55 0;
