Build a cheap AirPlay alternative
What we'll need... is "shairport + OpenWrt"- HW:
- an OpenWrt capable router with USB port
- an USB sound card
- SW:
- an OpenWrt firmware with enabled IPv6, ALSA and USB sound support in the kernel (+ functional "hostname" command)
- the Shairport binaries (C package is recommended, because .pl version has more bugs - for now)
- working Avahi-daemon with .service config file for shairport
- Other:
- at least basic Linux skills (if you'll find all necessary packages)
- or
- some Linux (OpenWrt) compiling skills
Ease way
For Asus WL-500G Premium (v1/2)
- Just install this OpenWrt brcm47xx firmware (5,69 MB, with 2.6 kernel, squashfs), which includes:
- enabled IPv6, USB storage & audio support
- shairport 0.05 (with configured avahi-daemon, enabled auto-start through /etc/rc.local, and enabled also on WAN through /etc/firewall.user)
- alsamixer, alsautils, fdisk, e2fsprogs, nano, mc
- extroot ready
For Netgear WNDR3700 / WNDR3800
- According to your router model, just install one of this OpenWrt images:
- ar71xx-wndr3700-factory or
- ar71xx-wndr3700-sysupgrade or
- ar71xx-wndr3700v2-factory or
- ar71xx-wndr3700v2-sysupgrade or
- ar71xx-wndr3800-factory or
- ar71xx-wndr3800-sysupgrade
- All images above (are 6,93 MB big, with 2.6 kernel, squashfs) include:
- enabled IPv6, USB storage & audio support
- shairport 0.05 (with configured avahi-daemon, enabled auto-start through /etc/rc.local, and enabled also on WAN through /etc/firewall.user)
- alsamixer, alsautils, fdisk, e2fsprogs, nano, mc
- LuCI
- extroot ready
- If you have all necessary kernel modules etc., try install this shairport package (opkg install <path to package>)
- And create the config file for avahi-daemon (/etc/avahi/services/shairport.service) with this content:
<?xml version="1.0" standalone='no'?><!--*-nxml-*--> <!DOCTYPE service-group SYSTEM "avahi-service.dtd"> <service-group> <name replace-wildcards="yes">Airplay Server on %h</name> <service> <type>_raop._tcp</type> <port>5000</port> <txt-record>txtvers=1</txt-record> <txt-record>vn=3</txt-record> <txt-record>pw=false</txt-record> <txt-record>sr=44100</txt-record> <txt-record>ss=16</txt-record> <txt-record>ch=2</txt-record> <txt-record>cn=0,1</txt-record> <txt-record>et=0,1</txt-record> <txt-record>ek=1</txt-record> <txt-record>sv=false</txt-record> <txt-record>sm=false</txt-record> <txt-record>tp=TCP,UDP</txt-record> </service> </service-group>
- Reboot
- Start Shairport (shairport -a "WiFi Speakers" -o 5000 -d)
Hard way
Build your own OpenWrt firmware with enabled IPv6, ALSA and USB sound support in the kernel (+ functional "hostname" command).. and Shairport binaries, with added feed (src-git jlars git://github.com/jlars/packages.git;master) to feed.conf:
...
..openwrt/trunk# make dirclean...
..openwrt/trunk# svn update
..openwrt/trunk# ./scripts/feeds update -a
..openwrt/trunk# ./scripts/feeds install shairport
..openwrt/trunk# ./scripts/feeds install -a
..openwrt/trunk# make menuconfig
..openwrt/trunk# make
Final Notes & Tips
Flashing router's firmware is always at your own risk. You will probably loose the warranty for your router. Don't do it, if you don't know what you do.For shairport automatic startup just add the shairport -a Speakers -o 5000 -b 50 -d to /etc/rc.local file.
If you want to provide the AirPlay functionality over router's WAN port, you'll need open communication on firewall. You can do this by adding this to /etc/firewall.user:
For controlling the USB sound card volume you can use alsamixer command line tool. Settings will not survive reboot, therefore use alsactl store / alsactl restore commands for saving / restoring settings (after reboot). For using it you'll need probably create /var/lib/alsa/asound.state file first. Again, use rc.local for restoring the settings after startup.# Allow avahi-daemon ond WAN # for both IPv4 and IPv6 config rule option name Allow-Avahi option src wan option proto udp option dest_port 5353 option target ACCEPT option family any # Allow Shairport ond WAN # for both IPv4 and IPv6 config rule option name Allow-Shairport option src wan option proto tcpudp option dest_port 5000 option target ACCEPT option family any
Cheapest and smallest OpenWrt capable router with USB port, is TP-Link TL-WR703N (about $20) at the moment. You'll need go the "hard way" with it anyway and build your own firmware. It has only of 4MB flash memory size. You'll need use the USB hub + a flash disk + extroot probably.
Cheapest USB sound card you can find on eBay. Even bellow $2.
Enjoy