Homework 1: Data Sonification

due on 15-Oct in the Homework Factory


Create a sound file which sonifies a time series you've chosen to listen to. Your data source can be anything, feel free to scout online for datasets. Post your work in the same manner as HW0 and include a sound file (.wav, 48 kHz), code (your modified Chuck script) and a text description of the dataset.

Before you start

These resources will help get you going:


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.

Here are chuck files to get you started:

m220a-DataReader.ck defines the class DataReader, which (optionally) handles reading in and sonifying a data file passed to it as the first parameter (if any).

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

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

reads in and directly sonifies the dry white wine sales data file provided to it in the first parameter. Both files would need to be in the same directory from which chuck is being run.

Alternatively, we can shred two chuck files, where the first chuck file m220a-DataReader.ck is only used to define the DataReader class and the second chuck file does the sonification. The second file will handle specifying which data file and then opening it. In the following example, the second chuck file refers internally to the same data file as above and plays it but with smoothed envelopes.

Important: to use this file m220a-Player.ck you will need to modify the dataDir variable to point to the directory where you've downloaded the data files on your computer.

chuck m220a-DataReader.ck m220a-Player.ck

To say it in different words, 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 defining the classes and methods that handle the reading in of data files 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.

m220a-duo.ck demonstrates how to play two data files at the same time but on different audio channels.

Important: like with m220a-Player.ck above, to use m220a-duo.ck you need to modify the dataDir variable to point to the directory where you've downloaded the data files on your computer.


For convenience, while developing your own versions of the homework, you'll want to use the miniAudicle application. (Editing, testing, running can either be done in miniAudicle, or via a text editor with chuck run in the terminal, as described above.) Always first define the public class called DataReader by opening and shredding m220a-DataReader.ck. Investigate m220a-Player.ck and create your own version.

Questions for the reader (please answer these in the .html file you will turn in or a descriptive.txt file the .html file links to): (1) why are the values for gain squared, and (2) why use MIDI keynums for the freq values? What happens if they're mapped linearly, instead? And (3) what happens if the 100 ms update rate is increased or decreased significantly?

... gain(Math.pow(w, 2.0));
... freq(Std.mtof(80.0 + w*20.0));
100::ms => now;

Use your imagination to devise some music in which the performer is data. Sound production can be any sound generator available in chuck (SawOsc sawtooth wave generator, Clarinet physical model, etc.). Please begin to experiment with piping the sound through reverb and/or effects (the example above uses the NRev reverberator).

Submit the finished study in .wav format. The .wav file editor, Audacity, can be used to record, trim, mix and export your final version. When using miniAudicle as a client to qjackctl, miniAudicle's "ChucK" output can be selected directly as the sound source input in Audacity.

Or you can simply write a sound file directly from chuck by including the following two lines at the beginning of your chuck script. The output is a stereo sound file. Choose a suitable directory and filename.

dac => WvOut2 writer => blackhole;