Debian Codegraph @

examples/basic/phasor.ck

raw
1 //------------------------------------------------------------------------------
2 // name: phasor.ck
3 // desc: basic demo using the Phasor UGen to do modulate the width of a PulseOsc
4 //
5 // The phasor linearly ramps from 0 --> 1 every cycle, and rate can be controlled
6 // programmatically. Note: this is *not* intended to be a sound-generating UGen!
7 // It is more commonly used to modulate other signals or do lookups in a wavetable.
8 // For example, in this demo, the phasor signal modulates the PulseOsc width.
9 //
10 // Although the phasor signal is the shape of a Sawtooth, it performs no anti-aliasing!
11 // For a sawtooth shaped signal, use SawOsc instead.
12 //
13 // author: azaday
14 // date: Spring 2023
15 //------------------------------------------------------------------------------
16 Phasor phasor => blackhole;
17 PulseOsc pulseOsc => dac;
18
19 // set phasor to ramp from 0-1 at a frequency of 1hz
20 1.0 => phasor.freq;
21
22 // set pulseOsc frequency
23 440.0 => pulseOsc.freq;
24
25 while (true) {
26 phasor.last() => pulseOsc.width;
27 1::samp => now;
28 }