Difference between revisions of "Njb/MUS220a/FinalProject"

From CCRMA Wiki
Jump to: navigation, search
('''ChucK Files''')
Line 75: Line 75:
     1) Start ChucK
     1) Start ChucK
    2) Edit Preferences and select the running folder to be where ever the code is stored on the compute
     2) Open Orkestra.ck, Ork.ck, Who-ra.ck, and Update.ck
     2) Open Orkestra.ck, Ork.ck, Who-ra.ck, and Update.ck
     3) Add Shred Orkestra.ck
     3) Add Shred Orkestra.ck
Line 83: Line 84:
     8) Add Shred Who-ra.ck
     8) Add Shred Who-ra.ck
     9) Assemble Orkestra ...and concur the world
     9) Assemble Orkestra ...and concur the world
[http://ccrma.stanford.edu/~njb/220a/final_project/code_and_audio.zip Chuck/Audio Files (zip)]

Revision as of 19:36, 7 December 2007

Ch-Ork-Estra: Strongly-timed, Concurrent, and On-the-fly Orkestra


To implement a dynamically controllable set of ChucK programs for the purpose of live performance, synchronization, and orchestration of previously recorded short duration loop-able audio files. As an example of performance, human grunting sounds recorded from the home-brew microphone are used to create images of the underworld in the CCRMA 16-channel Listening Room. The grunting sounds of the audio files paint a clear image of orks marching around a desolate land working on medieval devices (similar to many scenes from the Lord of the Rings).


Thirty individual grunting sounds (Grunt.wav) (10 short, 10 medium, and 10 long) were recorded into Audacity as a single stream. The files were then cut up into isolated events and saved with a numerical naming convection. Three folders were created to organize and store each class of recorded sounds (using folder names 1,2,3) as well. The naming convection allows for easy manipulation and access within the ChucK programing language.

Once all of the files are ready, the SndBuf command in ChucK can be used to playback the files. For variation, a random number generator can be used to pick a random file among the folders and set a random playback rate (slower for lower grunts, faster for higher grunts). The playback of a single sample can then be looped and added together with other samples, all in a synchronized fashion (similar to moe.ck, larry.ck, and curly.ck files found in the ChucK distribution).

Synchronization in ChucK:

   //Define time duration
   .5::second => dur T;
   T - (now % T) => now;

For performance, quantization synchronization is only allowed on certain voices while allow others to simply loop periodically (not strongly synchronized or in phase). By varying the synchronization quantization, playback rates, tempo, volume, panning, and the number of simultaneous sample playback very interesting/exciting sounds result.

To paint the image of an underworld filled with Orks marching around, the 16-channels of discrete audio must be used intelligently with dynamic panning abilities (specific to CCRMA Listening Room). Within the listening space, four channels are spatially spaced below the listener, four above, and eight all around. The lower four channels are used for larger sounding (slower play rate) samples as in a dungeon, where as the upper four channels are used for the smaller (faster play rate) sounding samples. The middle eight channels are used for mid-range sounds. Occasionally, overlap occurs for the specific reason of sounding like an army marching around.

To simulate marching, each looping sample playback must gradually move from one speaker to the next making a circular pattern within its respective speaker range.


To do this ideally, 16 individual gain values should be used to equal-power-pan a single sample playback. Unfortunately, this requires an array of 16 gain unit-generators for a single sample playback, limiting the overall number of voices allowed in ChucK. To avoid this issue and take advantage of the simple panning requirement of moving in a circle, only two gain values can be used with a dynamically updating assignment to which channel the output audio feeds into using the chuck and unchuck commands. This allows the voices to freely move around in a circle using only two gain coefficients and reduces the panning problem to an simple equal-power panning for two channels.

Equal-power panning function in ChucK:

  fun void stereopan(Gain g[],float panvalue)
  {  //panvalue can be between [-1,1]
     panvalue/2.0+.5 => float left;
     1.0-left => float right;
     Math.sqrt(left*left + right*right) => float power;
     right/power => g[0].gain;
     left/power => g[1].gain;

ChucK Files

Ork.ck The main controllable instance of a single Ork. To add multiple Orks, simply add multiple shreds of the ChucK file.

Orkestra.ck The Orkestra class that allows global parameters and real-time update control. You must add this as a shred first before any Orks are sporked!

Who-ra.ck A unison chant that gets sent to all 16 output speaker channels

Update.ck Gives examples of what you can do to update the Orkestra in real-time. Simply comment out one of the desired modifications and add Shred. For example, it is possible to increase, decrease, or mute of volume level on a channel by channel basis.


An Orkestra class is used to initialize input control to each instance of an Ork. The Orkestra class can be modified to allow large numbers of controllable channels by increasing the array sizes for each parameter. Currently five channels of globally controllable Orks are used. In addition to the globally controllable parameters, each instance of an Ork gets assigned a channel number, the pitch range, a sync/no sync quantization. From there, an update control can be used to update the global parameters in real-time. The controllable global parameters and examples of what can be done are shown below.

   Master Volume
        [.1] soft
        [1]  loud
   Panning Rate
        [.1] slower pan
        [2]  faster pan (going from one speaker to the next each grunt)
   Panning Direction (Clockwise or Counter Clockwise)
        [-1] Clockwise
        [1]  Counterclockwise 
   Elevation (any two speaker channels to repeat between.  
        [0,3] low elevation
        [4,11] middle elevation
        [12,15] high elevation
        [0,15] marches up a mountain from low to high or high to low depending on direction


To get an Orkestra performance up and running do the following:

   1) Start ChucK
   2) Edit Preferences and select the running folder to be where ever the code is stored on the compute
   2) Open Orkestra.ck, Ork.ck, Who-ra.ck, and Update.ck
   3) Add Shred Orkestra.ck
   4) Add Shred Ork.ck
   5) Listen to the looping pattern.
   6) Add addition Ork.ck shreds on top with varying rhythm
   7) Add Shred Update if needed to manipulate the parameters
   8) Add Shred Who-ra.ck
   9) Assemble Orkestra ...and concur the world


Chuck/Audio Files (zip)