1

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

nath
  • 5,430
  • 9
  • 45
  • 87

2 Answers2

11

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
nath
  • 5,430
  • 9
  • 45
  • 87
0

I had the same question and wanted actual gapless. I use this solution:

  1. download and use Music On Consol (moc)
  2. mocp -S && sleep 5s && mocp -o r -u s,n && mocp -l /path/to/your.file

adapted from this moc forum answer

Poxls88
  • 1
  • 2