Equipment Required
Raspberry Pi running raspbian with user pi and ♣hostname♣
HiFiBerry AMP 2 attached with speakers
Step 1. Choose a player
There are many audio players available on Linux. I am not an audiophile. My goal is simplicity of use over quality of audio. Here are couple of audio players:
mpd and mpc
mplayer2
vlc
I use mpd and mpc. mpd is the music player daemon and mpc is a command line interface to control mpd and its content.
Step 2. Install software
alsa comes with raspbian
alsamixer is a gui to control volume
amixer is a command line tool to change the volume
$ sudo apt-get install mpd mpc -y
Step 3. Change permissions
$ sudo service mpd stop
$ sudo chmod -R g+w /var/lib/mpd
$ sudo chmod -R g+w /var/run/mpd
Step 4. Restart mpd service
$ sudo service mpd start
Step 5. Copy songs from MacBook to Raspberry Pi
I have 13GB of songs. To speed up the download, I disabled Wi-Fi on both the MacBook and the Raspberry Pi and connected using an ethernet cable. On the MacBook, I also disabled my Energy Saving features so the MacBook wouldn't go to sleep during the download.
With a wired connection, ♣hostname♣ doesn't resolve. I need to use ♣hostname♣.local
On a Mac,
open a finder window (1), go to iTunes directory and find all songs with .m4a or whatever extensions in use
create a temporary folder called music on your Desktop
open the music folder in finder window 2
copy all the files from finder window 1 to finder window 2
open terminal window and navigate to iTune and create a temporary directory called music
navigate to finder window 2 (cd /Users/.../Desktop/music)
Copy all the music files to your raspberry pi using the command:
scp * pi@♣hostname♣.local:Music/.
Step 6. Check if things work
I have Bruno Mars' 24K Magic in the /home/pi/Music directory on the Raspberry Pi. Note there are three slashes and the track number is included
mpc insert "file:///home/pi/Music/01 24K Magic.m4a"
mpc play
mpc stop
Appendix:
Various Commands
aplay -l
lists the playback hardware
mpc outputs
shows if the output is enabled
cat /var/log/mpd/mpd.log
check for errors and then fix them
References:
Arch linux is not the same as raspbian. Directories and file names are changed, but it is very thorough