MSP Filter Tutorial 4: Subtractive Synthesis
Click here to open the tutorial patch: Media:04fSubtractiveSynthesis.maxpat
In this tutorial, we'll look at using filters creatively with a group of MSP audio generators that create different kinds of noise~. Noise generation is a core component of subtractive synthesis, a sound design methodology that works by taking complex signsl and sculpting them with filters, subtracting energy from the original signal (compare this with additive synthesis, which works in the opposite fashion). Along the way, we'll discuss ways to shape this noise using an object that creates and controls a bank of parallel filters.
- Turn on the audio in the patcher by clicking on the ezdac~ object. Adjust the number box that controls the volume for the noise~ object and listen to the result. Turn it down and turn up the volume for the pink~ object. Do the same for the rand~ object. Click in the number box that is connected to the inlet of the rand~ object (labeled 'Frequency'). Type
100and hit return. Try
1000and hit return.Experiment with other values.
The noise~, pink~, and rand~ objects all generate noise at a signal rate. Noise, at its essence, is a type of random number generation; as a result, these objects behave in a similar manner to Max objects such as random and drunk.
The noise~ object generates white noise, which means that all possible frequencies in the audio spectrum are equally represented over time. The process of generating white noise digitally is quite simple: every sample, pick a random number between
A waveform and spectrogram plot of white noise.
The pink~ object generates pink noise, which means that every octave in the audio spectrum has equal weight. This is sometimes referred to as 1/f noise, as the probability of a frequency occuring is the inverse of its value, e.g. frequencies of 100 Hz are twice as probable as 200 Hz. The aural difference between the two is fairly obvious: white noise has far more high frequency content and sounds 'harsher' than pink noise:
Pink (1/f) noise: waveform and spectrogram.
The rand~ object is a random number generator that generates a signal, picking a new random value for that signal at a variable rate. It takes an argument (or a value at its inlet) to set the frequency of the random number selection. A frequency of
44100 makes the object indistinguishable from white noise. This allows us to create band-limited noise that has an upper boundary we can specify:
A rand~ object picking values at
1000 Hz: waveform and spectrogram.
Because noise has such broadband frequency content, it can be filtered and sculpted to create very precise timbres. The compositional technique of subtractive synthesis relies on this attribute of noise generation; it's often easier (or more efficient) to start with noise and filter it down then attempt to create the desired timbre through adding oscillators.
- Turn down the volumes in patcher area
1and take a look at patcher area
2. Turn up the volume using the number box at the bottom of the signal chain (controlling the *~ object connected to the dac~). Click in the number box labeled 'Frequency' connected to the phasor~ object, type
0.1and hit return. Type a higher frequency (e.g.
3.0) and hit return. Experiment with different values.
2 contains a noise~ object sending its signal into a lores~ filter. The frequency of the lowpass filter is being modulated by a phasor~, which we've scaled to ramp between
600 at the frequency we specify. As a result, the cutoff frequency of the filter 'sweeps' at regular intervals. This is an example of an LFO, or low-frequency oscillator, being used to modulate a parameter of an audio processing system. As you can hear, the lores~ object attenuates the high frequencies output from the noise~ object. In addition, the resonance value of the lores~ causes the filter to have a peak just below its cutoff frequency, giving a notably 'pitched' sound to the filtered noise.
Banks of filters
- Turn down the volume on area
2in the tutorial patcher and take a look at area
3. One-by-one, turn up and down the gain~ sliders connected to the dac~ object.
The fffb~ object stands for Fast, Fixed, Filter Bank. Unlike the cascade~ object, which implements a number of biquad~ filters in series, the fffb~ object arranges a number of reson~ objects in parallel, which is to say that the settings of one filter will not affect any of the others. The fffb~ object takes a number of arguments which set its behavior: the number of filters, the base frequency of the filter bank, the ratio between filters, and the Q of the filters. All of the parameters of the object with the exception of the number of filters can be changed with Max messages; the number is fixed because, as we can see, each filter connects to a separate outlet. This allows us to create filter banks, where we can 'tap' each bandpass filter individually:
Output of the lowest and highest two filters in our fffb~ object: waveform and spectrogram.
- Using the mouse, click and drag on the dial object in patcher area
3. This has the audible effect of shifting the entire filter bank upwards or downwards. Turn up different gain~ sliders to hear the results.
The value from the dial is interpreted as a MIDI pitch, converted to frequency (via the mtof) object, and used to format the
freqRatio message to the fffb~ object. The
freqRatio message takes two arguments: the center frequency of the first (lowest) filter, and the ratio between it and subsequent filters. The letter
H, when used as the ratio, tells the fffb~ object to set the filters in the bank to harmonic multiples of the base frequency. So the message
freqRatio 100. H would set our ten filters up to be centered to
100 Hz increments.
- Click in the <link type="refpage" name="number">number box</link> objects connected to the pak object. Type
200.in the lefthand number box, and
1.5in the righthand number box. Click on the number box connect to the
messagebox containing the message
QAll $1. Enter the value
100.and hit return. Turn up and down the different gain~ sliders to hear the results.
We can easily set our filters in a frequency ratio other than a harmonic series. Setting our base frequency to
200. and our ratio to
1.5 results in a bank of ten filters set to the frequencies
200, 300, 450, 675, 1012.5, 1518.75, 2278.125, 3417.1875, 5125.78125, 7688.671875, and 11533.0078125 Hz, respectively. As with the reson~ object, we have direct control over the Q of these filters. A Q of
100 r esults in a bandwidth of 1/100 the frequency, creating narrow, pitched filters.
- Click the
messagebox to the right of patcher area
3that contains a series of lists. Listen to the results by adjusting the gain~ sliders.
The fffb~ object takes many other messages, enabling us to set the filters not in ratio at all. Sending lists in the format
filter_# frequency Q allows us to set each filter in the bank individually. In our example, we've set the ten filters to frequencies from a musical chord.
Next to each gain~ slider in patcher area
3 is a user-interface object that registers the amplitude of the signal connected to it. These meter~ objects allow us to see the gain of each filter in the fffb~ pre-fader, i.e. before we listen to it.
- Turn down all the gain~ sliders in patcher area
3. Click in the number box that triggers the
0.5and hit return. Type
10.and hit return. Listen to the results and notice the effect of the Q on the gain of each filter, and look at how the meter~ objects respond.
Because the fffb~ object works in parallel, the output gain of all the filters in the bank will typically be greater than the gain of the incoming signal. Depending on the Q values and the frequencies used, the potential volume output from the fffb~ can be quite high. The meter~ object lets you observe your volumes visually in the patcher window before you listen (and potentially hurt your ears).
MSP has three simple-to-use noise generator objects, which generate white noise (noise~), pink noise (pink~), and band-limited random signals (rand~). These objects are ideal candidates for filtering. The fffb~ object implements a fixed filter bank of parallel bandpass filters which can be controlled via ratios of a base frequency or individually. The meter~ object allows you to visually see the amplitude of any part of the MSP signal path, and is incredibly useful for metering and debugging your audio patchers.
noise~ - White noise generator
pink~ - Pink noise generator
rand~ - Band-limited random signal
fffb~ - Fast fixed filter bank
meter~ - Visual peak level indicator