View Full Version : Gapless music playback (between tracks)
first off, thanks for such a wonderful product. i was searching high and low for a device that could hold a large amount of data and play lossless media files. xbmc does the job wonderfully!
i was curious about implementing gapless playback when using formats supported by mplayer. i listen to mostly live music, so having the gap between each track is somewhat of a distraction. i would imagine this feature is being looked into?
thanks for reading and keep up the great work!
must admit gapless playback for flac files would be neat. especially since the addition of vorbis tags for flac recently :)
jmarshall
2004-03-19, 00:36
i think we may be able to make the cd player gapless (or close to it) but mplayer is not going to go gapless anytime soon, i'm afraid.
reason is that we restart mplayer with each file so that it can open the file with the correct codecs + filters etc.
a couple of kludgy ideas have been thought of (keep a larger audio buffer around and when reopening mplayer with the next file do some sort of crossfading - though with flac we should be able to just wack the new samples on the end of the current buffer) but imo it'd be better to start fresh with an audio core that is designed for this use from the start - mplayer is designed for good playback of videos mostly.
TurkeyMan
2004-06-03, 15:37
i'd really like it if cd's and mp3's could change tracks seamlessly..
cd's have a tendancy to skip the last second or so of the track when the next track starts... and mp3's have quite a long pause when changing..
i have loads of music with seamless track changes.. kinda annoying..
surely xbmc should start caching the next track well before the previous track has finished playing and swap it seamlessly? :/
just a thought..
Gamester17
2004-06-03, 15:59
surely xbmc should start caching the next track well before the previous track has finished playing and swap it seamlessly? :/this has been requested, discussed and explained before, please do a search, (the short answer is no, because of how mplayer is designed)
Gamester17
2004-06-03, 16:39
for reference, fyi; a other thread with the "feature suggestion of cross fade (crossfading) between audio tracks" is open here (link) (http://www.xboxmediaplayer.de/cgi-bin/forums/ikonboard.pl?act=st;f=4;t=2139),
(guess that "crossfading" isn't exacly the same as removing the gap with some sort of cache-ahead to won't not merge threads, yet)
hello all, i thought i'd throw my two cents into the ring.
i don't yet use xbmc - in fact, i don't even own an xbox...yet. i think it's almost a sure thing that i would purchase one, mod it, and use xbmc regularly if it were able to play back natively gapless formats without gaps between the tracks - and while we're talking about it, it should also be able to support the lame mp3 gapless hack using the number of samples in the header to deal with the inherent gaps in that format.
that said, i know how difficult it is to develop code. i do it for a living (unfortunately, little of my experience would apply here or i would volunteer my services) and i've also developed applications that me and my friends use for audio file management.
i have to say that i come from the other side of the fence on this one; i would *never* use the xbox for watching movies. what i'm looking for is a way to access the 1200 cds of lossless audio files on the server in my garage from my living room with an on-screen interface. sure, i could get a squeezebox from slimdevices (http://www.slimdevices.com), or one of the players from roku labs (http://www.rokulabs.com), but those require browsing on the small digital display - no room for album covers on there (the hd1000 might do it, but there's no support for flac as of yet.)
the only other options are either a home-built htpc, or a modded xbox. the htpc will cost so much more than an xbox mod that it's not even really in consideration - so that's how i landed here. i'd prefer an xbmc solution to a linux one, simply to retain the capability to play xbox games on occasion (i'm an oddworld addict).
i think there's a huge untapped resource in the hydrogenaudio community, as there's a lot of folks that would love to have an inexpensive way to access their media collections without dealing with a hot pc in their cabinet. i'll be happy to help with making playback gapless in whatever fashion i can - just ask, and i'll go through my accomplices to see who can help out best.
thanks for developing this stuff. it's good to see ingenuity these days.
c
we currently only have one "core" for mediaplayback, and that's mplayer (www.mplayerhq.hu).
it's not well suited for audio playback in my eyes and it's the reason why we can't have gapless playback easily.
the best solution would be another core for audio imho, and one that springs to mind here is foobar2000. but as you may already know, fb2k isnt opensource. that indeed pose a problem ;)
how about checking the next file type while playing current track and see if the next track is the same type. if it is, don't restart mplayer.
would do away with a lot of gaps as most people probably have a majority of a certain kind of file types on their hdds - and certainly if you play a whole album, it will tend to be only one file type.
ChEeSyBoOfS
2004-07-21, 01:00
please could the option to remove the gap between mp3's when played back to back, i have many mix albums where one song blends into another, but when converted to mp3 this give a paus before the next song starts.
ChEeSyBoOfS
2004-08-05, 19:43
could i ask a question, how is it that when you play a dvd from hard drive it can jump from vob to vob without any gaps or pauses, so why can the same method of play not be applied to mp3's. forgive my ignorance!
iron chef
2004-08-06, 03:17
sure, i could get a squeezebox from slimdevices (http://www.slimdevices.com), or one of the players from roku labs (http://www.rokulabs.com), but those require browsing on the small digital display - no room for album covers on there
i don't know about the roku gear, but the squeezebox uses a server app on your computer, and it has a web interface. you don't need to set up playlists on the tiny screen unless you want to.
jmarshall
2004-08-06, 13:29
1. gapless playback is now a reality for cd playback.
2. dvd/vob playback has nothing to do with this discussion - that's built-in to mplayer.
3. with the current setup for playing most audio files (ie using mplayer as a dll) gapless playback is difficult to achieve, as the architecture is just not setup to deal with this. the best thing imo is redoing the audio playback side completely, by adapting a new core.
4. .cue sheet support will be added once i get the current database code changes i'm working on up to speed. note that it will only work (at least initially) through the database system.
5. we welcome coding support from all who are willing to contribute their time to help with this.
cheers,
jonathan
.cue sheet support! yaaay! :d
jmarshall
2004-08-06, 15:35
i expect .cue support to be done by the end of the month, just to give you a time-frame, as i have other stuff to get sorted first. (support for multiple artists/genres per song for instance.)
ChEeSyBoOfS
2004-08-06, 18:27
2. *dvd/vob playback has nothing to do with this discussion - that's built-in to mplayer.
dvd/vob playback has nothing to do with this discussion, if the method of play back, ie the same dll/dll's, is the same then it does. all i was saying is there arn't any gaps between vobs so why cant this be applied to mp3's
jmarshall
2004-08-07, 14:34
my point is that the dll of mplayer handles changing vob files itself - we have no input into this at all.
it does not, however, handle changing audio files itself. thus, we must feed it a single audio file at a time. thus, the issue with gaps between playback.
ChEeSyBoOfS
2004-11-03, 13:59
i bet you would get more donations if you where to run a campain for someone to code a way to play mp3's back to back with no gap! i for one would have thier babies!
jmarshall
2004-11-03, 15:14
you are more likely to get someone to code something up for a format that is actually gapless such as flac or ogg (by writing a custom player for audio only)
mp3 can be made gapless through a bunch of hacks.
currently it would require having a large audio cache in xbmc (large enough to stop + reload mplayer with the next song) in order for it to be gapless. this will also mean disconnecting the audio output from mplayer (the audio out devices are setup on mplayer_openfile(), and are destroyed on mplayer_closefile()).
plus, a big buffer causes memory issues (around 10mb/minute) and we'd need at least 2mb i should think to be safe with the mplayer loading system.
it was easy enough to do the gapless playback for the cdda player as i had complete control over the buffers. with mplayer, we'd need to rewrite the output code.
just some suggestions incase someone is thinking of implementing it.
Gamester17
2004-11-03, 15:29
a other idea is to lobby/encurage the mplayer-devs (http://www.mplayerhq.hu) to implement gapless audio plaback themself for supported media formats/containers :evil:
ChEeSyBoOfS
2004-11-03, 16:30
(not being a programmer) could you not create an app that would stream the mp3's to the mplayer dll much like shoutcast?
how about having two instances of mplayer playing one after the other - the second one could load the next file by being notified when the current track is about to end, and then xbmc could swap immediately when the track finishes.
basically, the song gets lined up and then cut from one to the other - just like the live djs do !
would that work ? it sounds like a simple setup ???
clearly its not going to work when manually skipping to the next track using the controller however - but i think that's acceptable.
if no-one has time to do this i might code it - if it'd work.
jmarshall
2004-11-05, 13:12
yes, it would work if you successfully detached the audio output stuff from mplayer so that you could switch between the two instances of mplayer.
however this would involve 2 copies of mplayer being loaded (ie twice the memory usage of which mplayer already uses a fair bit) plus you'd have to recode the entire player backend as it's only coded to support one player at a time.
good luck.
as i've said before (over and over again) a better way (and perhaps easier)) is to code a new player for whatever audio formats you need, simply using libvorbis, libflac, libmp3 etc.
Birksborks
2004-11-06, 12:54
would a new audio core also make it possible to play songs off smb shares without having the harddisk spinning up in between? if so, that would be really, really nice. it's what's stopping me from using xbmc as primary audio player at the moment. apart from that, it's already a fantastic video player.
hello to all!wondering if there is a way to reduce the time of play between music traks,becouse playng from the hdd a mixed album,you can ear tha gap between the two.any help??thanx
oki,
i know that atm every time a music file is played the mplayer is restarted. so my feature request, scan the next file and then choose to restart or to play the next choon gapless :)
btw.. is there a plugin for mixing?
jmarshall
2005-01-01, 19:55
it's not likely to happen with mplayer as the playing core, at least not unless mplayer itself has gapless playback for music playlists (which i doubt).
an easier method would be to build a new standalone core for audio only playback, as is done with the cdda player for instance (which is completely gapless). *lame and libogg/vorbis are already compiled for the xbox i believe (for the cd ripper), so adding an ogg or mp3 player would probably be a nice small coding project for someone like yourself.
cheers,
jonathan
is there a way for get the xbmc to play a mp3 with out the 2 second gap between tracks? i am storing all my mp3s on my pc and have teh xbox networked but when i play a mixed techno cd it inserts the 2 seconds gap between tracks? is any way to stop it from doing this?
no. search forums for details
perhaps mpd would be a good engine for audio. its open source, it supports the most popular audio codecs, it has apis for multiple languages, it has gapless/crossfade.
http://www.musicpd.org/
it supports remote control using a client, resuming, and more!
DGMurdockIII
2008-12-27, 09:12
can it happen now
PAPlayer already have gapless playback...