
Hi all, I'm trying to use the LiSa looper function in ChucK using a MIDI pad. I've got a handle on using to loop once tapping a midi pad (like using a loop pedal) but I can't figure out how to 'overdub' on the same sample time? I am currently using a lisacontainer in my MID set up. Code is below. //MIDI //integer file tracker public class Master { // declare a static Envelope reference called 'out' static Envelope @ out; } // Master.out is how we now refer to our envelope. but we need to initialise it: new Envelope @=> Master.out; //declare env out Master.out => dac; //lisa setup time startTime; //for remembering when recording started Event lisaPush, lisaStopRec; //declare variables int filetracker[2][8]; 0 => int toggle36; int toggle[2][8]; for(0=>int x; x++; x<8) { 0 => toggle[0][x]; 0 => toggle[1][x]; } MidiIn midi; MidiMsg Midimsg; //MIDI port 0 => int midiport; //open port if ( !midi.open(midiport) ) { <<< "error: did not open port" >>>; me.exit(); } <<< " MIDI port open " >>>; spork ~ lisaContainer(); //loop while (true) { midi => now; while ( midi.recv(Midimsg) ) { <<< Midimsg.data1, Midimsg.data2, Midimsg.data3 >>>; //assign button numbers on and off and code if( Midimsg.data2 == 36 && Midimsg.data1 ==144 ) { MachAdd(1, 2, "Lisa Loop"); } if( Midimsg.data2 == 37 && Midimsg.data1 ==144 ) { lisaPush.broadcast(); } if( Midimsg.data2 == 37 && Midimsg.data1 ==128 ) { lisaStopRec.broadcast(); } if( Midimsg.data2 == 38 && Midimsg.data1 ==144 ) { MachAdd(0, 2, "Lisa Continuous loop2"); } if( Midimsg.data2 == 39 && Midimsg.data1 ==144 ) { MachAdd(0, 3, "Lisa Loop2"); } if( Midimsg.data2 == 40 && Midimsg.data1 ==144 ) { MachAdd(0, 5,"Lisa Continuous loop2"); } if( Midimsg.data2 == 41 && Midimsg.data1 ==144 ) { MachAdd(1, 3, "Lisa1"); } if( Midimsg.data2 == 42 && Midimsg.data1 ==144 ) { MachAdd(0, 0, "gverb"); } if( Midimsg.data2 == 43 && Midimsg.data1 ==144 ) { MachAdd(0, 1, "Lisa2"); } if( Midimsg.data2 == 44 && Midimsg.data1 == 144 ) { MachAdd(1,0,"expdelay"); } if( Midimsg.data2 == 45 && Midimsg.data1 ==144 ) { MachAdd(1, 0, "spectacle"); } if( Midimsg.data2 == 46 && Midimsg.data1 ==144 ) { MachAdd(1, 1, "PRINCETON/Lisa Delay"); } if( Midimsg.data2 == 47 && Midimsg.data1 ==144 ) { MachAdd(1, 4, "PRINCETON/Lisa Granualize"); } if( Midimsg.data2 == 48 && Midimsg.data1 ==144 ) { MachAdd(1, 6,"PRINCETON/low loop short ramp"); } if( Midimsg.data2 == 49 && Midimsg.data1 ==144 ) { MachAdd(0, 6,"PRINCETON/Low Loop drone stuff"); } if (Midimsg.data2 == 51 &&Midimsg.data1 ==144) { // fade up the MasterOut envelope: Master.out.keyOn(); 10::second => Master.out.duration; } if (Midimsg.data2 == 50 &&Midimsg.data1 ==144) { // fade up the MasterOut envelope: Master.out.keyOff(); } } } fun void MachAdd(int a, int b, string theFile) { if(toggle[a][b] == 0) { <<< "Open", theFile >>>; Machine.add( me.dir()+theFile ) => filetracker[a][b]; 1 => toggle[a][b]; } else if (toggle[a][b] == 1) { Machine.remove(filetracker[a][b]); 0 =>toggle[a][b]; } } fun void lisaContainer () { while(true) { lisaPush => now; // wait for LiSa's MIDI button to be pushed spork ~ lisaLooper(); // spork the looper lisaPush => now; // wait for Lisa's stop button to be pushed } } fun void lisaLooper() { // declare LiSa locally here rather than globally so that when "me.exit();" occurs at the end of this function, this LiSa instance is totally forgotten by the machine adc => LiSa looper =>Dyno safe => Gain g => dac; //simple patch 1.2 => g.gain; 20::second => looper.duration; //allocate memory <<< "LiSa recording", "" >>>; 0::ms => looper.recPos; 1 => looper.record; now => startTime; //remember when recording started lisaStopRec => now; // wait for LiSa's button to be pushed to stop the recording <<< "LiSa stopping recording, starting to play loop", "" >>>; 0 => looper.record; 0::ms => looper.playPos; 1 => looper.play; now - startTime => looper.loopEnd; //calculate looplength lisaPush => now; // wait for LiSa's stop button to be pushed, then exit this function, wiping the slate clean <<< "Stopping LiSa playing, exiting this instance of LiSa","">>>; me.exit(); } Dr. Matthew James Noone Sarode Artist & Irish Research Council Postdoctoral Fellow Irish World Academy of Music and Dance University of Limerick