is there any simple way to loop mp3 files in a seamless way?
I guess the main problem is that the compression is block based and so we do not have a sample accuarate stream? But it should be possible if the loops contain some overlapping parts at the beginning and at the end and we don’t loop over the whole stream but exactly the length of the “embedded” loop?
Am i right or is it not possible to use MP3 for background loops? I have to mention that it’s especially important to me because I have to implement a music player based on a group of seamless loopable/joinable background themes.
<font size=-1>[ This Message was edited by: Nelvin on 2002-02-26 05:09 ]</font>
- Nelvin asked 15 years ago
sorry I wasn’t clear enough. Looping is of course no problem as it’s only a flag for FMod but at the end of the loop I get a noticable time of silence the system I’d like to implement is based on “parts” that could be played one after another or looped without any pause between them. So it’s not a simple playlist with different songs but one “song” created by randomly selected parts during playtime.
In the second step I need to play 2 or 3 layers of music at the same time (i.e. one base track and additional layers used for special situations like a fight etc.) so it’s critical to get correct timings also. Well I think I have to do mix the channels for the music by myself for this system anyways but a simple way for seamless mp3 loops would be nice also.
- Nelvin answered 15 years ago
Hey, I have about the same problem when trying to play mp3’s from a mixed cd.
Even the winamp gappless output plug-in can’t fix it completely to play them withouth a pause, but I’ve read that you have to use the -nogap (or something like that) option in Lame when encoding your mp3’s.
When you decode a regular encoded mp3 and open it in cool edit or another wave editing program you’ll see there just is about 10-20 ms silence at the end.
I suppose when using this -nogap option this silence is removed.
I haven’t tried it myself yet though…
- Adion answered 15 years ago
As long as you use a constant bitrate for the MP3’s you should be able to use them as backgrounds and calculate the times correctly.
Looping one mp3 is easy (Look at the Stream_OpenFile section of the help), having several to loop would best be done as an invisible playlist in memory that plays each one after the other until it reaches the end then starts all over.
If you want to loop sections of just one stream then you may need to get mathematical!
If you buffer a sample of the current MP3, then pause it and at the same time start playing the buffer and loop until needed. Stop the buffer and unpause the mp3?
Would take some hardcore math to calc the timeline and samples to buffer and so on. Heck, would be an awesome accomplishment though!
Please login first to submit.