Users of the library maybe don’t realise this because the documentation is quite limited. But the fact that MAD doesn’t deal with files means that it doesn’t know when a file has ended, and it doesn’t know about file metadata frames, and these turn out to be things you have to handle in the calling code. These two things are almost the same, as an mp3 file is just a sequence of stream frames with no file header: if you concatenate two mp3 files you get a valid mp3 file containing the concatenation of the two audio streams. The root of the problem I think is that MAD is an mp3 stream decoder and not an mp3 file decoder. this pull request for the more serious of those problems in Audacity). I’ve also started feeding some fixes to a few other projects (e.g. Sonic Visualiser doesn’t do that even after this fix, but that could change!) (If both bursts are there and they appear exactly at the start and end of the file without any padding silence at all, then your decoder not only handles these details correctly but also interprets the LAME information frame and accounts for the encoder delay and padding listed in there. My own Sonic Visualiser v2.5 suffers from both problems:īut both are fixed in the repository, and will be fixed in the forthcoming release: If only one of the two bursts is there, or the second is shorter than the first, then you have the second. If you load this in an application that uses MAD and find the first burst starts around 0.05 sec, then you have the first of the above problems. This file contains two very short bursts of noise, one right at the start of the file and the other at the end, separated by a second and a half or so of silence.Īfter decoding with MAD, the first burst should start around 0.025 seconds in, and the second should finish just before the end of the decoded audio. Here’s an example audio file you can use to check an application: ( audio file link). This causes the decoded audio to be truncated by up to 1152 samples. Without this, it loses synchronisation on the last mp3 frame, which is consequently never decoded. More importantly, they aren’t providing the decoder an expected but undocumented small block of zero data at the end of the file.(This is in addition to the variable mp3 encoder delay, and note that the metadata frame is not the same thing as an id3 tag - those are not actually mp3 frames and so don’t have the same problem.) If an mp3 file starts with a Xing/LAME information frame, they are feeding that frame to the mp3 decoder rather than filtering it out, resulting in an unnecessary 1152 samples of silence at the start of the decoded audio.Here’s what almost every user of this library seems to be doing wrong: #Mp3 encoder library code#I checked the code of a few other open source applications that use it, and found that all of them (including widely-used programs like Audacity) suffered at least one of the same problems as mine did. I discovered this week that I’ve been using this library wrong for many years in a couple of small ways. It’s now getting old (last updated in 2004) but people trust it. It’s a respected library that consists of high quality C code, has a fairly friendly API, and was evidently written with great care. The MAD mp3 decoder library is widely used in open source applications that play or edit mp3 audio files.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |