Pulse Width Modulation

I was watching a DivKid episode and he said his favourite move is to audio rate modulate pulse width. I never felt like I had that moment with PWM where it stood out. So I was searching the forum for a VCO that I could experiment with. I found an entry in the Reface Library thread that explained the “Basic VCO.”

This really opens things up. I didn’t really take the time to understand the shaping on that oscillator. When you pair it with the Reface filters, it’s very versatile. Again, Audulus leading me back to the actual synthesis techniques and not just expensive hardware modules that make things sound better by turning knobs.
PWM.audulus (337.3 KB)


The shp input on the Oscillator node also affects pulse width when the output type is set to square wave. 0 is 50% duty cycle and 1 is 0%. In fact the Basic Oscillator module uses Oscillator nodes internally. Note that the Oscillator module scales the shape input to the square wave by 0.9 to prevent a 0% duty cycle (no sound).


PWM 2.3.audulus (1.7 MB)


This sentence had me puzzled and I was then confused by the rest of what you said. I assumed that the shape input produced the results on the list here, including the point that if you feed it a waveform it will modulate the width of the pulse coming out of the squarewave output. I feel like if there were an italicized word in the sentence I could pick out what part I am missing.

What about 0 and 1? What does zero refer to here?

Why am I noting this? (I appreciate the information, but my mind can’t seem to grip any of it as hanging together in some way as a group of ideas I can know what to do with.

1 Like

Sorry my explanation wasn’t particularly clear, I was referring to the Oscillator node, not the Basic Oscillator module. I was just pointing out that the Oscillator node itself features PWM and that the module actually uses the shape input on the node to control the shape for the square and saw waves. The Oscillator node is the core for many of the VCO modules in Audulus.
While it is possible to build an oscillator using the phasor node, these oscillators are not band limited and often result in considerable aliasing. The phasor node is very CPU efficient and is often used for LFOs. It also accepts a negative input for frequency and so is the basis for through-zero FM oscillators. The Oscillator node is band limited at the Nyquist frequency so its outputs are anti-aliased. Of course once you introduce a wave folder or manipulate the waveform in some other way that adds harmonics, you may create aliasing, but the oscillator node itself does not.

The node has an input for frequency, amplitude, sync, and shape. It has a selector for the type of output, sine, triangle, saw and square. The shape input only affects the saw and square waves, the sine and triangle are not modulated. The shape input takes a modulation value that varies between 0 and 1, and in the case of the square wave, 0 (or no modulation) on the input is a 50% duty cycle square and 1 is a 0% duty cycle (which is a constant -1 output)
Since a modulation value of 1 results in a constant output and therefore no sound, the Basic Oscillator Module clamps the shape value internally from 0 to 0.9 so some sound is always produced.

The Basic Oscillator module in the reface collection contains 4 Oscillator nodes, one for each output. For sine output the Oscillator node is fed through a wave folder, the triangle output is fed to a waveshaper, and the saw and square outputs use the built-in shape input on the node.


Nice to learn that I can pulse width modulate a saw wave. I found your explanation about the contents of the reface module encouraging in terms of personalizing some of the modules for a patch, freeing up some cpu. That is, I could delete some features I that are not in use for a patch. That being said, one of the strengths of the reface library has been the immediacy of use, to build fast enough to feed the interest loop. Thanks for taking the time.


Glad to help. In the case of the Saw wave it’s not really PWM but something similar. As you increase the shape modulation it gradually adds a second peak in the center of the of the primary ramp until, at maximum modulation you end up with a ramp at twice the frequency and half the amplitude. Sort of a “supersaw” effect. In both cases you’re varying the harmonic content of the wave.