How to: Binaural Mixdown


Before you jump into the world of 4-channel sound system, you'll need to have a channel test tool for sanity's sake. The “Slate” program consists of your voice saying. “front left, front right, rear left, rear right” or something to that effect. It's for testing the 4-channel stations (each time you start working).

NOTE: If you're considering using your laptop for your homework, see wiki for instructions using the quad system, which includes a link to download drivers if you're using your laptop. Laptops will also need audacity, qjackctl, sox, and miniAudicle. If you do not want to go through the hassle of downloading and setting up additional softwares, please use one of the CCRMA stations with the Quad system. Additionally, if using your laptop, you will also need to modify some of the file paths used in the provided chuck files. For more about laptop requirements, see below.

Testing the Quad Stations

At a quad station with house linux computer (or laptop where you hear all four channels, even if they are via headphones) launch jack and prepare its setup to be connected to the appropriate soundcard. You can launch the control panel for Jack with the following command in terminal:

qjackctl &

NOTE: If you're working at a house linux computer via headphones on a Delta soundcard, you will still hear all four channels but they will be "hard-panned" left and right.

Hit start. You're good if the GUI starts showing a changing computer status (otherwise, you will get a complaint popup). Sound is now live.

Download and open in miniAudicle. In miniAudicle preferences, set output channels to 4.

Preferences > Audio > Output Channels > 4

Adjust speaker levels for reasonable balance. If this is your first miniAudicle experience, you need to “start virtual machine” and then hit “add shred” ('+' icon). If a channel is missing, that will need to be fixed before proceeding. Quit miniAudicle.

Recording Slates.wav

Create a directory (new folder) for your work and plug in your mic into the first channel of the soundcard. Use audacity to record your voice as you name each loudspeaker in the quad setup. Check that audacity's preferences are set so that it is connecting its audio via jack and recording to a mono file. Remember to set your record quality to 48kHz / 16bit. Adjust the mic level knob to see good levels when you speak. Check for a strong level in the file but take care to avoid clipping. Save it as “Slates.wav” by exporting it into your new directory. Check that it's sounding good.

NOTE: Please do not use a built-in laptop microphone or built-in laptop audio input.


Two preliminary versions in ChucK will get you to the final version of the program:

  1. Play slates.wav from chuck in mono: Just enter this into the miniAudicle editor and shred it ("+" on the miniAudicle editing window)
    SndBuf snd0 => dac.chan(0); // connect a sndBuf to 1st speaker
    "slates.wav" =>; // load sound (modify path for your system)
    1::day => now; // stall for 1 day
    Save as a file called
  2. Now play slates.wav from chuck in quad, all four channels together: Extend the above to 4 SndBuf's each with a different name, each going to a different output channel; e.g., the second would be
    // copy first 2 lines from above code-block to have 1st speaker as channel 0
    SndBuf snd1 => dac.chan(1); // 2nd speaker as channel 1
    "slates.wav" =>; // read the same file for channel 1
    // repeat for 3rd and 4th speakers
    1::day => now; // stall for 1 day
    You can overwrite with this new code.
  3. And now, play slates.wav from chuck in quad, each channel announced separately, by doing the following:
    • After the beginning declarations, mute each Sndbuf, with e.g.,
      snd0.gain(0.0); // mute by reducing gain to 0.0
    • Then make an infinite pattern by replacing the above line for stalling for 1 day with this loop:
      // loop the following block
      while (true) {
        snd0.gain(1.0); // unmute snd0 by setting gain to 1.0
        snd0.pos(28000); // play from position 28000 samples
        63750::samp => now; // stall for length of utterance
        snd0.gain(0.0); // mute snd0
        500::ms => now; // stall for half second
        // next channels...
      HINT: These positions and lengths in samples can be measured directly in Audacity by right-clicking on the time measures that show at the bottom of the app. Set the format to read in samples.
  4. Your finished slates will look something like this:

Binaural Conversion

  1. Download and open it in miniAudicle.
  2. IMPORTANT: You need to download and extract impulse responses (8 wave files, compressed), and move the "ir" folder to the same directory with source code! Alternatively, for a different sounding room you could use an impulse response taken from the CCRMA stage. If you use it, be sure to change the instances of ballroom to stage in the file.
  3. Make a copy of, naming it, and replace all dac.chan(n) references with the input of binaural mixer. (Binaural4.input[n], where n = channel number) NOTE: the syntax difference between () and [] above. Once you add the file into VM, you do not need to create instances of it. It works as a singletone that handles all the binaural processing for you.
    // connecting sound sources to input of binaural mixer
    mySndBuf0 => Binaural4.input[0];
    mySndBuf1 => Binaural4.input[1];
    mySndBuf2 => Binaural4.input[2];
    mySndBuf3 => Binaural4.input[3];
  4. Shred and then shred to hear it come out of 4 “psuedo speakers” in your headphones.
    Note that you can shred (add/remove, "+"/"-") repeatedly, but you can only shred once, else the miniAudicle's console will complain that "class/type 'Binaural' is already defined in namespace 'global'", and you have to restart miniAudicle.
  5. After completing the binaural slates, you are ready to substitute your individual mono sound files for the slates.wav file. After shredding the file, a file such as will play your four sound files in binaural.

Stereo Rendering

  1. Download for recording realtime audio stream from miniAudicle/ChucK. This code allows you to record the sound from dac.chan(0) and dac.chan(1) into a stereo sound file. Before adding this shred to the virtual machine, you need to specify a destination path for sound files. (see this line) For the final step, setting absolute path starts with '/' is strongly recommended. See the example below:
    // MODIFY THIS: files will be written into current directory
    "/doc/220a/" => string myPath;
  2. While running your code and the binaural converter, add shred of to capture the two headphone(main) channels to the stereo file. Currently, will remove itself automatically after 10 seconds. If you try to manually remove shred before that time is up, recordings will not be made. You can modify this default length of 10 seconds by changing the default duration on this line.