A very short tutorial on how to set up an OrangePi (you can use any single board computer like RaspberryPi, in fact, any computer running linux) to play a specific mp3 file on boot. It is convenient if you always need to play this audio file and you want it to play as soon as the computer boots up.

Step 1:
Load your audio file onto the computer. For example, in “~/sounds/birds.mp3”.

If you file is from a usb stick, first you need to mount it. Check which block device is the usb assigned to:

lsblk

Mount the “part” corresponds to your usb stick, usually it will be sda1 or sdb1. Don’t forget to create a mounting point (a folder in /media) if you haven’t done so already.

sudo mkdir /media/usb

sudo mount -t vfat /dev/sda1 /media/usb

Now you should be able to see your files in the usb stick by going to “/media/usb”.

 

Step 2:
Go to “/etc”, and edit file “rc.local”. (create one if it is not there)

Step 3:
Fill the file “rc.local” with your own commands using this template:

#!/bin/sh -e

mplayer -loop 0 -volume 100 /home/orangepi/sounbs/birds.mp3 &

exit 0

Mplayer is the package I use to play audio files from command line. If the file is in your home directory and your username is e.g. orangepi, make sure you specify “/home/orangepi” and not “~”, because the system does not recognise “~” during boot.

Reboot now and it should start playing birds.mp3 automatically.