I'm trying to convert an .mp3 file to a mono .wav file. I'm using StereoMode.DownmixToMono in the decompressor, but I'm still getting a stereo file in the output. Here's my code:
var builder = new Mp3FileReader.FrameDecompressorBuilder(wf => new Mp3FrameDecompressor(wf){StereoMode = StereoMode.DownmixToMono});
using (var reader = new Mp3FileReader(mp3FileName, builder)) {
using (var writer = new WaveFileWriter(waveFileName, reader.WaveFormat))
reader.CopyTo(writer);
}
If I specify a mono format, I get a double length mono record filled with garbage:
var builder = new Mp3FileReader.FrameDecompressorBuilder(wf => new Mp3FrameDecompressor(wf){StereoMode = StereoMode.DownmixToMono});
using (var reader = new Mp3FileReader(mp3FileName, builder)) {
var waveFormat = new WaveFormat(reader.WaveFormat.SampleRate, 1);
using (var writer = new WaveFileWriter(waveFileName, waveFormat))
reader.CopyTo(writer);
}
I also tried specifying a mono format in the Mp3FrameDecompressor constructor:
var builder = new Mp3FileReader.FrameDecompressorBuilder(wf => new Mp3FrameDecompressor(new WaveFormat(44100, 1)){StereoMode = StereoMode.DownmixToMono});
using (var reader = new Mp3FileReader(mp3FileName, builder)) {
using (var writer = new WaveFileWriter(waveFileName, reader.WaveFormat))
reader.CopyTo(writer);
}
The result was a mono record slown down 2x.
What am I doing wrong? How do you use the DownmixToMono option properly?
Hi,
I'm trying to convert an .mp3 file to a mono .wav file. I'm using
StereoMode.DownmixToMono
in the decompressor, but I'm still getting a stereo file in the output. Here's my code:If I specify a mono format, I get a double length mono record filled with garbage:
I also tried specifying a mono format in the
Mp3FrameDecompressor
constructor:The result was a mono record slown down 2x.
What am I doing wrong? How do you use the
DownmixToMono
option properly?