Lab Goals and Policies
Labs are an opportunity to work together with a partner on exercises to reinforce concepts from lecture and to prepare for problems on the problem sets. A successful lab experience requires each member to contribute equally. In pair programming, one student is the "driver", who controls the keyboard and mouse. The other is the "navigator", who observes, asks questions, suggest solutions, and thinks about slightly longer-term strategies. The two programmers switch roles about every 20 minutes. If you believe your partner is not participating appropriately in pair programming please first address your concerns to your partner, and try to agree on what should be done to make the pair programming more successful. If that approach is not successful, explain the issues to one of your instructors, who will work with you and your partner to improve the situation.
W Handwritten Exercises
-
State the frequencies, amplitudes and phases of the sine waves produced by the following equations. It would be good to refer to the derivations in the slides for ring modulation and amplitude modulation.
- $\sin(2\pi (100)t) * 0.5\sin(2\pi (200)t)$
- $\sin(2\pi (100)t) * (0.5\sin(2\pi (200)t + 1))$
-
In amplitude modulation, describe how the modulation index changes the sound. What does a modulation index of zero do?
-
State just the frequencies produced by the following equations:
- $\sin(2\pi (100 + 20\sin(2\pi (100)t)) t)$
- $\sin(2\pi (200 + 10\sin(2\pi (300)t)) t)$
-
In frequency modulation, describe how the modulation index changes the sound. What does a modulation index of zero do?
-
What frequencies are generated by the equation: $\sin(2\pi (100)t + 20\sin(2\pi (100)t))\sin(2\pi(50)t)$? Do not worry about amplitude or phase.
C Coding Exercises
To get started, create a new SuperCollider file and download a copy of Ella Fitzgerald’s Dream A Little Dream of Me.
-
Write very simple SynthDefs that play back the following modulations in stereo. You could even use the shorthand syntax of
{}.play
instead of writing an explicit SynthDef. These SynthDefs do not need to accept any arguments. In my implementation I scaled the overall amplitude by 0.1 so it was not too loud.-
Ring Modulation of two sine waves of frequencies 400Hz and 200Hz. What frequencies are produced? Check by running
FreqScope.new
. -
Amplitude Modulation of two sine waves of carrier frequency 400Hz and modulating frequency of 200Hz. What frequencies are produced? Check by running
FreqScope.new
. -
Frequency modulation of two sine waves of carrier frequency 200Hz and modulation frequency of 400Hz. Make the amplitude of the modulating frequency equal to 300. What frequencies are produced? Check by running
FreqScope.new
.
-
-
One application of amplitude modulation can be to create inharmonic harmonization to a sound. This can create a kind of voice distortion when applied to vocal music. Start by reading in the Fitzgerald song into a buffer. Then write a SynthDef that plays back the song and applies amplitude modulation (not ring modulation). Your SynthDef should accept arguments for the modulating frequency and its amplitude.
( SynthDef(\am, { arg out = 0, buf, freq_m = 100, amp_m = 1; // Your code here }).add; )
As a follow up, what happens when we set
amp_m
to zero. What happens we setamp_m
to something high like 5? Whenfreq_m = 0.25
andamp_m = 1
what kind of effect do we get? -
The following sounds were created using the frequency modulation code below in SuperCollider. FM synthesis is an inexpensive way to produce simplistic instrument modeling because FM synthesis only requires two sine wave generators. Your task is to determine what arguments are needed to produce the sounds below. Some things to consider:
-
Pay attention to how harmonic the sound is. FM synthesis can produce both harmonic and enharmonic partials.
-
Focus on how “rich” the spectral content is. Are there many partials? Just a few?
You do not need to get the exact parameters that I used for the sounds below. But you should endeavor to provide parameters that produce a reasonable facsimile of the sounds. You should specify all arguments to the SynthDef
fm
with the exception ofout
.( SynthDef(\fm, { arg out = 0, freq_c = 400, modIndex = 1, harmRatio = 1, atk = 0.05, dec = 0.01, sus = 0.5, susLvl = 0.5, rel = 1.5, amp = 0.6, curve = 1; var car, mod, freq_m, env; freq_m = harmRatio * freq_c; mod = (modIndex * freq_m) * SinOsc.ar(freq_m, 0, 1); car = SinOsc.ar(freq_c + mod, 0, 1); env = Env([0, amp, amp * susLvl, amp * susLvl, 0], [atk, dec, sus, rel], curve); env = EnvGen.kr(env, doneAction: 2); Out.ar(out, car * env ! 2); }).add; )
-
Bell sound - Carrier Frequency of 200Hz
-
Clarinet sound - Carrier Frequency of 300Hz. Here we are less concerned with the attack and decay of the sound since that would normally be subject to clarinetist.
-
Triangle sound - Carrier Frequency of 10000Hz.
As a reminder you can create a Synth and pass in arguments with the following syntax:
( ~test = Synth(\fm, [ \modIndex, 1, \susLvl, 0.3, ]); )
-
-
Using frequency modulation, design a SynthDef that uses a sine wave as a carrier frequency
freq_c
and uses another signal withfreq_m
to modulate the sine wave’s frequency to produce a ramp up effect. Determine first what kind of modulating signal would be necessary to achieve the effect.freq_m
will determine the rate of the ramp. For example,freq_m = 0.5
will create a ramp every two seconds, andfreq_m = 2
will create two ramps every second. Additionally, the ramp up effect should swoop from 0Hz to twicefreq_c
. Create parameters for amplitude and out bus and call the SynthDef\rampUp
.Audio example 1:
freq_c = 440
,freq_m = 0.5
,out = 0
, andamp = 0.1
Audio example 2:
freq_c = 880
,freq_m = 2
,out = 0
, andamp = 0.1
Try randomizing some of the aspects of the frequency modulation using the UGens
LFNoise1.kr
orLFNoise0.kr
. You can create fun scratch sounds like the one below. I recommend using these generators to randomize the frequencies of the modulator and the carrier.LFNoise0
generates random values between -1 and 1 at the given rate.LFNoise1
generates linearly interpolated random values between -1 and 1.Randomized example:
Create a separate SynthDef called
\randRamp
to do this.
Solutions
Solutions to the lab will be posted after the lab is over.
lab_modulation_solns.pdflab_modulation_solns.scd