12 Modulating Modifiers

Modifying incoming audio and control signals was introduced in Chapter 7. The present chapter introduces new modules and extends earlier concepts in modifiers around the loose organizing theme of converting between earlier signals, e.g. from gates to envelopes.

12.1 Rectification, wavefolding, and composition

As discussed in Chapter 4, signals are either unipolar or bipolar. One way to make a bipolar signal unipolar is to add an offset to it, e.g. if a signal ranges from -5 to +5 V, then add 5 V to obtain a 0 to +10 V signal. Another more interesting way to convert a bipolar signal to unipolar is to rectify the signal, as shown in Figure 12.1. Half-wave rectification simply removes the negative part of the signal by stopping the signal at zero, and staying at zero until the signal becomes positive again. Full-wave rectification reflects the signal across the x-axis, i.e. takes the absolute value of the signal. If you add a fully rectified signal to the original signal, you will get a half rectified signal because the negative portion of the original signal and the reflected portion of the fully rectified signal will cancel out.

Rectification of a sine wave using either half or full rectification. Image © Omegatron/CC-BY-SA-3.0.

Figure 12.1: Rectification of a sine wave using either half or full rectification. Image © Omegatron/CC-BY-SA-3.0.

A variation of rectification is wavefolding. In wavefolding, a comparator (see Section 10.3) triggers reflection of the wave when it reaches an upper or lower threshold, as shown in Figure 12.2. Thus wavefolding is like rectification on parts of the signal that cross these boundaries, but a folding parameter allows the amplitude of the wave to increase until it reaches the opposing boundary, repeating the process. Wavefolding does not affect the polarity of a signal.

Wavefolding (green) of a sine wave (purple). The fold parameter moves the top and bottom portions of the wave to their respective boundaries where they reflect (left). Further increase of the fold parameter causes them to reach the opposing boundary and reflect again (right), a repeatable process that creates additional folds.

Figure 12.2: Wavefolding (green) of a sine wave (purple). The fold parameter moves the top and bottom portions of the wave to their respective boundaries where they reflect (left). Further increase of the fold parameter causes them to reach the opposing boundary and reflect again (right), a repeatable process that creates additional folds.

Rectification and wavefolding change harmonics and therefore timbre. The best way to understand their effect on harmonics is to consider a triangle at full rectification. As the bottom part of the triangle is reflected, the resulting wave is still a triangle wave, but at twice the frequency as before, e.g. a 200 Hz wave becomes a 400 Hz wave, and the signal is offset above zero. For a triangle wave, wavefolding doesn't double frequency but instead triples it, e.g. a 200 Hz wave becomes a 600 Hz wave. Tripling occurs because when a peak reflects, it creates two additional peaks in addition to itself. Figure 12.3 illustrates these two cases. The tripling behavior of wavefolding means that it will add all odd harmonics to a sine wave but not add harmonics to the other basic waveshapes, because they already have odd harmonics. Instead, wavefolding will change the relative strengths of the harmonics, and as wavefolding increases it will put more energy into higher harmonics for a brighter sound.

Full wave rectification (left) and wavefolding (right) of a triangle wave. The wavefolded peaks that have just reached the boundary are circled.

Figure 12.3: Full wave rectification (left) and wavefolding (right) of a triangle wave. The wavefolded peaks that have just reached the boundary are circled.

The square wave has unusual behavior for wavefolding and rectification that deserves special mention. During wavefolding, the upper and lower parts of the square wave will move in opposite directions rather than fold as shown in Figures 12.2 and 12.3. As a consequence, there are moments where the two parts of the square wave meet at zero and result in a non-wave, somewhat comparable to amplitude modulation through wave folding. Half rectification on a square wave turns it into an identical square wave, but at half amplitude and an offset. Full rectification on a square wave turns it into just an offset, i.e. a constant voltage. Because a constant voltage has zero frequency (0 Hz) it can be removed with a high pass filter - this is a good idea in most audio applications where constant voltages create noise.95

The effects of rectification and wavefolding on the four basic wave shapes is summarized in Table 11.1 with respect to the addition of harmonics, change in frequency, and change in amplitude. In all cases, the amplitude of individual harmonics changes, leading to a change in timbre with respect to the original wave. Sometimes these changes can be quite extreme. For example, a saw wave at full rectification keeps all harmonics, but the strongest harmonics more closely match a triangle wave than a saw.

Table 11.1: Addition of harmonics, change in frequency, and change in amplitude to the four basic waveshapes under wavefolding, half rectification, and full rectification. Note all three affect strength of harmonics and so timbre.
Wave Wavefolding Half rectification Full rectification
Sine Odd harmonics All harmonics All harmonics at double frequency
Triangle - All harmonics but every 4th Double frequency
Square - Amplitude reduced by half Offset voltage
Saw - - -

Let's take a look at the change in harmonics resulting from wavefolding and rectification. The best way to hear these is to step through with a sequential switch and use an LFO to drive the wavefolding. Try creating this patch using the button in Figure 12.4.

Figure 12.4: Virtual modular for contrasting the effect of wavefolding and rectification on the four basic waveshapes.

Rectification has multiple uses besides changing harmonics. One obvious use is making a bipolar control signal unipolar (e.g. to drive a VCA). Another interesting use is to use rectification to create composite waveshapes by combining the top part of one waveshape with the bottom of another. This is relatively simple to do by fully rectifying two waveshapes and inverting one to become the bottom portion of the wave. It's slightly trickier to align the top and bottom portions, but it's possible to do so using a module that allows specification of phase offsets. Figure 12.5 shows an example of waveshape composition using the top portion of a sine wave and the bottom portion of a square wave. By blending parts of different waves, you can achieve an intermediate sound, e.g. a slightly more mellow square wave.

Upper sine wave and lower square wave portions cut using rectification and aligned with a phase offset (left). The final wave is high pass filtered to remove the voltage offset (right).

Figure 12.5: Upper sine wave and lower square wave portions cut using rectification and aligned with a phase offset (left). The final wave is high pass filtered to remove the voltage offset (right).

Try creating a new waveshape through rectification using the button in Figure 12.6. This method would also allow you to perform operations on just one part of the signal if desired, e.g. waveshaping on just the top half.

Figure 12.6: Virtual modular for contrasting the effect of wavefolding and rectification on the four basic waveshapes.

A simpler way to perform waveshape composition is to use analog logic. In analog logic, AND is the maximum of two inputs, and OR is the minimum of two inputs. Figure 12.7 shows an example of applying the minimum to the two waveshapes from above. The way to understand the operation is to follow the wave from left to right and at each point ask which wave is the lower of the two (i.e. is the minimum). Sine is below the square wave for the positive portion of the wave, but in the negative portion of the wave, square is lower. Note for this example, sync was still required to maintain the relative position of the two waves to each other, but manipulating phase was not necessary. The maximum operation proceeds similarly to the minimum operation, except the maximum of the two waves is output at each point. The min/max operations are a simpler way to compose than the rectification approach above, but the trade off is that there is somewhat less control over what part of the waveshape is used.

Sine and square waves with matched frequency and synchronized (left). The output wave from the minimum operation is high pass filtered to remove the voltage offset (right).

Figure 12.7: Sine and square waves with matched frequency and synchronized (left). The output wave from the minimum operation is high pass filtered to remove the voltage offset (right).

Explore waveshape composition with min/max operators using the button in Figure 12.8. As in the previous patch, sync between the waveshapes and high pass filtering are useful for maintaining a consistent result across pitches and removing voltage offsets, respectively.

Figure 12.8: Virtual modular for composing waveshapes using min/max operations.

12.2 Slew

Slew slows the rate of change of a signal. We've seen this before with low pass filters, where the signal being slowed was audio rate. Slew limiters behaves much the same way as low pass filters but are designed to work with unipolar signals. Recall RC circuits from Section 7.2 leech out energy from parts of the wave shape and return that energy to other parts, thus smoothing the signal. Slew limiters work the same way but typically have parameters to control the rate of slew for both upward and downward transitions.

Slew limiters have applications in many areas that involve delaying a signal. For example, we can make a gate delay by combining a slew limiter with a comparator. When a slew limiter receives a gate, its output voltage will slowly rise depending on the rate of slew, until the voltage is high enough that the comparator sends out a high signal. Before we look at portamento, try creating a gate delay from a slew limiter and comparator using the button in Figure 12.9. The second scope in the patch shows another interesting application of slew, which is to convert gates into envelopes. If the rise time runs into the fall time, the envelope will only go up and down (attack and decay). Shorter rise and fall times will preserve the top of the gate, making an attack-sustain-release envelope, with sustain at max level.

Figure 12.9: Virtual modular for using a slew limiter and comparator to make a gate delay and slew alone to convert a gate to an envelope.

Perhaps the most common use of slew is to implement portamento/glissando by smoothing stepped V/Oct control signals to create glides. If you consider V/Oct signals to be stepped like gates, then the last patch should help you understand how this works. A slewed V/Oct signal will have a range of voltages between the steps, and these intermediate voltages will be cause a VCO receiving them to output intermediate pitches. Most slew limiters will base the glide time on the distance between notes as well as the rise/fall settings. This can be challenging musically, so if a constant glide time is desired, a better option is to use a low-pass filter. Try patching up a slew limiter to a VCO to implement portamento using the button in Figure 12.10.

Figure 12.10: Virtual modular for using a slew limiter to implement portamento.

Slew can also be combined with full rectification to make an envelope follower, a very useful tool for processing audio. When we make sounds in modular, we typically apply an envelope like an ADSR in order to give the sound dynamic loudness. We can further use the envelope to control modulation like filter cutoff, so that the spectrum of the sound changes at the same time as its loudness. Envelopes can can be used for sidechaining effects like ducking, where the envelope on the kick is inverted and used to reduce the volume of other sounds, which gives the music a pulsing quality.

Sidechaining is relatively simple when an envelope was used to generate the sound, but when the sound isn't synthesized, like samples or live-recordings of instruments, an envelope follower is needed to generate the envelope that will be used for sidechaining. An envelope follower essentially traces a curve along the peaks of a sound wave to outline an envelope akin to an ADSR. Since ADSR envelopes are unipolar, full rectification of the audio takes place first. Then slew is used to slow the rapid changes in the sound and generate a smoothish curve. Some tuning of the envelope follower is typically required to create an envelope with the desired properties. Try patching up an envelope follower using full rectification and a slew limiter using the button in Figure 12.11. The audio in the patch comes from lo-fi synthesized speech with no envelope, and the patch demonstrates sidechaining to duck noise based on the followed envelope.

Figure 12.11: Virtual modular for using full rectification with a slew limiter to create an envelope follower.

12.3 Quantizers

A quantizer maps input values to a smaller set of outputs. We discussed quantization in Section 6.6 in the context of bit depth, where the height of a sound wave is approximately measured in order to convert it from analogue to digital. In music, quantization is typically used to refer to either beat quantization or note quantization. Beat quantization is often relevant when performing live into a sequencer. If the sequencer is grid-based, any played beat will be snapped to the grid, i.e. snapped to the beat. In modular, note quantization is the more commonly used, and note quantization maps a voltage range to a particular note. Modular quantizers typically allow scales to be selected to determine what notes are available.

Perhaps the easiest way to understand quantizers is through voltage controlled sequencers. Recall that sequencers are typically clocked and advance one step at a time. A voltage controlled sequencer will select the step based on the incoming voltage. So when a voltage within a range corresponding to the step is received, that step will be selected, and whatever voltage was there will be output. Quantizers perform the same function except that the output notes are determined by the scale rather than being assigned.

Despite this similarity, quantizers are often used after modular sequencers to make them easier to tune. If a quantizer is used on the output of a sequencer, adjustment to a sequencer knob will step from one note to the next rather than move through all frequencies in between. Also, if the quantizer has scale selection, then it will affect all notes in the sequence simultaneously, which can be very convenient. However, it's important to keep in mind that a quantizer's voltage for a note, e.g. C4, may not make your oscillator go to the same note. To ensure your oscillator's output matches a quantizer, you must tune your oscillator so they match. Try patching up a quantizer both ways using the button in Figure 12.12: first using a voltage controlled sequencer and then as a modifier on a sequencer's output.

Figure 12.12: Virtual modular for implementing a quantizer using a voltage controlled sequencer and using a quantizer module to process the output of a sequencer.

The last patch used a sequencer to store notes, but it's also possible to use a quantizer without a sequencer. Particularly for arpeggios, its easy enough to use LFOs that cycle up and down. All that is needed is a sample and hold module to synchronize the pitches to gates, and an attenuator to restrict the range of the LFO to the range of notes desired. The relationships between LFO frequency, LFO range, gate/trigger frequency, and gate/trigger synchronization are illustrated in Figure 12.13. If sampling occurs at the same frequency as the LFO, then it will always select the same note. To get more notes, the sampling needs to occur at a higher frequency.

A sine wave LFO (purple) being sampled (green) so the sampled values can be input to a quantizer to create an arpeggio. If the sampling rate matches the LFO frequency, only one repeating note will be sampled (left). The sampling rate must be higher than the LFO rate (right) to increase the number of notes. See text for additional factors that effect what voltages are sampled.

Figure 12.13: A sine wave LFO (purple) being sampled (green) so the sampled values can be input to a quantizer to create an arpeggio. If the sampling rate matches the LFO frequency, only one repeating note will be sampled (left). The sampling rate must be higher than the LFO rate (right) to increase the number of notes. See text for additional factors that effect what voltages are sampled.

If the sample and hold is clocked with another LFO whose frequency is not a multiple of the quantized LFO, then the arpeggio will slowly shift its played notes over a longer period. Try patching up an LFO quantizer arpeggio using the button in Figure 12.14. Other ways of creating variations are to change the range of the LFO, the offset of the LFO, the sampling rate, and the sampling phase/synchronization to the LFO.

Figure 12.14: Virtual modular for creating an arpeggio using an LFO through a quantizer.

Another common application for quantizers is in generative patches where probability is used to generate voltages which are then turned into notes. We can incorporate probability into the last patch using almost the same modules but connected a different way. Try patching up a probability-based generative patch using sample and hold on noise through a quantizer and speed variable clocks for different note lengths using the button in Figure 12.15.

Figure 12.15: Virtual modular for creating an generative melody using sample and hold on noise through a quantizer.

12.4 Check your understanding

  1. For which kind of modulation is rectification useful?

  2. Which basic waveshape becomes offset voltage under full rectification?

  3. Slew slows the rate of change of a signal like what kind of filter?

  4. Which of the following can't be done with slew?

  5. When creating an arpeggio with a quantizer and an LFO, what other module is essential?