You can use the following code to convert .ogg to .wav in C#:
Add the NAudio library to your project. You can download it from https://github.com/naudio/NAudio.
Import the necessary namespaces:
using NAudio.Wave;
using NVorbis.NAudioSupport;
private static void ConvertToWav(string inputFile, string outputFile)
{
using (var vorbis = new VorbisWaveReader(inputFile))
{
WaveFileWriter.CreateWaveFile(outputFile, vorbis);
}
}
ConvertToWav
method:string inputFile = "input.ogg";
string outputFile = "output.wav";
ConvertToWav(inputFile, outputFile);
This code should properly convert .ogg to .wav using C#.
Asked: 2023-07-04 11:36:31 +0000
Seen: 14 times
Last updated: Jul 04 '23