Search This Blog

Thursday, February 18, 2016

How to play all mp3 music files in a folder on Raspberry Pi

omxplayer can only play 1 mp3 files a time.
To loop through all files in a folder, I create a shell script : /usr/local/bin/playmp3.sh


#!/bin/bash

for f in *.mp3
do
echo "Playing $f file..."
omxplayer "$f"
done



Go to the folder has mp3 files, run playmp3.sh.

That's it.

2 comments:

  1. thanks! This worked great.

    The only other thing I had to do was make it executable:

    sudo chmod +x /usr/local/bin/playmp3.sh

    thanks again - I'm enjoying a folder of mp3 right now on a tty in the background

    ReplyDelete
  2. Thanks for your fix.

    ReplyDelete