Converting mp3 data to wav data C#

后端 未结 1 1334
一向
一向 2020-12-31 18:52

In my project I am receiving mp3 data in a byte array. I want to convert that data to wav format and store it in another byte array. I searched internet for mp3 to wav conve

相关标签:
1条回答
  • 2020-12-31 19:20

    This is quite the late response but I just figured it out myself. There is this NuGet package called NAudio, https://www.nuget.org/packages/NAudio/ This provides awesome functionality for what you want to do.

        using NAudio.Wave;        
    
        private static void ConvertMp3ToWav(string _inPath_, string _outPath_)
        {
            using (Mp3FileReader mp3 = new Mp3FileReader(_inPath_))
            {
                using (WaveStream pcm = WaveFormatConversionStream.CreatePcmStream(mp3))
                {
                    WaveFileWriter.CreateWaveFile(_outPath_, pcm);
                }
            }
        }
    

    There you go.

    0 讨论(0)
提交回复
热议问题