How to: Binaural Mixdown

Overview

True binaural recording uses stereo mics pointed outwards from inside your ears to capture as closely as possible the exact sound pressure waves entering your ear canals. The binaural technique captures filter (transfer function) differences caused by body parts shadowing and reflecting sounds arriving from various directions: the ear flaps (pinnae), head, shoulders, etc. Played back over headphones or earbuds,binaural preserves the IID and ITD cues which are basic to sound localization.

In this part of the assignment, we'll use four channels of sound (giving you a much wider plane of possible locations for your sound sources - essentially, two in front of your listener and two behind, as in the quad speaker setups at CCRMA) and process those quad signals into a stereo binaural file for posting to the homework factory.

Testing the Quad Stations

Before you jump into the world of 4-channel sound system, you'll need to have a channel test tool for sanity's sake, and equipment that has more than two output channels. Its recommended that you find time to use the CCRMA stations, as they are setup to handle multichannel, while your laptop is likely only setup for two. NOTE: If you are 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 this hassle of downloading and setting up additional softwares, please use one of the CCRMA stations with the quad system.

In this section, we set up a quick test to make sure we're hearing all four channels. At a quad station with a 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 with a Tascam quad soundcard and you are listening via headphones, 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 DacBeeps.ck in miniAudicle. In miniAudicle preferences, set output channels to 4.

Preferences > Audio > Output Channels > 4

Or if you are executing chuck from the command line use

chuck --channels:4 DacBeeps.ck

Add the shred and adjust speaker levels for reasonable balance. You should get one beep for speaker 1, two beeps for speaker 2, etc. up to four. When your'e hearing that, congratulations! You are now working in a world of multichannel.

Working in Multichannel

You can now send sounds not only from left to right and from right to left, but pan from behind your left shoulder to in front of your left shoulder, or diagonally across your body. (Again, if you're using the quad stations, you'll be able to experience this spatialization fully; if you are using the house heapdhones, and sending sound from channel 1 to channel 3, the sound won't pan at all because they will be sent to the same headphone.) Conceptualize at least one part of your composition such that you're taking advantage of the four possible audio outs. You can address each of these channels by using:

dac.chan(0)
dac.chan(1)
dac.chan(2)
dac.chan(3)

Note: A good way to pan in ChucK is to shred the DBAP4.ck file and pass through a portion of a wav file that you would like to pan in 4 channel space with this file: DBAP4_ex.ck, in which the third to last line, p.setPosition(Math.sin(t),0) can be changed to p.setPosition(Math.sin(t),Math.cos(t)) to send your sound in a circle around all four speakers (for example).

Preparing for Binaural Mixdown

In the next section, we will be using code that converts four mono .wav files to two stereo files by mixing them down to binaural. So, your radio play needs to be exported into four .wav files. Modify the "write to a file" code from previous assignments to output to four different .wav files. i.e. make four of these WvOut instances with a naming convention of 'chan0','chan1', etc.:

dac.chan(0) => WvOut chan0 => blackhole;
me.Sourcedir() + "/chan0.wav" => string _capture0;
_capture0 => chan0.wavFilename;

Follow that code at the end of the file with the following for each WvOut object:

chan0.closeFile();

Stereo Conversion via Binaural

This section details the steps necessary to take your four mono .wav files and mix them down to stereo.

  1. Download Binaural4.ck, binauralFeed.ck, and stereoRecorder.ck.
    • Once you add Binaural4.ck as a shred, you do not need to create any more instances of it. It works as a converter continously handling all the binaural processing for you.
    • Send 4 mono .wav files channels to Binaural4.ck with binauralFeed.ck whenever you want to listen to the converted result. Note that you can shred (add/remove, "+"/"-") binauralFeed.ck repeatedly, but you can only shred Binaural4.ck once, else the miniAudicle's console will complain that "class/type 'Binaural' is already defined in namespace 'global'", and you have to stop / restart the virtual machine. In this way of working, you will use a version of binauralFeed.ck to "binaural-ify" the four mono .wav files from your composition.
    • To get a saved wavefile, modify the path names and desired .wav name in stereoRecorder.ck, and shred this recorder directly before shredding binauralFeed.ck. Note also that you must specify in stereoRecorder.ck, how long this shred should live. So, change this number to be approximately the length of your radio play, plus a little extra!
  2. IMPORTANT: You need to download and extract impulse responses (8 wave files, compressed), and move the "ir" folder to the same directory with Binaural4.ck source code! Alternatively, for a different sounding room you could use a set of impulse responses taken from the CCRMA stage. If you use it, be sure to edit all instances of "ballroom" to be "stage" in the Binaural4.ck file.
  3. Change the file paths in binauralFeed.ck so that they point to your four mono .wav files. Shred Binaural4.ck and then shred binauralFeed.ck to hear them come out of 4 “psuedo speakers” in your headphones.