Raspberry Pi Music Over USB

Note
Note: The following did not work but I took the notes to review if we ever revisit this

My father wanted to have a Raspberry Pi setup on his television for friends to come over and watch Youtube videos as well as displaying the lyrics to music being played on his music system. Since he uses his own DAC, we want to pipe the audio out of the Raspberry Pi to said device.

One of the first things we did was enabled “pixel doubling” on the Raspberry Pi to make the UI more readable on the TV.

Then we ran the command $ lsusb to find out which USB device the Raspberry Pi was seeing the DAC connected too. Ours was

Bus 001 Device 007: ID 6b42:0042.

We discovered this by running $ lsusb with the DAC unplugged and running it again with it plugged in.

We than ran $ aplay -a to see the media devices:

1
2
3
card 1: MSBMQA1v2 [MSB-MQA-1v2], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

this was the DAC we wanted to utilize.

We modified the configuration file responsible for selecting the default media output using the command

sudo vim /usr/share/alsa/alsa.conf

We modified the lines from:

1
2
defaults.ctl.card 0
defaults.pcm.card 0
1
2
defaults.ctl.card 1
defaults.pcm.card 1

where the 1 comes from the card number above when we ran $ aplay -a.

We than added the following text to the file /etc/asound.conf, which didn’t exist before.

1
2
3
4
5
6
7
8
9
pcm.!default {
 type hw
 card 1
}

ctl.!default {
 type hw
 card 1
}

The following command will output the settings of your selected audio output device

$ amixer

We used the following two commands to test the audio output

One

  • $ speaker-test -c2

Two

  • $ wget https://www.kozco.com/tech/piano2.wav
  • $ aplay piano2.wav

We followed this project’s README.md to install the web controller.

I added cd [path to cloned repository && npm start] to a ~/.rc.local script and made it executable with chmod +x ~/.rc.local to have the server start on boot.