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.

Simple SynthDefs

Start by creating a new, blank file in the SuperCollider IDE.

For these exercises, the goal is to get practice writing simple and basic SynthDefs. Below you will create SynthDefs to playback the classic waveforms. You can assume that each SynthDef here takes two arguments of the following default parameters: freq = 200 and amp = 0.1. You can assume that the out bus for each of these is 0. Ensure that the SynthDef produces a stereo signal. Finally, play the SynthDef back by creating a Synth. Assign it to a variable so that you can stop the sound using the .free method.

  1. Write a SynthDef called \tri that plays back the UGen LFTri.ar with the frequency freq and amplitude amp. Additionally, write a line of code to create the Synth and then a line to free it.

  2. Write a SynthDef called \pulse that plays back the UGen Pulse.ar with frequency freq, amplitude amp, and duty cycle width. width should be an additional argument to the SynthDef and should have a default value of 0.5. Additionally, write a line of code that creates the Synth but override the default values with a frequency of 100Hz, amplitude of 0.15, and width of 0.75. Write a line of code to free the synth.

  3. Write a SynthDef aclled \trioctave that plays back the sum of two triangle waves produced by LFTri.ar. One of the triangle waves should be passed the arguments freq and amp and the other should be an octave higher with half the amplitude. Write a line of code to create the synth, a line to set the frequency to 400Hz while it’s playing, and a line to free it.

More SynthDef practice

In the next part of the lab we are going to make some simple pitched synthetic notes that sound close to pitched percussion instruments like a vibraphone or marimba. The basic theory behind this is we are going to take an impulse (a very narrow spike as if we took a square wave with a duty cycle infinitesimally close to zero) and pass it through a resonator to bring out harmonics in the spike so it sounds pitched.

Step 1: Write a SynthDef called \blip

Write a SynthDef called blip with the following conditions:

Step 2: Write a SynthDef called \reverb

Write a SynthDef called \reverb that takes in a stereo signal and passes it through the UGen FreeVerb. This UGen will add reverberance to the sound, creating a sense of space and depth. FreeVerb has a few important parameters that you can adjust. The parameter mix controls how much of the reverberance to add relative to the original signal and the parameter room gives a sense of how large of a reverberant space should be created. The higher the value of room the more was there will be.

An audio recording below with added reverberance. Halfway through I increase the room size to give it more depth.

Step 3: Creating Multiple Blips

Here we will create multiple blips and pass them through an instance of the reverb. To add a little bit more unpredictability, we will modify slightly the original \blip SynthDef. Create a new SynthDef called \blipRandom. It should be identical to the SynthDef \blip except that we are going to use the UGen Dust which generates random impulses. Set the average number of impulses per second to be 0.5.

Next create four running instances of \blipRandom to create an A minor chord. An A minor chord consists of the notes A, C, and E. Recall that 440Hz is the A on the staff in treble clef. A C is three semitones above A for a ratio of 6/5. An E is seven semitones above A for a ratio of 3/2. You should create a group of random blips. Below is a diagram of what the plotTree should look like:

Because all of the blips are in one group, it should become very easy to free them by simply freeing the group.

Solutions

Solutions to the lab will be posted after the lab is over.

lab_synthdefs_solns.scd