Gapless playback for mplayer (Linux)

/ Published in: Bash
Save to your folder(s)

`mplayer` (or its GUI cousin, `gmplayer`) does not natively support [gapless playback](, which is what you want when playing sources which have songs crossing track boundaries (classical and some modern music). In my experience the buffering Linux provides for named pipes is sufficient to bridge the gaps.

So the idea is to make `mplayer` output PCM data to a named pipe and use `aplay` to play the result. The sample rate and format have to be known, because we have to disable wav headers which otherwise cause clicks. There is a noticeable delay if you try to use the controls to skip forward or backward.

Copy this code and paste it in your HTML
  1. mkfifo aufifo
  2. aplay -t raw -c 2 -f S16_LE -r 44100 aufifo &> /tmp/aplayfifo.log &
  3. gmplayer -ao pcm:nowaveheader:file=aufifo track01.ogg track02.ogg track03.ogg &

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.