public AdsrSampleProvider(ISampleProvider source, float Attack, float Decay, float Sustain, float Release) { this.source = source; adsr = new EnvelopeGenerator(); adsr.AttackRate = Attack * WaveFormat.SampleRate; adsr.SustainLevel = Sustain; adsr.DecayRate = Decay * WaveFormat.SampleRate; adsr.ReleaseRate = Release * WaveFormat.SampleRate; adsr.Gate(true); }
public AdsrSampleProvider(ISampleProvider source) { this.source = source; adsr = new EnvelopeGenerator(); adsr.AttackRate = attack * WaveFormat.SampleRate; adsr.SustainLevel = sustain; adsr.DecayRate = decay * WaveFormat.SampleRate; adsr.ReleaseRate = release * WaveFormat.SampleRate; adsr.Gate(true); }
/// <summary> /// Creates a new AdsrSampleProvider with default values /// </summary> public AdsrSampleProvider(ISampleProvider source) { if (source.WaveFormat.Channels > 1) { throw new ArgumentException("Currently only supports mono inputs"); } this.source = source; adsr = new EnvelopeGenerator(); AttackSeconds = 0.01f; adsr.SustainLevel = 1.0f; adsr.DecayRate = 0.0f * WaveFormat.SampleRate; ReleaseSeconds = 0.3f; adsr.Gate(true); }
public new void NoteOn() { base.NoteOn(); _filterEnvelope.Gate(true); }
/// <summary> /// Enters the Release phase /// </summary> public void Stop() { adsr.Gate(false); }
public void NoteOn() { _amplitudeEnvelope.Gate(true); _isPlaying = true; }