package rosshendler2604; import java.io.*; 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. ** ** Wire is available from: http://www.softsynth.com/wire/ */ public class SonarPulse extends SynthNote { // Declare units and ports. SineOscillator sinOsc1; EnvelopePlayer envPlay; SynthEnvelope envelope; public SynthInput modRate; public SynthInput modDepth; AddUnit add; RedNoise redNse; public SonarPulse() { this( Synth.getSharedContext() ); } public SonarPulse( SynthContext synthContext ) { super( synthContext ); // Create unit generators. add( sinOsc1 = new SineOscillator(synthContext) ); add( envPlay = new EnvelopePlayer(synthContext) ); double[] envelopeData = { 0.022046921265340125, 0.9916666666666667, 0.062466276918463695, 0.675, 0.08451319818380382, 0.5208333333333334, 0.166700381855903, 0.25416666666666665, 0.33329961814409703, 0.0, }; envelope = new SynthEnvelope( synthContext, envelopeData ); envelopeData = null; envelope.setSustainLoop( 2, 2 ); envelope.setReleaseLoop( -1, -1 ); add( add = new AddUnit(synthContext) ); add( redNse = new RedNoise(synthContext) ); // Connect units and ports. addPort( frequency = add.inputA, "frequency" ); frequency.setup( 0.0, 698.4584691287101, 3000.0 ); addPort( amplitude = envPlay.amplitude, "amplitude" ); amplitude.setup( 0.0, 0.5, 1.0 ); sinOsc1.phase.set( 0, 0.030783647671341896 ); addPort( output = sinOsc1.output, "output" ); envPlay.rate.set( 0, 1.0 ); envPlay.output.connect( sinOsc1.amplitude); addPort( modRate = redNse.frequency, "modRate" ); modRate.setup( 0.0, 224.67209795551722, 10.0 ); addPort( modDepth = redNse.amplitude, "modDepth" ); modDepth.setup( 0.0, 55.739299256185106, 100.0 ); add.output.connect( sinOsc1.frequency); redNse.phase.set( 0, 0.42044350504875183 ); redNse.output.connect( add.inputB); } 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; default: break; } } }