Thor demystified 3: Pulse Width Modulation

Posted by Mattias in Tutorials

In the early days of analogue synthesis, electronic components and designs were far more expensive than they are now, so manufacturers such as Korg entered the market with simple, single-oscillator monosynths. Yet these instruments could, if programmed correctly, sound surprisingly rich and full. Much of the appeal of the Korg 700 (for example) was a result of its Chorus I and Chorus II waveforms, but while the word ‘chorus’ was a good description of how these waves sounded, it didn’t tell you what they were. In retrospect, a more accurate name would have been “pulse waves whose duty cycles (or ‘pulse widths’) are being modulated by a low frequency oscillator”, but how many players would have understood that in 1974?

Nowadays, this “pulse width modulation” (PWM) is a standard facility on all analogue and ‘virtual analogue’ synths, and it remains important because of this ability to create rich, chorused sounds using a single oscillator. But before showing you some examples of how you might like to use PWM in Thor, let’s begin by asking…

What is Pulse Width Modulation?

To explain this, let’s start with the square wave in figure 1. As you can see, this is a special case of the family of pulse waves, defined by the fact that the wave spends exactly the same amount of time at the top of the waveform as it does at the bottom. A slightly more technical way of describing this is to say that it is has a duty cycle of 50% (because the wave is at the top of its cycle for exactly half of the time).

Fig1 Smallx
(Click to enlarge)

Figure 1: A pulse wave with a duty cycle of 50%

Of course, there’s nothing stopping us from generating pulse waves with any other duty cycle we please, from 0% (where the wave is permanently rooted to the bottom of the cycle, and is therefore silent) to 100% (where it is rooted to the top of the cycle, and again silent). For example, figure 2 shows a pulse wave with a duty cycle of 25%.

Fig2 Small
(Click to enlarge)

Figure 2: A pulse wave with a duty cycle of 25%

On some analogue synthesisers (such as the Minimoog) you are merely offered a selection of pulse widths from which to build sounds, but this is a shame because it’s not hard to design the electronics so that a modulator can affect the duty cycle. For example, you could start with a square wave and use an LFO to sweep the duty cycle repeatedly from 0% to 100% and back again. I’ve illustrated this in figure 3, which shows the initial square wave (the red line) the triangle wave LFO modulating the duty cycle (the green line) and the resulting waveform (the blue line).

Fig3 Small
(Click to enlarge)

Figure 3: A triangle wave modulating the pulse width

Without going into the maths of PWM, it should be intuitively obvious that the harmonic content (and therefore the tone) of the sound is changing from moment to moment as the shape of the waveform changes. However, this still doesn’t explain why sweeping the duty cycle makes a single oscillator sound ‘chorused’. To cut a long story short, it’s because PWM using a triangle wave as the modulator splits the single pitch of the initial oscillation into two frequencies such as those shown in figure 4. This is the same as having two oscillators, with one being frequency modulated with respect to the other. If you think back to what we achieved by detuning two oscillators in the first of these tutorials, this is a wonderful result, and it suggests all manner of synthesis possibilities.

Fig4 Small
(Click to enlarge)

Figure 4: The frequencies of the two components that comprise the PWM waveform

PWM Example 1 – the PWM bass sound

One classic application for PWM is the creation of thick ‘synthy’ bass lines, so this is where we’ll start. Set up a simple, single-oscillator bass sound. Insert an analogue oscillator in Osc1, set it to Octave 2, and select Mono Retrig as the keyboard mode. Now insert a low-pass filter as shown, with moderate drive and full keyboard tracking. There’s no need for a filter envelope or anything else more sophisticated because the filter will be used simply to attenuate the high frequencies in the sound. Finally, set the Amp Env Sustain to maximum to create a ‘square’ shape for the sound, and you’re done. (See figure 5.) Sound #1  shows that this has a suitably low pitch, but that it is featureless and rather boring:

Fig5 Small
(Click to enlarge)

Figure 5: A very simple bass patch

Experimenting with the other waveforms in Osc1 doesn’t help, but don’t despair… we can improve this sound without invoking extras oscillators or complicated filtering. Set the oscillator to be a pulse wave, and set its duty cycle to 24, which is approximately 20%:

That’s no better, you might say, and you would be right. But now we’ll invoke PWM. Choose a slot in the modulation matrix and select LFO1 as the modulation source, with the pulse width of Osc1 as its destination. Now we have to choose suitable parameters for the LFO and the modulation depth. Experience shows that PWM works well at bass frequencies if the modulation speed is quite slow – around 1Hz – and at high frequencies when it is somewhat faster – around 5Hz. We can make this happen by setting the LFO rate to around 1.5Hz and having it track the keyboard at around 50%, which is a value of 63 or thereabouts. Once you have set this, a modulation depth of around 40 creates a nice effect; any less would be too little for my taste, any more would be too much. (See figure 6.) The result is contained in Sound #3:

Fig6 Small
(Click to enlarge)

Figure 6: A much better PWM bass patch

I discovered this sound on a Korg 700 in the early 1970s, and I still like it a lot. It is rich and involving, but not so complex that it makes the mix too thick or muddy. What’s more, it is ideal for further filtering and shaping, and it requires just a single oscillator and only the simplest synthesiser architecture to obtain it, which is just as well, because the little Korg had just a single oscillator and only the simplest synthesis architecture!

PWM Example 2 – a percussive sound

Another interesting use of PWM is to emulate the sounds of hammered and plucked instruments, for which the effect generated by two very slightly detuned frequencies can be useful for recreating (and exaggerating) the natural chorusing that occurs on some acoustic instruments.

Starting with the PWM bass patch in figure 6, increase the oscillator pitch to octave 4, and then replace the low-pass filter with a high-pass filter (i.e. the HP mode in the state-variable filter) with a cut-off frequency of around 2.5kHz. This means that, instead of attenuating the high frequencies and letting the low ones pass, the filter is now attenuating the low frequencies and letting the high ones pass. Secondly, change the shape of the Amp Env by reducing the Sustain to zero and setting a short Decay and an even shorter Release to create notes that decay rather quickly once played. Finally, reduce the PWM amount in the modulation matrix to zero. You now obtain a typical ‘electric’ harpsichord sound, as created on early monosynths that did not offer PWM:

You can improve this sound by returning the PWM amount to 40 or thereabouts. (See figure 7.) The effect is not vast, but it adds a subtle extra dimension that is missing from the previous patch:

Of course, Thor can do many things that early synthesisers could not and, if you change the Keyboard Mode to Polyphonic, it makes a huge difference to the sound  which is now akin to an early ’70s electronic piano, although rather better than the cheap-sounding instruments of the era:

Fig7 Small
(Click to enlarge)

Figure 7: The Korg 700 PWM-based ‘harpsichord’ patch

It’s worth noting that you can also combine PWM with amplitude modulation and sync to create some pleasing effects, so if you would like to continue experimenting with this class of sound, I recommend that you return to tutorial #2 to see what happens when you add PWM into the patches described. You’ll obtain some interesting results.

PWM Example 3 – an ensemble sound

Despite the interesting sounds demonstrated above, PWM is most commonly used for generating rich string pads and other ensemble sounds, especially on polyphonic synthesisers that have no chorus units. For example, the classic Jupiter 8 strings sounds are a combination of a PWM’d oscillator and a sawtooth oscillator producing three pitches that are very slightly detuned from one another, thus creating the chorus effect. Of course, Thor is in many ways more powerful than a vintage, dual-oscillator analogue polysynth, so we can extend the principle even further to create a truly luscious ensemble sound…

We’ll start with figure 8, which shows a very simple sound. This has a single oscillator producing a pulse wave with a duty cycle of around 20%, no filter, no modulation, and just the simplest of amplitude contouring to produce a smooth Attack and a gentle Release. If I play a rather famous chord sequence from 1972 using this patch, it sounds very bare and uninteresting:

Fig8 Small
(Click to enlarge)

Figure 8: A single pulse wave patch with no treatment

To improve this, I’m again going to use the modulation matrix, directing LFO1 to the pulse width of Osc1. For this sound, I find that a frequency of around 2Hz works nicely, as does a modulation depth of around 60. Although it’s far from the finished article, Sound #8  (which was generated by the patch in figure 9) definitely has more to recommend it than the previous one:

Fig9 Small
(Click to enlarge)

Figure 9: A single pulse wave with PWM

The next stage is to add a second oscillator. On the Jupiter and many other synths of the era – the Prophet 5, the Oberheim OBX and others – the trick was to add a sawtooth wave and to detune the oscillators slightly. On Thor, we can do more, and I’m going to add a second oscillator with PWM driven by LFO2 running at a slightly different rate from LFO1. What’s more, I’m going to set the duty cycle to around 80% rather than 20% and apply the modulation with the opposite polarity: around -60, this time. This means that the PWM effect is subtly different for each of the oscillators. I’m also going to detune the oscillators slightly, using settings of around +6 and -6 to make the chorus effect even deeper. Sound #9  is starting to sound rather nice, and yet we’re still using nothing more than two analogue-style oscillators to produce it:

Figure 10 shows the modified patch.

Fig10 Small
(Click to enlarge)

Figure 10: Adding a second PWM’d oscillator to enrichen the ensemble effect

Next, I’m going to steal a trick from the string synths of the 1970s, and add another oscillator an octave below the first two. For this one, I’m going to choose a duty cycle close to 50%, and modulate it from LFO1. (There are many other options, each of which will produce a slightly different sound.) Adding the lower octave (see figure 11) creates great depth, as demonstrated by Sound #10:

Fig11 Small
(Click to enlarge)

Figure 11: Adding a third PWM’d oscillator for greater depth

If you’ve followed me this far, you can now experiment with the modulation speeds and depths, the amount of detune, and so on. However, I’m going to finish by adding a low-pass filter to remove some of the high frequencies in the sound, and I’m going to pass the result through the delay effect to spread it across the stereo field:

Remember, this patch (figure 12) has no modulation other than PWM, no dynamic filtering, no sophisticated envelopes, and no chorus effect… but it’s gorgeous, isn’t it? It demonstrates yet again how much you can do in Thor using little more than the analogue oscillators.

Fig12 Small
(Click to enlarge)

Figure 12: A finished PWM ensemble patch

Text & Music by Gordon Reid

Post tagged as: , , ,