This page was last modified on February 14, 2001.

Christopher Dobrian

Music 147 Research Page

Christopher Dobrian


This page contains links to supporting materials and instructive examples for students in Music 147 (ICS 180, ECE 198), Computer Audio: Musical Applications of Digital Signal Processing.


Articles

A complete listing of Christopher Dobrian's publications on computer music can be found online.

The publications most pertinent to this course are listed below.


Example Programs

Example Programs in Max/MSP

Here are a few simple MSP patches that demonstrate basic ideas or techniques.

Playing a sound from a CD into MSP; recording MSP signal into an AIFF file: playcd~

Playing a soundfile from disk as an MSP signal: playsf~

Draw a 513-sample waveform to use in a cycle~ object: draw513samples

Try out the first 513 samples of any soundfile as a waveform in a cycle~ object (also includes an example of vibrato via simple frequency modulation): waveformtest

How to play specific pitches from a keyboard (kslider) or by stepping through a lookup table: pitchsequence

How to play random chunks of an audio clip in rhythm: samplechunks

Notes on the "samplechunks" example:

In order for this patch to work, you must load in an AIFF (or WAVE) sound using "read", or an MP3 sound using "import". The buffer~ has 5 seconds of stereo memory allocated.

A groove~ object accesses the buffer~. At regular time intervals, a metro object triggers a random choice of starting point for groove~. Note that some care has been taken to limit the range of random starting points--based on the length of the buffer~ and the rate of the metro--in an attmpt to ensure that groove~ is not asked to read beyond the end of the buffer~.

The playback speed of groove~ is determined by the base playback rate, plus the depth (amplitude) of the modulating oscillator. With initial the default values, the base playback rate of 1.0 fluctuates by + or - 0.1, so the playback rate varies from 1.1 to 0.9 of the original rate. (Try varying these values, as well as the modulation rate, to achieve different effects.)

There are two volume (amplitude) controls. The Master Volume simply allows global control of the output loudness. Also, every time metro chooses a new chunk of sound (a new starting point in groove~, it also triggers a quick fade-in and fade-out (a triangular window on the chunk of sound) by the line~ object.

The use of "select 0 1" looks for the numbers 0 and 1 from the toggle switch, and uses those numbers to trigger "stop" and "startwindow" messages. This shows how "select" can be used to test for different occurrences, and provoke any desired result. In this case, the toggle can now be used to start audio in only this window.

A patch demonstrating the use of MIDI for realtime control of MSP audio: realtime.control

Notes on the "realtime.control" example:

In order for this patch to work, you will also need to download five additional files that is uses as subpatches, and name them correctly (without the .txt extension). Those files are "PC-1600x", "bendfreq", "dBtoA", "mix~", and "pan~", downloadable below.

This patch works in class because we have an Alesis QS7.1 keyboard and a Peavey PC-1600x faderbox sending MIDI to the computer. You can use the faders in the "PC-1600x" subpatch and/or drag on the number boxes in the main "realtime.control" patch to simulate incoming MIDI information.

The point of this patch is to show the use of realtime control of audio parameters, using the user interface objects of Max and/or external physical interfaces via MIDI. The numbers from those controllers inevitably need to be mapped mathematically into the appropriate range for whatever you're trying to accomplish in MSP. So this patch shows various ways of mapping: linear, exponential, using a lookup table (in this case by selecting the phase offset within a cosine wave in cycle~), and a specialized case for translating MIDI pitchbend data.

The sound sources are white noise and a sinusoidal tone. The mix between the two sources is controlled in a straight line (in the mix~ subpatch) with a balance control signal ranging from 0 (all noise) to 1 (all sinusoidal tone). The speaker placement of the sound can be adjusted with equal-power intensity panning (in the pan~ subpatch) with an input control signal from 0 (left) to 1 (right). The master volume can be adjusted with a MIDI value from 0 to 127, which is reinterpreted as a decibel value from -127dB (minimum) to 0dB (maximum), which is then translated into absolute peak amplitude (in the dBtoA subpatch) and used as the right operand in a *~ object for each output channel. The frequency of the sinusoidal tone is determined by a combination of MIDI key number and MIDI pitchbend. This is done inside the bendfreq subpatch. The base frequency is derived by the mtof Max object. Although you don't see it because it's inside the Max object mtof, the mapping formula is basically 440.*2.^((x-69)/12.), where x is the MIDI key number, and MIDI key number 69 is A=440Hz, which is multiplied by 2 to the d/12 power, with d being the difference in semitones that x is away from A. The MIDI pitchbend data is then used to derive the correct factor by which to multiply the base frequency in order to get a bend of + or - 2 semitones. The bend factor is calculated in a similar way to the base frequency, but needs to be done slightly differently for upward bend and downward bend. That's because in MIDI the value 64 is used to mean no bend, so that leaves 64 values to express downward bend (0 thru 63) but only 63 values to express upward bend (65 thru 127). The amount that the bend varies from the central value of 64 is used to calculate what portion of 2 semitones the bend should be, and this factor is then multiplied by the base frequency and sent out to be used as input to the cycle~ object. (The pitchbend calculations are probably explained more clearly in the MSP Tutorial chapter called "MIDI synthesizer".)

A patch emulating the faders of a Peavey PC-1600x MIDI faderbox: PC-1600x

A patch for deriving frequency from MIDI pitch and pitchbend data: bendfreq

A patch for converting decibels to amplitude: dBtoA

A patch for doing a linear balance mix of two audio signals: mix~

A patch for equal-power intensity panning of an audio signal between two speakers: pan~

Example Programs in C

notch~.c, source code (with comments) for an MSP object that implements a notch (band reject) filter.


Sound Files

MP3

No MP3 sound files are posted yet.

AIFF

No AIFF sound files are posted yet.


References

Bibliography of Other Relevant Publications

Useful Audio Software

Other Online Resources


Examples from Previous Year's Course

The professor's research page from this course as it was taught in Winter 2001 contains examples of basic audio programming principles demonstrated in the "Csound" computer music programming language.


This page is for Music 147 (ICS 180, ECE 198), Computer Audio: Musical Applications of Digital Signal Processing, offered Winter 2002 at UCI.