The only command line solution for gapless playback I found so far (working with ALSA and JACK) is moc (»music on console«). While I'm still searching for a simpler way I was wondering if it is possible to loop an audio file into a new file for a given number of times?

Something like:

loop-audio infile.flac --loop 32 outfile.flac

for repeating infile.flac 32 times into outfile.flac


Sometimes it is just good to know that linux-life can be as easy as imagined, in this case by using SoX (Sound eXchange):

sox infile.flac outfile.flac repeat 32

this even works with different file formats like:

sox infile.flac outfile.mp3 repeat 32

would loop into a 128 kbps MP3

other bit rates can be set using the option:

-C|--compression FACTOR  Compression factor for output format

getting an 320 kbps MP3 would be obtained with this command:

sox infile.flac -C 320 outfile.mp3 repeat 32

and finally a simple gapless playback from the command line with mpv:

mpv --loop-file infile.flac

or the same even simpler:

mpv --loop infile.flac

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.