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.

Overview

The midterm will cover topics across the entire first half of the course. Less emphasis will be placed on the topics of Dynamics and Reverb as those concepts were not given on a problem set.

The guide below is not comprehensive but represents a sampling of the kinds of questions that could be asked on the exam. To complete your study, you should review problem sets and course concepts on slides. If you need extra practice please go back over old lab questions as they will be most representative of the kinds of questions that will be asked on the exam.

You should be expected to answer questions related to math, coding, and music. You can expect short answer conceptual questions, coding questions, short proofs, and questions about the relationship between sound and perception.

Fundamentals of SuperCollider

  1. Why doesn’t 3 + 4 * 2 evaluate to 11 in SuperCollider?

  2. Write a function called ~silly that takes a number and posts "That's low" if the number is less than 5 and `“Seems reasonable” otherwise. It does not matter what the function returns.

  3. Write a function called ~countHarmonics that takes an integer representing the fundamental of some sound and an array of frequencies and returns the number of frequencies that are part of that fundamental’s harmonic series. For example, ~countHarmonics(100, [100, 300, 150, 200]) would return 3 because 100, 300, and 200 are harmonics of 100’s harmonic series.

  4. This question emphasizes reading documentation. Write a function called ~range that takes three arguments: an initial value (inclusive), an end value (exclusive), and a step size. The function should return an array of all the values starting from the initial value up to but not including the end value by the step size. For Python users, this is equivalent to range. For example, ~range.value(1, 8, 3) returns an array of [1, 4, 7]. You can assume that the step size is not negative and that all arguments will be integers. Ensure that the elements in the array are integers and not floats. Consider looking up the Help documents on Array!

The Basics of Sound and Waveforms

  1. Discuss the relationship between the harmonic series and timbre.

  2. The ratio between some frequency $f_x$ and some frequency $f_y$ a perfect fifth above is 3 to 2. A perfect fifth is a common interval found in most musical cultures.

    1. What is a perfect fifth above 400Hz?
    2. Write an equation to find the perfect fifth above a frequency $f_x$.
    3. Write an equation to find the frequency $n$ number of perfect fifths above a frequency $f_x$.
  3. Using summation notation, express the waveform whose constituent frequencies are part of the harmonic series with the following properties:

    • Includes every harmonic from the harmonic series
    • The fundamental has an amplitude of $A$.
    • Every other harmonic is $\pi$ out of phase. The fundamental harmonic has a phase of zero.
    • The amplitude of each harmonic $n$ is $1/n^4$ times the fundamental’s amplitude.

    How would we perceive this waveform relative to a sawtooth wave?

  4. Write a SynthDef that implements the waveform described above. It should take the following arguments arg freq = 440, fundAmp = 0.1;

Writing SynthDefs in SuperCollider

  1. Write a SynthDef that crossfades between a square wave and a square wave an octave higher. Use a non-bandlimited square wave. The SynthDef should crossfade between the two square waves using XFade2. The SynthDef takes the following arguments arg freq = 100, amp = 0.1, pan = 0; where pan controls the amount of crossfading between -1 and 1. Output a stereo signal.

  2. Take your work from the previous SynthDef and modulate the pan of the crossfade using a sine wave or triangle wave. Instead of an argument for pan, this SynthDef should have an argument for rate which controls how much the sine or triangle wave oscillates per second. The SynthDef should accept the following arguments: arg freq = 100, amp = 0.1, rate = 0.5;. Write a line to create a Synth and change the rate to a different value. As a side note, this a common wave to create a wobble bass in dubstep.

Amplitude Envelopes

  1. Explain the difference between a fixed-time and sustain-time envelope.

  2. Explain the importance of setting the doneAction to 2.

  3. Write a SynthDef that plays back a sine wave with a fixed-time, ASR envelope with attack time of 0.05 seconds, sustain time of 0.5 seconds, and release time of 0.05 seconds. The SynthDef should take reasonable default arguments for frequency and amplitude.

  4. Write a SynthDef that plays back a sine wave with a sustain-time, ASR envelope with attack time of 0.05 seconds, sustain level equivalent to the provided amplitude, and release time of 0.05 seconds. The SynthDef should take reasonable default arguments for frequency, amplitude, and gate.

Patterns

  1. Consider the following code below:

     (
     SynthDef(\sine, {
           arg freq = 100, amp = 0.1;
           var sig, env;
    
           sig = SinOsc.ar(freq);
           env = EnvGen.kr(Env.linen(0.05, 0.5, 0.05), doneAction: 2);
           sig = sig * env * amp;
    
           Out.ar(0, sig ! 2);
     }).add;
     )
    
     // Pbind Number 1
     (
     Pbind(
           \instrument, \sine,
           \dur, 0.5,
           \midinote, Pseq([60, 67, 72], inf),
           \amp, Pseq([0.1, 0.2], inf),
     ).play;
     )
    
     // Pbind Number 2
     (
     Pbind(
           \instrument, \sine,
           \dur, 0.5,
           \midinote, Prand([60, 67, 72]),
           \amp, Pseq([0.1, 0.2], inf),
     ).play;
     )
    

    For the following questions, state whether the Events generated could come from either Pbind 1, Pbind 2, both or neither. The use of … indicates at least one or more Event generated before/after the Events stated. If there is no use of … that simply means the pattern generates only those events.

    1. Event Stream #1

       ...
       ( 'instrument': sine, 'dur': 0.5, 'amp': 0.1, 'midinote': 60 )
       ( 'instrument': sine, 'dur': 0.5, 'amp': 0.2, 'midinote': 67 )
       ( 'instrument': sine, 'dur': 0.5, 'amp': 0.1, 'midinote': 72 )
       ...
      
    2. Event Stream #2

       ...
       ( 'instrument': sine, 'dur': 0.5, 'amp': 0.1, 'midinote': 67 )
       ( 'instrument': sine, 'dur': 0.5, 'amp': 0.2, 'midinote': 72 )
       ...
      
    3. Event Stream #3

       ( 'instrument': sine, 'dur': 0.5, 'amp': 0.1, 'midinote': 60 )
      
    4. Event Stream #4

       ( 'instrument': sine, 'dur': 0.5, 'amp': 0.1, 'midinote': 67 )
      
    5. Event Stream #5

       ...
       ( 'instrument': sine, 'dur': 0.5, 'amp': 0.2, 'midinote': 72 )
       ( 'instrument': sine, 'dur': 0.5, 'amp': 0.1, 'midinote': 67 )
       ( 'instrument': sine, 'dur': 0.5, 'amp': 0.2, 'midinote': 60 )
       ...
      
    6. Event Stream #6

       ( 'instrument': sine, 'dur': 0.5, 'amp': 0.1, 'midinote': 60 )
       ( 'instrument': sine, 'dur': 0.5, 'amp': 0.2, 'midinote': 67 )
       ( 'instrument': sine, 'dur': 0.5, 'amp': 0.1, 'midinote': 72 )
      
    7. Event Stream #7

       ( 'instrument': sine, 'dur': 0.5, 'amp': 0.1, 'midinote': 60 )
       ( 'instrument': sine, 'dur': 0.5, 'amp': 0.2, 'midinote': 67 )
       ( 'instrument': sine, 'dur': 0.5, 'amp': 0.1, 'midinote': 72 )
       ...
      
  2. Consider the pattern below also based on the instrument above:

     (
     Pbind(
           \instrument, \sine,
           \dur, 0.5,
           \midinote, 69, // Midinote 69 has a frequency of 440
           \freq, 100,
     ).play;
     )
    

    In the Pbind above, what frequency is played, 100Hz or 440Hz? State why and explain your reasoning. Does it matter if ordering of the keys \midinote and \freq are reversed?

For questions related to writing patterns, please see the lab on patterns. That is of course fair game for the midterm.

Digital World

  1. Explain the difference between a bandlimited and a non-bandlimited oscillator. Give an example in SuperCollider of each.

  2. Consider the wavetable [0.5, 0.25, -0.5, 0.1].

    1. What are the first four samples generated using this wavetable with a step size of 2?
    2. What are the first four samples generated using this wavetable with a step size of 0.5 and linear interpolation?
  3. For any wavetable, what is the relationship between the frequency produced with a step size of $s$ versus a step size of $s/2$?

Modulation

  1. Will amplitude modulation always alias? Explain.

  2. State the frequencies, amplitudes and phases produced by the following equation $\sin(20\pi t + \pi)\cos(10\pi t)$. What kind of modulation is this?

  3. Write a SynthDef that will produce frequencies of 100, 200, 300, etc. using FM modulation.

Delays and Filters

  1. Consider the signal $x[n] = [0.5, 0.25, -0.5, 0.1]$.

    1. What is $y[n] = x[n - 1] + x[n - 2]$?
    2. What is $y[n] = y[n - 1] + x[n - 1]$?
    3. What is $y[n] = x[n - 0.5]$ using linear interpolation?
  2. A moog synthesizer uses a resonant lowpass filter in its signal chain. What does adjusting the cutoff frequency do to the filter? Does it change the pitch? How does lowering the cutoff frequency affect the sound produced?

Reverb and Dynamics

I will only ask you about high-level conceptual questions from these two topics.

  1. Explain the importance of allpass filters in designing algorithmic reverberation. What properties of allpass filters make them suitable for reverb design?

  2. Explain the relationship between duration and loudness.

Solutions

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

lab_midterm_review_solns.pdf
lab_midterm_review_solns.scd