This is some notes jotted down while trying to get an old USB sound card, connected to an Asus RT-AC66U router, to output music -- both from local MP3 files and Spotify.
Initially the idea was to run Mopidy on the router, but one of its core dependencies, libspotify, is not (yet) compiled for the MIPS architecture the Asus router runs under.
Maybe that will change some time: http://community.spotify.com/t5/Spotify-Ideas/libspotify-for-the-Mipsel-processor-Architecture/idi-p/36599
For now, Mopidy will have to run on another device on the network, and stream audio to the router. On this computer, Ubuntu was used.
http://tomatousb.org/tut:optware-installation
Find and download the extras
package often provided along with the firmware.
Then insert the needed modules in this order:
insmod /opt/audio-modules/r1/soundcore.ko
insmod /opt/audio-modules/r1/snd.ko
insmod /opt/audio-modules/r1/snd-hwdep.ko
insmod /opt/audio-modules/r1/snd-page-alloc.ko
insmod /opt/audio-modules/r1/snd-timer.ko
insmod /opt/audio-modules/r1/snd-pcm.ko
insmod /opt/audio-modules/r1/snd-seq-device.ko
insmod /opt/audio-modules/r1/snd-seq.ko
insmod /opt/audio-modules/r1/snd-rawmidi.ko
insmod /opt/audio-modules/r1/snd-seq-midi-event.ko
insmod /opt/audio-modules/r1/snd-seq-midi.ko
insmod /opt/audio-modules/r1/snd-mixer-oss.ko
insmod /opt/audio-modules/r1/snd-pcm-oss.ko
insmod /opt/audio-modules/r1/snd-usb-lib.ko
insmod /opt/audio-modules/r1/snd-usb-audio.ko
Download ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.23.tar.bz2 extract, and put the snddevices
script on the router.
$ ipkg install alsa-lib alsa-utils
$ ./snddevices
Test sound with aplay
and a wav file.
The original plan was to configure the router as a PulseAudio sink. However, I could not find Pulseaudio precompiled for the TomatoUSB release currently used. I noticed that Pulseaudio exist for OpenWRT, so it should not be impossible to get it to run.
As an alternative, Icecast is available in the packaging system, and it also proved to be a better alternative.
$ ipkg install icecast
To get icecast to start, some config changes may be needed. It will complain if something is wrong:
$ icecast -b -c etc/icecast.xml
http://askubuntu.com/questions/28496/how-do-i-setup-an-icecast-server-for-broadcasting-audio-in-my-network HOWTO: Share sound from one computer to another
Hopefully, this could be done on the router some day.
Install Mopidy (with Spotify dependencies) through their excellent PPA:
wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add -
sudo wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/mopidy.list
sudo apt-get update
sudo apt-get install mopidy-spotify
We also need lame to stream MP3;
sudo apt-get install lame
Configure as described in the docs,
this is the relevant sections in ~/.config/mopidy/mopidy.conf
:
[audio]
output = lame ! shout2send password="hackme" ip="<ip of router>" mount="stream"
[spotify]
enabled = true
username = <your spotify username>
password = <your spotify password>
http://tomatousb.org/doc:play-audio-with-usb-audio-adapter http://tomatousb.org/forum/t-291380/cross-compiling-applications