using a compressor

May 18 at 7:47 AM
Hello

I have read that this libary offers a compressor. I need to implement one during my voice recording or at least before playback the file.

Is there any kind of documentation how to use the compressor? Right now my recording code looks like that (using NAudio):
public void Record(String strFile)
    {            
        m_WaveSource = new WaveIn();
        m_WaveSource.WaveFormat = new WaveFormat(44100, 1);

        m_WaveSource.DataAvailable += new EventHandler<WaveInEventArgs>(DataAvailable);
        m_WaveSource.RecordingStopped += new EventHandler<StoppedEventArgs>(RecordingStopped);

        m_WaveFile = new WaveFileWriter(strFile, _WaveSource.WaveFormat);

        m_WaveSource.StartRecording();
    }
       void DataAvailable(object sender, WaveInEventArgs e)
        {
            if (m_WaveFile != null)
            {
                m_WaveFile.Write(e.Buffer, 0, e.BytesRecorded);
                
                double sum = 0;
                for (var i = 0; i < e.BytesRecorded; i = i + 2)
                {
                    double sample = BitConverter.ToInt16(e.Buffer, i) / 32768.0;
                    sum += (sample * sample);
                }
                double rms = Math.Sqrt(sum / (e.BytesRecorded / 2));
                var decibel = 20 * Math.Log10(rms);
                
              
                VolumeMeter.Value = decibel;
                m_WaveFile.Flush();
            }
        }