/** Initialisation method used to build the objects that this instrument will use. */ public void createChain() { Oscillator wt1 = new Oscillator(this, Oscillator.SINE_WAVE, this.sampleRate, Oscillator.MONO); wt1.setFrqRatio((float) 2.2); Envelope env = new Envelope(wt1, new double[] {0.0, 1.0, 1.0, 0.0}); Oscillator wt2 = new Oscillator(env, Oscillator.SINE_WAVE, Oscillator.AMPLITUDE); Envelope env2 = new Envelope(wt2, new double[] {0.0, 0.0, 0.05, 1.0, 1.0, 0.0}); SampleOut sout = new SampleOut(env2); }
/** Initialisation method used to build the objects that this instrument will use */ public void createChain() throws AOException { // modulator Value modFrequency = new Value(this, this.sampleRate, this.channels, (float) 5.0); Oscillator modulator = new Oscillator(modFrequency, Oscillator.SINE_WAVE, Oscillator.FREQUENCY); modulator.setAmp((float) 8.0); // constant Value constFreq = new Value(this, this.sampleRate, this.channels, Value.NOTE_PITCH); Add add = new Add(new AudioObject[] {constFreq, modulator}); // carrier Oscillator carrier = new Oscillator(add, Oscillator.SINE_WAVE, Oscillator.FREQUENCY); Envelope env2 = new Envelope(carrier, new double[] {0.0, 0.0, 0.1, 1.0, 1.0, 0.0}); Volume amp = new Volume(env2); SampleOut sout = new SampleOut(amp); }