Homework 1: Additive Synthesis; Harmonic and Inharmonic Sounds

due on Oct 6th (Tue) 11:30am in the Homework Factory and your /Library/220a/hw1/ directory.

Overview

In this lab, you will answer some questions about digital audio and additive synthesis (part 1), as well as recreate the THX sound (part 2). Your deliverables will be a .txt file with your answers to the lab questions, as well as a .wav file of your THX sound and the code that created the .wav file. Place these files in your /Library/220a/hw1/ directory.

The composition is to write a short musical statement (1-2 min) consisting of some harmonic and inharmonic sounds designed using additive synthesis. "Submission" entails placing an HTML file hw1.html that links to your code and .wav file in your /Library/Web/220a/ subdirectory. Make sure that your submission is timestamped on the Homework Factory.

Lab - Part 1 (40 points)

  1. What is a digital audio sample?
    1. A short excerpt of a preexisting piece of music, reappropriated in another’s work.
    2. A number that represents the instantaneous amplitude of an audio signal usually in a series of such measurements recurring at regular, short intervals through time.
    3. A set of numbers that represent the instantaneous amplitude of each frequency for a very short time window.
    4. A waveform.

  2. What causes “clipping” in a computer-generated sound?
    1. The sound has a frequency that is outside of the range of human hearing.
    2. The sound exceeds the maximum frequency that can be expressed numerically by the computer.
    3. The sound exceeds the maximum amplitude expected by the DAC.
    4. The sound takes up too much memory.

  3. What hardware device converts the binary representation of samples used in a computer to the analog electrical signal that is sent to the loudspeaker?
    1. A “Binary to Voltage Converter” (BVC).
    2. A “Digital to Analog Converter” (DAC).
    3. A “Computer to Speaker Converter” (CSC).
    4. A “Circuit to Speaker Converter” (CTSC).

  4. Which of the following will most affect timbre while leaving pitch and loudness relatively unchanged?
    1. Phase shift by pi/2 (a quarter-cycle).
    2. Multiply amplitude by 2.
    3. Change wave from a sine wave to a sawtooth wave.
    4. Double the frequency of the wave.

  5. Of the four basic waveform parameters, in which one will a change be least audible?
    1. Frequency.
    2. Amplitude.
    3. Shape (sine, square, sawtooth).
    4. Phase.

  6. What is the best definition of a partial?
    1. An arbitrary frequency component in a spectrum.
    2. A harmonic frequency component in a spectrum.
    3. An inharmonic frequency component in a spectrum.
    4. Any frequency component in a spectrum besides the fundamental.

  7. The telephone system uses digital audio for voice; the highest frequency carried over the phone system is 3400Hz. What is the theoretical minimum sampling rate needed for this bandwidth?

  8. If we sample a 15 kHz sinusoid using a sample rate of 22050 Hz, the result will be a digitized sinusoid at a new frequency. What is this phenomenon called? What is another example of it outside of the audio domain?

Lab - Part 2: Recreating the Original Deep Note (20 points)

You will be working with the ChucK programming language in this course, with opportunities to work with the Web Audio API. ChucK and miniAudicle (the interface through which to write/test ChucK) is already installed on the Linux machines at CCRMA. Please follow this instruction to install it on your own machine, or to get instructions on how to use it on the Linux machines - Getting started with ChucK.

Please either read through the first chapter of the book Programming for Musicians and Digital Artists, which goes through the basic syntax of ChucK as well as basic control structures in programming, or check out the ChucK website for help ChucK Documentation or ChucK Unit Generators. This assignment assumes you know what the Virtual Machine is, how to run code in ChucK, a variable, the ChucK operator ( => ), basic data types (e.g. int, float, dur, time), as well as loops (e.g. for, while).

Download this PDF: hw1-thx.pdf, and follow the instructions while typing out the code. Save the resulting .wav file (as LASTNAME_THX.wav), as well as your code (LASTNAME_THX.ck) to your /Library/220a/hw1/ directory.

Composition - Harmonic or Inharmonic (✓-,✓,✓+)

Compose a brief 1-2 minute musical statement with at least four sounds total that you should build using additive synthesis. Two sounds should be harmonic and two should be inharmonic. Note the following:

  • One strategy would be to write a series of inharmonic short percussive tones and build a rhythm which plays under a selection of more sustained harmonic sounds whose pitches create a melody.
  • You can use any oscillators available in ChucK (sine, square, triangle, etc.).
  • You're encouraged to use mathematical relationships to determine frequencies. If you do, please describe them in your final writeup.

Take a look at the following two code examples. The first demonstrates how you can layer sounds in ChucK, and the second is an example patch that plugs a SinOsc into an envelope, effectively creating a stream of pulses:

  • clips_template.ck - a stripped template of how you can layer sounds.
  • clip.ck - a single example of making a series of sinewave pulses.
  • clipFTRT.ck - the example above, but also with command line instructions.

You are free to modify existing examples (above or from elsewhere), or create your own programs from scratch, or some combination thereof. If you modify existing examples however, give credit for the work that you are sampling at a header at the top of your file, which should include your name, the date the code was written, the assignment number, and what the code generally does.
The sequencing of the different audio components doesn’t need to be done in ChucK - you can layer sounds together in an audio editor, such as Audacity. (Therefore, you could simply write four small programs that output four sounds to .wav files, and then organize those sounds in Audacity into your musical statement.)

Submit to the Homework Factory an HTML file titled hw1.html that includes the following:

  • Links to all ChucK files you used and wrote.
  • A link to your wav file (not SoundCloud, Tumbler, etc. but a direct link to a file stored in your Library/Web/220a/hw1/ subdirectory).
  • A short description of your piece and your thoughts behind your synthesis.

Extra Credit (10 points)

Recreate either the THX sound or your composition using the Web Audio API.