Dr Charles Martin
Is this enough?
we now turn our attention to making “music”, not just “sound”
in this class, we’re open in terms of defining “music”, it doesn’t have to follow a particular style or emphasise traditional aspects such as melody and harmony.
broadly, we follow Edgard Varese’s idea of music as “organised sound”.
today we look at methods for organising sound in time, allowing us to start to define compositions
What defines a “note”? A beginning, an end, and a shape over time.
The shape can be made by changing amplitude, but in computer music we can adjust other properties as well.
In programming we are used to having static variables
Now we want dynamic numbers that are scheduled to change in specific ways.
line is a slope generator
Pd has two kinds of “connections” between objects:
Audio connections are processed at the audio frame rate: fast enough to get blocks of 64 samples to the DAC at 44.1kHz.
Message processing is interleaved with block processing which usually happens every 1.45ms.
Objects with a
~ in the title, output or operate with audio connections. Those without
~ are the message variants.
We’re starting to get serious with our Pd programming so make sure you understand the difference!
object boxes (rectangular) set out different Pd objects. First word is the object, other words are creation arguments.
message boxes (rectangular with a triangle cutout on the right side) define a message to be sent (the text in the box) when the box is activated by a mouse click or an incoming bang.
Messages boxes are actually programmable: they can receive arguments and incorporate them into the message string (
$2…), you can set them with messages starting with
set. Read the help patch for a message box to see some examples.
line: outputs numbers as messages at a (default) rate of one ever 20ms (slow!)
line~: outputs an audio rate signal.
If you make a volume control with
line you will have audible clicks as the volume changes 50 times per second. You need to use
line~ for smooth sounding control over audio.
Note envelopes typically have:
You can add some extra phases:
You could call the whole thing an “ADSR” envelope.
vline~ can be programmed with a comma-separated sequence of ramps of the form
value ramp-time initial-delay
0 1000 10 means “ramp to 0 over 1000ms after 10ms”
*~ to turn the sound up and down to shape a note.
Source: Puckette, M. Theory and Technique of Electronic Music (2007).
Create an envelope generator with
vline~in Pd with a sound source you have already created.
Make sure you know how to use get help about an object by right-clicking (or control-click).
You might want to try the
metro object to generate a sequence of “bangs” to
keep triggering your envelope generator.
Sequencing in electronic music means scheduling events (e.g., notes) to happen in the future.
A composition represented in music notation (sheet music) is like a schedule for a musician showing them which note to play, and when in time.
In Pd, there are lots of ways to represent scheduling information (arrays, text files, long message boxes).
If you were patient enough you can use the tools you have already to organise a whole composition, just like Poeme Electronique
delay is an object that repeats whatever message it receives after a certain number of milliseconds.
delay is not an audio delay, these work differently.
metro emits a bang regularly after a certain number of milliseconds.
N.B., you have to start a
metro by sending it a 1 or connecting it to a toggle box.
One style of sequencer divides time into a number of equal divisions or steps (e.g., 16) with zero or more musical events occurring at each step.
The sequence then repeats over and over again.
This is how most drum machines work; it’s a convenient way to make loop-based music.
Photo by Cone Trees on Unsplash
f (a nameless float variable) and
f sets its value but doesn’t send anything to the output.
f can receive a bang to spiit out the output.
select lets us route different actions based on a number (like
switch in many programming languages)
(one more trick here:
What’s new here?
spigot, only passes messages if right inlet is set to 1
pd ...) to hide counter logic
Even better: hide drum synth in sub-patch, use graph-on-parent to hide sequencer logic except for toggle boxes.
idea: change the parameter of a ugen in time
usually modulation means to change it “regularly”, not every now and then like an envelope
we can do this by running the output of a ugen into a different ugen.
Let’s make some digital effects, vibrato and tremolo.
Connect a (slow)
osc~ to the input of another
osc~, need to do some maths to convert the output range (-1, 1) to something useful (e.g., 437-443)
Connect a (slow)
osc~ to the volume control, similarly change the output range.
You could call the “sounding” osc the carrier and the not-sounding osc the modulation oscillator.
What if the “vibrato” was really fast? Like in the audio range?
We actually end up changing the timbre of the sound.
You can think of it as modifying the frequency domain.
We can use this to make interesting sounds without lots of oscillators for additive synthesis.
AM synthesis results in two tones.
The original spectrum is shifted up and down by the modulation frequency.
This is called “ring modulation” and the metallic sound is quite striking.
Three parameters: C the carrier frequency, M the modulation frequency and D the depth of modulation.
FM Synthesis results in extra frequencies appearing above and below the carrier frequency at multiples of the modulation frequency.
All three sliders change the timbre. (could be bad - why?)
Better to have timbre separate from (fundamental) pitch. We want the shape of the spectrum to stay the same as we change carrier frequency.
In practice, define harmonicity $H = M/C$ and index $I = D/M$
If $H$ is rational, tend to get harmonic sounds ($H = 2$ has odd harmonics and sounds kindof like a clarinet)
If $H$ is irrational, we get dense inharmonic spectra, good for gongs or sound effects.
In practice, many “FM” algorithms actually use phase modulation
Note in the patch that the carrier oscillator is split up into a
…it boils down to the same effect.
PM implementation works better in a multiple-operator context, e.g., Yamaha DX7 and Korg Volca FM have 6-oscillators that can be interconnected in different ways (why?)
We have timbre and notes, but what else can we use?
Synths can sound better with a bit of processing of the output sound.
We can emulate an acoustic space (smooth out the sound), get the sound a bit dirty with distortion/clipping, or modify the amplitude to help mix things together.
To delay some audio means to hold it back from playing for a certain amount of time.
delwrite~ : define a delay line (length in milliseconds), and send audio into it
delread~ : get audio out of the delay line at any point.
imagine rolling marbles down a pipe and cutting a hole in it to access ones you rolled down previously… (kind of).
typical “delay” effects probably have controls for:
sometimes we call the non-effected sound dry and the effected sound wet
Let’s go do it: make a delay effect with GUI objects for these four parameters.
Reverberation is (more or less) lots of little echoes in a room or space that add up to smear out a sound.
We can simulate this with delays!
This one is borrowed from
rev3~ included in Pd that have early reflections and other niceties.
There’s a completely different approach to reverb using convolution, but that’s another story.
Distortion is when a signal is “clipped” resulting in undesirable extra sounds.
Are they really undesirable?
amplify signal—a lot! (e.g.,
clip! Either with
clip~ (hard clipping) or the
tanh function (soft
Remember to boost the input gain a LOT for sweet distorted goodness.
A compressor turns down the volume if a signal rises above a threshold.
Filters “remove” parts of a sound that correspond to certain frequencies.
lop~: low-pass filter,
hip~: high-pass filter,
bp~: band-pass filter.
vcf~ is a low-pass filter designed to be dyanmically controlled (e.g., with an envelope)
bob~ is almost the same as
vcf~ but specifically modelled on filters in Moog analogue synths.
and many more…
Lots of filters—Must be important. (read (a lot) more…)
Time to add some effects to your synthesiser. Here are some options:
create a delay unit with the parameters discussed.
vcf~ filter to a sawtooth oscillator. Use a second envelope to control the filter frequency.
create a really long reverb and use it with very short synth sounds (use a short attack-release envelope)
create multiple effects in a signal chain and use GUI objects to control how much of each one is present in the output sound.