Closed kamchii closed 2 years ago
OK, looks like NLayer's MPEG2 Layer III decoding isn't quite right... Best guess is it's reading the scale factors incorrectly, but I'd have to compare what NLayer is doing vs. a known-good decoder. That might take me some time.
I have similar problem. Example file: TestMp3File_and_ConvertResult.zip
Me too, converting from MP3 to Wav is substantially reducing the quality of the audio by adding some sort of noise.
OK, looks like NLayer's MPEG2 Layer III decoding isn't quite right... Best guess is it's reading the scale factors incorrectly, but I'd have to compare what NLayer is doing vs. a known-good decoder. That might take me some time.
@ioctlLR I realise this issue is a couple of years old now, but I strongly suspect the issue I was running into was this. Hopefully my PR makes sense - I think it's in the area your intuition was leading you towards.
I've just tested the sample file that @kamchii attached and it looks like this does fix the reported issue as well:
The first is decoded by Audacity, the second is NLayer without the fix, the third is with the fix.
I notice that the duration of the NLayer-decoded version is slightly different to the Audacity decoded version, but given that's true without the fix in place I suspect that's a completely different issue.
@ioctlLR @mikegoatly I tried converting an mp3 file with 44.1 kHz today and got very noisy results. As far as I can tell from the MR, only the values for 16, 22.05, and 24 kHz were changed. Could it be that the other bands need to be corrected as well?
I wouldn't rule it out - I don't remember seeing any other differences though.
NuGet package v1.14.0 still has this bug, master branch is OK.
I have mp3 file created with NAudio.Lame. Conversion to wav with naudio (with default acm driver) is ok, but with nlayer result is noised. Please help, I don't understand my mp3 file corrupted or NLayer has some restriction I didn't notice? Project (code+mp3 file): TestNLayer.zip
How it looks in Audacity (first row original mp3, second wav by naudio, third by nlayer):