Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

DownmixToMono doesn't convert to mono #5

Open
uluhonolulu opened this issue Aug 13, 2017 · 1 comment
Open

DownmixToMono doesn't convert to mono #5

uluhonolulu opened this issue Aug 13, 2017 · 1 comment
Assignees

Comments

@uluhonolulu
Copy link

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:

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?

@ioctlLR ioctlLR self-assigned this Sep 6, 2017
@ioctlLR
Copy link
Contributor

ioctlLR commented Sep 6, 2017

To be honest, I haven't tested that option in quite some time. I'll take a look and see what needs to happen.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants