void kick( float time, float dur, float amp ) { mainOut.playNote( time, dur, new Kick(amp) ); } void vox( float time, float dur, float glitchLen ) { mainOut.playNote( time, dur, new RepeatTrigger( glitchLen ) ); } class Kick implements Instrument { Line freqSweep; Line ampSweep; Oscil osc; Kick( float amp ) { osc = new Oscil( 60.f, 1.f, Waves.SINE ); ampSweep = new Line( 1.f, amp, 0.f ); freqSweep = new Line( 1.f, 120.f, 10.f ); } void noteOn( float dur ) { freqSweep.setLineTime( dur ); ampSweep.setLineTime( dur ); freqSweep.patch( osc.frequency ); ampSweep.patch( osc.amplitude ); ampSweep.activate(); freqSweep.activate(); osc.patch( mainOut ); } void noteOff() { osc.unpatch( mainOut ); } } class SampleCue implements Instrument { int cueTo; int cueEnd; Line cueLine; SampleCue( int to, int end ) { cueTo = to; cueEnd = end; } void noteOn( float dur ) { hydra.cue( cueTo ); hydra.setLoopPoints( cueTo, cueEnd ); loopAmpSweep.setLineTime( dur ); loopAmpSweep.activate(); } void noteOff() { } } class SequenceBegin implements Instrument { void noteOn( float dur ) { loopAmp.patch( mainOut ); if ( !MuteVox ) { heapRate.patch( mainOut ); } } void noteOff() { hydra.pause(); heap.pause(); loopAmp.unpatch( mainOut ); heapRate.unpatch( mainOut ); } } class SequenceEnd implements Instrument { void noteOn( float dur ) { gui.controller("Generate").show(); gui.controller("Generate").setMousePressed( false ); } void noteOff() { } } class RepeatTrigger implements Instrument { float m_sampleLength; RepeatTrigger( float sampleLength ) { m_sampleLength = sampleLength; } void noteOn( float dur ) { heapGlitch.setSampleLength( heapTempo, m_sampleLength ); heapGlitch.activate(); } void noteOff() { heapGlitch.deactivate(); } }