[chuck-users] pulse width modulation

Andrew C. Smith andrewchristophersmith at gmail.com
Sun Feb 7 22:12:24 EST 2010


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 at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users



More information about the chuck-users mailing list