public double Evaluate(AudioSynth.Waveform waveform, double x) { float t = (float)x; switch (waveform) { case AudioSynth.Waveform.Triangle: return(triangleWave.Evaluate(t)); case AudioSynth.Waveform.TiltedTriangle: return(tiltedTriangleWave.Evaluate(t)); case AudioSynth.Waveform.Sawtooth: return(sawtoothWave.Evaluate(t)); case AudioSynth.Waveform.Square: return(squareWave.Evaluate(t)); case AudioSynth.Waveform.Pulse: return(pulseWave.Evaluate(t)); case AudioSynth.Waveform.Organ: return(organWave.Evaluate(t)); case AudioSynth.Waveform.Phaser: return(phaserWave.Evaluate(t) * phaserModulation.Evaluate(t / 128f)); case AudioSynth.Waveform.Noise: return(AudioSynth.Noise(x)); case AudioSynth.Waveform.LFO: return(lfoWave.Evaluate(t)); } return(0); }
public Oscillator(float frequency, AudioSynth.Waveform waveform) { Volume = 1; Frequency = frequency; Waveform = waveform; }
public Voice(AudioSynth.Waveform waveform, double attack, double decay, float sustain, double release) { Oscillator = new Oscillator(440, waveform); ADSR = new EnvelopeADSR(attack, decay, sustain, release); }
public Voice(AudioSynth.Waveform waveform) { Oscillator = new Oscillator(440, waveform); ADSR = new EnvelopeADSR(0.01, 0, 1, 0.02); }