// Music 220a - Final Project - Romain Michon // 12/10/2012 // Main chuck file instantiate the different physical models and control them // feraillophone through the plate physical model adc.chan(0) => nlfFdnRev nlfr => spat Spatia => dac; // karplus strong algorithm adc.chan(0) => ksRom violin => Spatia; // wavefile through the plate physical model SndBuf ave => Gain aveGain => nlfr; // microphone through the plate physical model adc.chan(1) => Gain mic => nlfr; // simple LFO SinOsc LFO => blackhole; //******************************************************* // DEFAULT VALUES AND PRESETS //******************************************************* // default parameters for the string physical model 0.0 => violin.gain; 0.5 => violin.brightness; 0.72 => violin.decaytime; 1056 => violin.fBandwidth; 164 => violin.freq; 1000 => violin.window; 102 => violin.xfade; // default values for the other unit generators me.sourceDir() + "/ave.wav" => ave.read; 0.0 => ave.play; 0.0 => Spatia.angle; 0.0 => Spatia.distance; 0.0 => mic.gain; 0.0 => aveGain.gain; 0.01 => LFO.freq; 0.01 => nlfr.inputGain; 15.0 => nlfr.outputLevel; 0 => int cnti; 0 => int cnti1; 0.0 => float rotate; // presets for the physical model [[2123.0, 5245.0, 1.6, 4.2, 6.8, 2.1, 0.1, 0.999, 10.0, 0.2], [2123.0, 5245.0, 2.6, 2.6, 2.6, 0.1, 0.1, -0.999, 10.0, 0.2], [2123.0, 5245.0, 2.6, 2.6, 2.6, 0.1, 9.5, 0.999, 10.0, 0.2], [2123.0, 5245.0, 2.6, 2.6, 2.6, 2.2, 0.1, 0.999, 10.0, 0.2], [2123.0, 5245.0, 7.8, 4.2, 0.1, 1.0, 0.1, 0.999, 10.0, 0.2], [2123.0, 5245.0, 2.6, 2.6, 2.6, 0.1, 0.1, 0.0, 10.0, 0.2], [2123.0, 5245.0, 2.6, 2.6, 2.6, 0.1, 0.1, 0.999, 10.0, 0.2], [2123.0, 5245.0, 2.6, 2.6, 2.6, 6.9, 9.5, 0.999, 10.0, 0.2], [2123.0, 5245.0, 2.6, 2.6, 2.6, 0.5, 1.0, 0.999, 10.0, 0.2], [2123.0, 5245.0, 2.6, 2.6, 2.6, 0.1, 5.8, -0.999, 10.0, 0.2], [526.0, 3152.0, 7.7, 4.2, 0.1, 1.0, 0.1, 0.999, 10.0, 0.2]] @=> float presets[][]; //******************************************************* // OSC STUFF //******************************************************* // OSC receiver OscRecv recv; // OSC port 6449 => recv.port; recv.listen(); // list of OSC events recv.event( "/chuckEvent, i f" ) @=> OscEvent @ oe; //******************************************************* // INSTRUMENT //******************************************************* while (cnti1 < 5) { // new OSC message... oe => now; while( oe.nextMsg() ) { // get the OSC values oe.getInt() => int intOsc; oe.getFloat() => float floatOsc; // button one on the interface if (intOsc == 0){ // change the preset every time the button is pushed cnti++; cnti % 10 => int i; <<< "Instrument no",i >>>; presets[i][0] => nlfr.bandCross0; presets[i][1] => nlfr.bandCross1; presets[i][2] => nlfr.bandDecayT0; presets[i][3] => nlfr.bandDecayT1; presets[i][4] => nlfr.bandDecayT2; presets[i][5] => nlfr.minAcRayL; presets[i][6] => nlfr.maxAcRayL; presets[i][7] => nlfr.nonlinearity; 15.0 => nlfr.outputLevel; } // button two on the interface else if (intOsc == 1){ // trigger the different part of the piece every time the button is pushed cnti1++; <<< "Part no",cnti1 >>>; // init phase if (cnti1 == 1){ 0.0 => Spatia.distance; } // activate the 'violin' and desactivate the plate physical model if (cnti1 == 2){ -60.0 => nlfr.outputLevel; 0.5 => violin.gain; } // reactivate the plate physical model, trigger the wave file and rotate the sound in space else if (cnti1 == 3){ 0.0 => violin.gain; 15.0 => nlfr.outputLevel; 1.0 => Spatia.distance; 1.0 => aveGain.gain; 0.5 => mic.gain; 1.0 => ave.play; 1.0 => rotate; } // final section else if (cnti1 == 4){ 0.0 => ave.play; 0.0 => aveGain.gain; 0.0 => mic.gain; 0.0 => rotate; } } else if (intOsc == 2 && (cnti1 == 2 || cnti1 == 4)){ // control the 'violin' pitch with the distance sensor if(cnti1 == 2){ floatOsc*200+100 => violin.freq; } // control the position of sound in space, the feedback of the delay and the delay duration with the distance sensor if(cnti1 == 4){ floatOsc => Spatia.angle; (1-floatOsc)*200.0 => nlfr.echoDur; floatOsc*100.0 => nlfr.echoFeedback; } } // LFO to rotate the sound in space for section 3 if (cnti1 == 3) LFO.last()*rotate => Spatia.angle; } }