Wouldn't it be easier to use a PD or shareware audio editor?
mp3 files have a header -- so to make one track of multiple tunes, you'll need (I think) to edit the header information so that your player knows it should continue past the end of the first tune (and either move the second tune's minimum-required header info to before that first tune or re-write your player to accept the need to skip over the second header... and so on and so forth... ad nauseum...
and that doesn't even begin to deal with footers (if any).
CPAN does, however, hold some promise, despite the fact that most items with mp3 in the name seem to deal with tagging, not editing.
- Audio::Digest::MP3
- (possibility?): MP3::Album::Track
- Audio::MPEG
- etc, maybe.
If you're not familiar with CPAN, take a gander; you'll find it invaluable.
| [reply] |
Incidentally the MP3 file format is designed so that it should be possible to concatenate files by simply writing one after the other; players must skip frames they can't process so they'd just ignore the intervening header. However, this only works if the encoding is exactly the same regarding sample rate, bps and $DEITY knows what else, so in practice it usually doesn't. Unless it's really necessary to do it in Perl, I'd second ww in recommending some external audio editor such as SOX. | [reply] |
Thanks monks!
this is correct - the only way to combined the files was to completely re-encode each mp3 with audacity. I even tried using a MP3::Tag to strip away existing tags but it was not enough. The only way is to re-encode, then the joining works. After encoding it was just simply opening each of the files, binmode both filehandle, binmode output filehandle and writing it the new file.
thanks again.
AL
| [reply] |
| [reply] |