title: How can I use a decay envelope with nAudio signal generator?
body: <p>I'm in the process of learning c# and NAudio. In my project, I need to play a series of short tones using a decay envelope. It looks like the ADSR Envelope sample provider will do this, but I can't seem to make it work with the signal generator. When I set the release time, I just get a constant tone.
  Can anyone tell me what I'm doing wrong?
  Here's a very simple console app that I'm trying to use to test this:</p>
  <pre><code>    class Program
      {
          public SignalGenerator wg;
          public IWavePlayer driverOut;
          static void Main(string[] args)
          {
              // Init Audio
              var driverOut = new WaveOutEvent();
              var wg = new SignalGenerator();
              var adsr = new AdsrSampleProvider(wg.ToMono());
              wg.Type = SignalGeneratorType.Sin;
              adsr.AttackSeconds = 0;
              adsr.ReleaseSeconds = (float)1;
              wg.Take(TimeSpan.FromMilliseconds(500));
              driverOut.Init(wg);
              wg.Frequency = 500  ;
              wg.Gain = 0.1;  
              
              driverOut.Play();
              Thread.Sleep(3000);
          }
      }
  
  </code></pre>