I have a directory full of mp3s - /home/pi/Desktop/Music - and I want to be able to shuffle all the songs in the dir, so when I use sox to convert them into wma files on-the-fly, they will all be shuffled, and it will endlessly play through all the files in a andom order. My current command is:

sox -R -t mp3 /home/pi/Desktop/Music/*.mp3 -t wav -r 44100 -

(The results get piped into pim):

sox -R -t mp3 /home/pi/Desktop/Music/*.mp3 -t wav -r 44100 - | sudo ./pi_fm_rds -freq 94.5  -audio - -ps ZSFM -rt ZSFM

How can I shuffle all the files in this dir on-the-fly with sox?

  • Can a tune be played times or not? Is the list truly randomised? Jun 25, 2021 at 10:28
  • @JeremyBoden I just want it to play orever, and also play the songs in a random order (like not a whole album one song after another).
    – horace
    Jun 29, 2021 at 4:43

1 Answer 1

sox -R -t mp3 $(ls -1 /home/pi/Desktop/Music/*.mp3|sort -R) -t wav -r 44100 -
  • When I run that I get this: sox WARN getopt: option `A' not recognized sox FAIL sox: invalid option What does it mean? I have no idea what option A is, and can't find anyhting about it anywhere.
    – horace
    Jun 29, 2021 at 4:39
  • igured it out, I had to remove the whitespace from the filenames (like turn dasa_berta/mp3 to dasa-berta.mp3). Thanks!
    – horace
    Jun 29, 2021 at 5:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .