I'm trying to model the following in ChucK "OSC1, OSC2, and an LFO (Low Frequency Oscillator) Modulation: OSC1 produces a simple square wave tone, the pulsewidth of which is modulated with OSC2, and then amplitude modulated with the LFO oscillator." I think I understand the LFO amplitude modulation part, but I don't understand what pulse width modulation with osc2 means. SqrOsc osc1; SqrOsc osc2; SqrOsc lfo; Gain master; lfo => blackhole; osc1 => master; 220.0 => osc1.freq; 0.8 => osc1.gain; 20.0 => lfo.freq; 0.9 => lfo.gain; fun void updateAtSampleRate() { while (true) { ((lfo.last() + 1.0) / 2.0) * 0.8 => osc1.gain; 1::samp => now; } } master => dac; spork ~ updateAtSampleRate(); 2::second => now;
Michael, You'll want to use PulseOsc instead of SqrOsc. When they say "square wave tone" they probably mean the squared-off edges. Basically, a pulse width of 0.5 would be a "square" wave, while 0.2 would be a much shorter impulse. I'm not sure what the exact spectral content of the different pulse widths are, though. I think the modulation is the fun part. And more links... http://www.soundonsound.com/sos/Mar03/articles/synthsecrets47.asp Hope this helped. Andrew On Jan 26, 2010, at 4:56 PM, Michael Heuer wrote:
I'm trying to model the following in ChucK
"OSC1, OSC2, and an LFO (Low Frequency Oscillator) Modulation: OSC1 produces a simple square wave tone, the pulsewidth of which is modulated with OSC2, and then amplitude modulated with the LFO oscillator."
I think I understand the LFO amplitude modulation part, but I don't understand what pulse width modulation with osc2 means.
SqrOsc osc1; SqrOsc osc2; SqrOsc lfo; Gain master; lfo => blackhole;
osc1 => master; 220.0 => osc1.freq; 0.8 => osc1.gain; 20.0 => lfo.freq; 0.9 => lfo.gain;
fun void updateAtSampleRate() { while (true) { ((lfo.last() + 1.0) / 2.0) * 0.8 => osc1.gain; 1::samp => now; } }
master => dac; spork ~ updateAtSampleRate(); 2::second => now; _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On 8 Feb 2010, at 04:12, Andrew C. Smith wrote:
You'll want to use PulseOsc instead of SqrOsc. When they say "square wave tone" they probably mean the squared-off edges. Basically, a pulse width of 0.5 would be a "square" wave, while 0.2 would be a much shorter impulse. I'm not sure what the exact spectral content of the different pulse widths are, though.
A Fourier coefficients tables say that for pulse width factor k, the series is the sum of b_i*sin(i*w*t), i = 1, 2, ..., the angular frequency w = 2*pi*f, f the frequency, and b_i = 4*A*sin(i*pi*k)/i*pi where A is the amplitude (half distance between max and min). So for k = 1/2, one just gets odd partials of relative amplitude 1/i, but when distorted the whole spectrum starts to show up. Hans
participants (3)
-
Andrew C. Smith
-
Hans Aberg
-
Michael Heuer