Homework 4: Physical Model Duets

due on 10/29 (Thr) 11:30am in the Homework Factory and in your /Library/220a/hw4/ directory

Overview

This lab introduces you to working with physical models in ChucK. There is no short answer portion this assignment. Your deliverable will be a .wav file of the sound of ths physical model and the code that created the .wav file. Place these files in your /Library/220a/hw4/ directory.

For the composition, compose a short musical statement (1-2 min) consisting of a 'physical model band' using instruments in ChucK. For at least part of your composition, one of the instruments' sonic parameters must be controlled by data of your choosing. "Submission" entails placing an HTML file hw4.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 (40 points)

In this lab, we will ask you to work with one of the physical models built into ChucK to create a short series of melodic notes. While this template code will be specific to the Clarinet physical model, it forms a template by which you can play other physical models.

Background: For those curious, the physical models implemented in ChucK use classes from the Synthesis Toolkit, a set of C++ classes by Perry Cook and Gary Scavonne, which have also been ported into Max/MSP Dan Trueman and Luke Dubois.

Before you begin the lab, take a moment to read and undestand the purposes of the parameters of the Clarinet class here.

Using the Clarinet instrument built in ChucK, create a sequence of clarinet tones separated by 1 second of silence as follows:

  1. A 1-second tone at pitch C4 with no vibrato and breath (roughly the amplitude control) that sounds natural to you.
  2. A 2-second tone at pitch D4 with vibrato. Design a vibrato that you think sounds natural. You will find the clarinet model has a fairly sudden threshold below which there is no oscillation and above which the vibrato is fairly strong. If breath vibrato causes the breath envelope to cross this threshold, the clarinet tone may pulse on and off. Control vibrato so that this does NOT happen.
  3. A 5-second tone at pitch E4 that has a slow crescendo. The sound should start with a noisy breathy sounding attack that barely has any pitch. Within 1 second, the pitch should be clear. The crescendo should obviously continue until at least 4 seconds. You will find the clarinet model is very sensitive to the breath envelope and there is a very narrow range of envelope values over which a crescendo takes place. You will need to determine good envelope values experimentally.
  4. The 8-second sequence (F4, G4, A4, rest, F4, G4, A4, rest) where each element has a duration of 1 second.

Reference the starter code clip_clar.ck for the functions necessary to get the sounds asked for above. You need to spork the function though, with the appropriate choices for your input parameters, to achieve the sounds above!

As in previous homeworks, export your homework as a .wav file, named LASTNAME_CLARINET.wav into your /Library/220/hw4/ subdirectory, and save the code you wrote as LASTNAME_CLARINET.ck.

Composition (✓-,✓,✓+)

Write a musical statement (~1 min) using at least two of the STK instruments in ChucK. One should be using a typically pitched instrument and another should be using a more percussive instrument. NOTE: For those interested in data sonification, check out the extra credit. (If one of your physical model instruments 'plays' data you choose, its extra credit!)

Physical Modeling Instructions

  • At least one of the instruments used must vary in some physical modeling parameter (not just pitch frequency) over the course of the piece.
  • Listen to Erocolino Ferretti's "Pipe and Drum" (1963) for potential inspiration

  • Available physical models are (alpabetically): BandedWG, BlowBotl, BlowHole, Bowed, Brass, Clarinet, Flute, Mandolin, ModalBar, Saxofony, Shakers, Sitar, StifKarp. Some are more difficult to get a decent sound from than others! In miniAudicle, check out Examples > stk for useful example code. Also, chapter 7 in the ChucK book is devoted to the STK physical models for reference.

Some template code that might be of help:

  • clip_string.ck - another example of playing a plucked string model.
  • clipClass.ck - a template in which our 'clip' becomes an editable class. If you are not familiar with classes, or want to read more how there are implemented in ChucK, read Chapter 9 of the ChucK book.
  • clipClassPolyphony.ck - instances of our 'clip' playing in harmony together!

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

  • Links to all ChucK files you used and wrote in your composition.
  • A link to your .wav file.
  • A short description of how your piece and your thoughts behind your composition. If you've done the extra credit, please cite your time-series data.

Lots of Extra Credit (30 points)

Sonification Instructions

Sonification is the use of non-speech audio to convey information or perceptualize data, and has been used by many composers to add depth to their works. Here, we are asking you to sonify some aspect of your composition - either one (or both) of your physical models, or some extra sound that you want to include. The tools to read data into ChucK are provided, but you can pick whatever data you'd like to sonify.
Here are two example data files: (from the Time Series Data Library collection)

  • data-drywhite.dat
    Monthly Australia sales of dry white wine: thousands of litres. Jan 1980 – Jul 1995.
  • data-fortified.dat
    Monthly Australian sales of fortified wine: thousands of litres. Jan 1980 – Jul 1995.

These .dat files contain data in them that, for instance, could be mapped to pitch, as in, the higher the sales, the higher the pitch. Depending on your data, you might choose to map it in different ways. For example, data on the heartbeat of a runner during a run may control the overall tempo of the piece. Or, it may control the 'breathiness' of a physical model - the higher the heart rate, the more likely they are out of breath. You can be creative with this - there are no wrong choices!

Here are the ChucK files to get you started:

  • hw4-DataReader.ck - this file defines the class DataReader, which handles reading in a file and sonifying data file passed to it as the first parameter, if any. (Note: You always want to run, or 'shred', this first, so that it has been defined for use in further shreds.) Note - you do not need to change anything in this file! Its whole purpose is to just read in a .dat file, and scale the values to between 0 and 1 (which, conveniently, matches the range of many ChucK parameters). NOTE: Make sure your data is in one column, with a blank line at the end. Otherwise, this code will not work.
  • hw4-Player.ck - this is the code to edit and change in order to get the sound you want.
  • hw4-Duo.ck - demonstrates how to play both data files at the same time but on different audio channels.

Important: you need to modify the dataDir variable to have the paths point to where you've downloaded the data files on your computer.

Some Command Line Instructions (for those who want them)

In a terminal, launch chuck by providing the ChuK code file and the data filename as an argument to it. Arguments are preceded with a colon. For instance:

chuck hw4-DataReader.ck:data-drywhite.dat

reads in and sonifies the dry white wine sales data file.

Alternatively, we can shred two chuck files, where the first chuck file is hw4-DataReader.ck, and the second chuck file specifies the data file(s) to be used. In the following example, the second chuck file plays with smoothed envelopes:

chuck hw4-DataReader.ck hw4-Player.ck

In this case, no argument is needed to m220a-DataReader.ck because the data filenames are coded in the content of the second file. Since no arguments are passed to m220a-DataReader.ck, it handles only the reading in files part, while all data-to-sound mappings are defined in m220a-Player.ck. Also note the syntax: we shred multiple chuck files in the terminal by separating them with a space.