/* * Created on Dec 3, 2004 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates * * thansk * */ package crawford_final2604; import com.softsynth.jsyn.*; /************** ** WARNING - this code automatically generated by Wire. ** The real source is probably a Wire patch. ** Do NOT edit this file unless you copy it to another directory and change the name. ** Otherwise it is likely to get clobbered the next time you ** export Java source code from Wire. ** ** */ public class LangPoocher extends SynthNote { // Declare units and ports. Filter_LowPass lowPass; ExponentialLag expLag3; ExponentialLag expLag4; public SynthInput cutoff; public SynthInput reson; public SynthDistributor realFreq; SineOscillator sinOsc; MultiplyUnit mult; TableOscillator tableOsc; SynthTable table ; double tableData[]; MultiplyUnit mult3; EnvelopePlayer envPlay; public SynthInput rate; SynthEnvelope envelope; public LangPoocher() { this( Synth.getSharedContext() ); } public LangPoocher( SynthContext synthContext ) { super( synthContext ); // Create unit generators. add( lowPass = new Filter_LowPass(synthContext) ); add( expLag3 = new ExponentialLag(synthContext) ); add( expLag4 = new ExponentialLag(synthContext) ); realFreq = new SynthDistributor( this, "realFreq" ); add( sinOsc = new SineOscillator(synthContext) ); add( mult = new MultiplyUnit(synthContext) ); add( tableOsc = new TableOscillator(synthContext) ); double [] tableData = new double[257]; for(int i = 0; i < 256; i++){ tableData[i]= Math.random() * 2 -1; } tableData[256] = tableData[0]; table = new SynthTable(tableData); tableOsc.tablePort.setTable(table); add( mult3 = new MultiplyUnit(synthContext) ); add( envPlay = new EnvelopePlayer(synthContext) ); double[] envelopeData = { 5.0, 1.0, 0.1, 0.8, 0.1, 0.799, 5.0, 0.0, 0.01, 0.0, }; envelope = new SynthEnvelope( synthContext, envelopeData ); envelopeData = null; envelope.setSustainLoop( 1, 1 ); envelope.setReleaseLoop( -1, -1 ); // Connect units and ports. addPort( amplitude = sinOsc.amplitude, "amplitude" ); amplitude.setup( 0.0, 0.5, 1.0 ); addPort( output = envPlay.output, "output" ); lowPass.amplitude.set( 0, 1.0 ); lowPass.output.connect( envPlay.amplitude); expLag3.halfLife.set( 0, 1.5 ); expLag3.current.set( 0, 39.99848556518555 ); expLag3.output.connect( lowPass.Q); expLag4.halfLife.set( 0, 1.5 ); expLag4.current.set( 0, 799.9757690429688 ); expLag4.output.connect( lowPass.frequency); addPort( cutoff = expLag4.input, "cutoff" ); cutoff.setup( 0.0, 800.0, 15000.0 ); addPort( reson = expLag3.input, "reson" ); reson.setup( 0.0, 40.0, 50.0 ); realFreq.connect( sinOsc.frequency); realFreq.connect( mult3.inputA); realFreq.setup( 0.0, 550.0, 12000.0 ); sinOsc.phase.set( 0, -0.09232518821954727 ); sinOsc.output.connect( mult.inputA); mult.output.connect( lowPass.input); tableOsc.phase.set( 0, -0.9201675057411194 ); tableOsc.amplitude.set( 0, 0.999969482421875 ); tableOsc.output.connect( mult.inputB); mult3.inputB.set( 0, 1.5 ); mult3.output.connect( tableOsc.frequency); addPort( rate = envPlay.rate, "rate" ); rate.setup( 0.0, 1.0, 2.0 ); } public void setStage( int time, int stage ) { switch( stage ) { case 0: envPlay.envelopePort.clear( time ); envPlay.envelopePort.queueOn( time, envelope ); start( time ); break; case 1: envPlay.envelopePort.queueOff( time, envelope ); break; case 2: // added by hand envPlay.envelopePort.clear(time); envPlay.envelopePort.queue(time, envelope, envelope .getNumFrames() - 1, 1); default: break; } } }