Skip to content

Instantly share code, notes, and snippets.

@sytone
Last active May 24, 2016 04:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sytone/76ede3cef2480c280493 to your computer and use it in GitHub Desktop.
Save sytone/76ede3cef2480c280493 to your computer and use it in GitHub Desktop.
Raspberry Pi as a Squeezebox Player
# Sound test setup
aplay -L
speaker-test -D sysdefault:CARD=Device
amixer
# Get out of jail free card
# sudo /etc/init.d/alsa-utils reset
# alsa configuration
sudo nano /usr/share/alsa/alsa.conf
/lib/modprobe.d/aliases.conf
Ok, first delete the file /etc/modprobe.d/alsa-base.conf Raspbian Jessie does not use this config file like Wheezy did.
To find what address your device uses you need to first enter the command aplay -l this shows all audio output devices, and their address. For example, my USB sound card comes up as device 1 in the output which looks like this.
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
Subdevices: 0/1
Subdevice #0: subdevice #0
Now, to set the device to your default card you will need to edit the file /usr/share/alsa/alsa.conf with the command sudo nano /usr/share/alsa/alsa.conf scroll down until you find the lines
defaults.ctl.card 0
defaults.pcm.card 0
and change them to (if your device is also listed as device 1, if not change the 1 to whatever address it was listed at)
defaults.ctl.card 1
defaults.pcm.card 1
Explanation: USB sound cards are registered as card 1 on Raspbian Jessie. On Wheezy they would be registered as card -2 by default and editing /etc/modprobe.d/alsa-base.conf would change that.
I do not know if this next step is necessary but without it my card wouldn't work.
Create and edit the file ~/.asoundrc by using the command sudo nano ~/.asoundrc and change it so that it only reads this:
pcm.!default {
type hw
card 1
}
ctl.!default {
type hw
card 1
}
Now your default audio out (speakers) and audio in (mic) are your usb device.
# Save current ALSA settings. This should save alsamixer configurations to /etc/asound.state which gets loaded every startup.
cat /var/lib/alsa/asound.state
alsamixer
sudo alsactl store
cat /var/lib/alsa/asound.state
cd ~
mkdir squeezelite
cd squeezelite
sudo apt-get --yes install libflac-dev libfaad2 libmad0
wget http://squeezelite.googlecode.com/files/squeezelite-armv6
chmod u+x squeezelite-armv6
./squeezelite-armv6 -l
./squeezelite-armv6 -o sysdefault:CARD=Device -a 5000:4 -m 00:04:20:23:3a:22
sudo vi /opt/bootlocal.sh
#ifconfig eth0 hw ether 00:04:20:23:3a:20
sudo filetool.sh -b
Backing up files to /mnt/mmcblk0p2/tce/mydata.tgz/
Done.
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment