I'm working with Audacity and seeing some MP3 decode values that turn out to be >1.0 or <-1.0. I'm working on Windows 2000 in VC++.
Sometimes the decode gives me such values and sometimes it doesn't, so it is possibly an initialization problem - perhaps in Audacity. But I thought I'd check with you to see if you have seen this situation before.
There is a zip file with 3 audio clips at http://www.busam.com/skyland/iavc/crackle_files.zip
Try opening crakle_OK.mp3
For example, I've seen a sample value of 1.00603f at sample number 7421.
Audacity converts from your format to float using:
where MAD_F_FRACBITS appears to be = 28.
Any guidance you can give me to track down the problem will be most appreciated.
PCM values beyond the full scale values of +/- 1.0 are normal. Because of the way the lossy MPEG audio encoding works, it's not guaranteed that decoded values will not be produced outside of full scale.
It is your responsibility to clip/limit/attenuate the signal, if necessary, to meet your own signal representation requirements.
Thanks a lot. That explains the "out-of-range" values.
Does it also explain why sometimes I get out-of-range values and sometimes I don't for the same file? I expected MP3 decoding would always return the same values. I'm positive I'm seeing different values because I added test code to check for this condition and set breakpoints. During some decoding I hit the breakpoint and sometimes I don't - for the same input file. Normally, I'd suspect an uninitialized variable but may the lossy decoding is causing this.
Some state information is carried through decoding, so it's possible that if you are not resetting the state between decodes of the same file, you will get slightly different results.
A similar phenomenon will occur if you are dithering the output from libmad: unless you reset the dither state between decodes, you can expect slightly different results. If your dither algorithm involves a random number seed, you can expect different results even when you reset state.
Log in to post a comment.