Recording with NAudio with C #

0

I'm recording audio with the code below:

    public WaveIn waveSource = null;
    public WaveFileWriter waveFile = null;

    private void StartBtn_Click_1(object sender, EventArgs e)
    {
        if(System.IO.File.Exists(@"D:\TELEFONE\Gravacao01.wav"))
        {
            System.IO.File.Delete(@"D:\TELEFONE\Gravacao01.wav");

        }

        StartBtn.Enabled = false;
        StopBtn.Enabled = true;
        btnPausar.Enabled = true;

        waveSource = new WaveIn();

        waveSource.WaveFormat = new WaveFormat(44100,1);

        waveSource.DataAvailable += new EventHandler<WaveInEventArgs>(waveSource_DataAvailable);

        waveSource.RecordingStopped += new EventHandler<StoppedEventArgs>(waveSource_RecordingStopped);

        waveFile = new WaveFileWriter(@"D:\TELEFONE\Gravacao01.wav", waveSource.WaveFormat);

        waveSource.StartRecording();


       // waveFile.

    }

    private void StopBtn_Click_1(object sender, EventArgs e)
    {
        StopBtn.Enabled = false;
        btnPausar.Enabled = false;

        waveSource.StopRecording();
    }

    void waveSource_DataAvailable(object sender, WaveInEventArgs e)
    {
        if (waveFile != null)
        {
            waveFile.Write(e.Buffer, 0, e.BytesRecorded);

            waveFile.Flush();
        }
    }

    void waveSource_RecordingStopped(object sender, StoppedEventArgs e)
    {
        if (waveSource != null)
        {
            waveSource.Dispose();
            waveSource = null;
        }

        if (waveFile != null)
        {
            waveFile.Dispose();
            waveFile = null;
        }


    }

But when I open the recording through windows media player the volume of the recording is low

    
asked by anonymous 22.03.2018 / 20:08

0 answers