Fixing sound on the PhidgetSBC3

When I got my PhidgetSBC3 I was really excited because I was going to try to get go running on it ([which I did](/2013/03/go-on-the-phidgetsbc3-part-1/)) but while it recognized my [Logitech Z205 speakers](, playing any audio file resulted in a lot of crackling ([hear for yourself]( After searching until my eyes bled months ago, I gave up. But recently I took another stab (because I want our foosball table horn back at Shopify) and finally found a solution then I figured out the actual problem.

I’ve tried solution after solution hoping it would work because none of the regular troubleshooting would work as the device was being recognized and was able to be used. It just sounded horrible. I did find [this wiki entry for archlinux for crackling sound with USB devices]( but that solution didn’t help. But did make me try restarting the PhidgetSBC3 which then lead some actual errors when trying to use alsa.

root@phidgetsbc:~# alsamixer
cannot open mixer: No such file or directory
root@phidgetsbc:~# aplay /usr/share/sounds/alsa/Front_Center.wav
ALSA lib confmisc.c:768:(parse_card) cannot find card ‘0’
ALSA lib conf.c:4241:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4241:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4241:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4720:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM default
aplay: main:682: audio open error: No such file or directory

Searching for this lead me to [this forum post about a usb speaker not being detected](,2449) and suggested creating a `/etc/asound.conf` file and restarting alsa. This solved the problem of not finding the device and the crackling. The `card 1` in the file suggested an ID of some sort and then I checked the ID of the device and found it matched.

root@phidgetsbc:~# cat /proc/asound/modules
1 snd_usb_audio

I wanted to confirm this was the device missing issue so I restored to factory and plugged the Z205 in and looked again.

root@phidgetsbc:~# cat /proc/asound/modules
0 snd_usb_audio

And suddenly it makes sense. For whatever reason, before installing `alsa-base` the PhidgetSBC3 will use ID 0 for the Z205 but after that it will use ID 1. I have no idea why the crackling went away but it might have something to do with setting `type hw` or maybe it just doesn’t like ID 0.


If you’re trying to get sound on the PhidgetSBC3 to work. Try this and restart.

root@phidgetsbc:~# apt-get install alsa-base alsa-utils -y
root@phidgetsbc:~# cat > /etc/asound.conf
pcm.!default {
type hw
card 1

ctl.!default {
type hw
card 1
root@phidgetsbc:~# /etc/init.d/alsa-utils restart
[ ok ] Shutting down ALSA…done.
[ ok ] Setting up ALSA…done.

Fix locales on the PhidgetSBC3

If you are using a PhidgetSBC3 you might see this a lot:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = “en_CA.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

This is because perl is very vocal when you are missing the locales that your environment specifies. The fix is easy, just generate the locales that you want to use (`en_CA.UTF-8` is the default). This assumes you have already set up SSH on your PhidgetSBC3.

1. Enable full Debian Package Repository
Enable the full Debian Package Repository
2. Update apt
* `apt-get update`
3. Install the locales package
* `apt-get install locales -y`
4. Add the `en_CA.UTF-8` locale
* `echo “en_CA.UTF-8 UTF-8” >> /etc/locale.gen`
5. Generate the locale
* `locale-gen`

You should see it generating the locale you specified and once it’s done, you will no longer see the locale error messages.

Hello World

Every blog needs a first post and I can’t think of an exiting topic to make it about so I’ll just say: hi.