Day & Night Sampler - a raspberry pi mpd mini boombox: Part 3 Configure MPD Player
See Part 2, Software Installation
The entry for mixer_control in /etc/mpd.conf, for my USB sound card, had to be changed to match the name below the main volume control on the alsamixer panel.
With the raspberry pi off, plug your USB Sound Card/Dongle into a raspberry pi USB port. If you want your boombox to work with WiFi and no additonal USB hub, you'll probably need a USB extension of some kind. The USB Dongle is too thick to fit into a pi USB port and also use the second USB port for a WiFi dongle.
The USB extension would look something like this:
Now, power up your raspberry pi.
To install the mpd music player-
The USB extension would look something like this:
Now, power up your raspberry pi.
To install the mpd music player-
- sudo apt-get install mpd mpc (should have already been done if you completed Part 2) and configure:
- Raspian by default stores its mpd files in /var/lib/mpd. You'll need to add:
- your own music to /var/lib/mpd/music
- your own playlists to /var/lib/mpd/playlists
- select your music/create your playlists and copy to the appropriate folder with "scp ...." scp username@192.168.0.x/playlists/classical.m3u /var/lib/mpd/playlists/classical.m3 (on the console of the rpi and copying from your source computer to the rpi)
- Note: you will need to change permissions on the /var/lib/mpd/.. folders and files in order to copy to them
- Alternatively, you can create the music and playlists under a /home/pi/.mpd directory, but you will have to change the locations of these in mpd.conf
- If you do put these folders in the home directory, in /etc/mpd.conf you must comment out the line, under General Music Daemon Options, that says
#user "mpd" - in /etc/mpd.conf you need to change the following lines to look like this:
- #bind_to_address "localhost"
- zeroconf_enabled "yes" [used in Avahi service]
- in my case, when I entered mpc {to get an mpd status], I saw this:
- [playing] #1/7 9:21/0:00 (0%)
volume: n/a repeat: off random: off single: off consume: off
- [playing] #1/7 9:21/0:00 (0%)
- so, I had to change the "audio_output" section in mpd.conf to this:audio_output {
type "alsa"
name "My ALSA Device"
device "hw:0,0" # optional
format "44100:16:2" # optional
# mixer_device "default" # optional
# mixer_control "PCM" # optional
mixer_control "Headphone" # added for CMedia USB from alsamixer panel volume name
mixer_index "0" # optional}
The entry for mixer_control in /etc/mpd.conf, for my USB sound card, had to be changed to match the name below the main volume control on the alsamixer panel.
To find this, run alsamixer from the command line.
Then run mpc. You'll see something like:
At this point, you should have a working mpd installation. You can test mpd out by adding a music stream and starting it. Enter "mpd" on the command line. Mpd should start up; you may get an error about port 6600 already in use. That's harmless, meaning mpd was already started.
volume: 100% repeat: off random: off
First thing to do is set the volume waaaaay down, perhaps to 20%, or it will be painfully LOUD!
mpc volume 20%
You can test running a web radio stream by:
mpc add http://66.162.107.142/cpr2_lo
followed by:
mpc play
...and you should hear some music playing.
Wonderful build log! I hope to do some work using this as a foundation, myself!
ReplyDeleteI was wondering, why are you using an external USB sound adapter instead of the built in sound?
Hi Mechno-
ReplyDeleteWhen I made this about three years ago, I think it was with a raspberry pi 1, or at best a pi 2. The sound of the pi 1/2 wasn't very good. The sound from the USB adapter was better and only cost around $7 USD.