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
Hi, can you give me a little help for tplink 1043 and shairport install? I know how to build image from trunk, but cant find shairport package there (know search function), then exroot i suppose. Maybe i can use your configuration. Thank for reply, nowako(at)gmail.com
ReplyDeleteHi, you need to add this feed for shairport to /feed.conf:
Deletesrc-git jlars git://github.com/jlars/packages.git;master
Then update all Feeds with command:
./scripts/feeds update
Then install packages:
./scripts/feeds install shairport # for installing shairport package
./scripts/feeds install -a # for installing all remaining packages
So after your help shairport package is flashed and running, added firewall rule and your startup command, but unfortunately it doesnt work.
ReplyDeletein itunes and iphone are shairport/speakers visible, but after selected spinning circle appears for few sec then nothing and my pc speakers selection left unchanged. On iphone shairport speakers are selected no sound from iphone and no from remote speakers.
Now i found that im missing alsamixer package, maybe lead to cause of this problem :)
Now installed alsautils and created avahi-daemon config, but still same problem..
ReplyDeleteFirst make sure your USB audio is working properly...
DeleteIn general, kernel config for USB audio & Shairport support should contains:
• Base System --> busybox --> Networking Utilities ---> hostname (*)
• Libraries ---> alsa-lib, libao, libavahi-dbus-support (*)
• Network ---> IP Addresses and Names ---> avahi-daemon (*)
• Kernel modules:
o Block Devices ---> kmod-scsi-generic (*)
o Network Support ---> kmod-ipv6 (*)
o Sound Support ---> kmod-sound-core, kmod-usb-audio (*)
o USB Support ---> kmod-usb-core, kmod-usb2 (*)
• Sound ---> shairport (*)
Hey u are awesome, missed some packages, but now it works!
ReplyDeleteThank very much for your effort.
Have a nice day.
Can you compile it for brcm63xx, because i try it a lot of times and also getting the same error (error2), i don't know what's going on. thank you very much
ReplyDeleteI have a TP-Link TL-WR703N, Can you compile it for ar71xx?Thanks.
ReplyDeleteHello,
ReplyDeleteI am from Israel and need to talk to you.
can you call my phone please 0544500635
Thank you
nissim@vitelix.com
Great site. A lot of helpful information here. I am sending it to several pals ans also sharing in delicious.
ReplyDeleteAnd obviously, thanks for your sweat!
Netgear Router Tehnical Support
I tried the hard way and gave up -- getting a working build environment running on my laptop (running OS X 10.9.2) was a big fail. So I decided to try to get there via baby steps:
ReplyDelete• I found this OpenWRT build for the TL-WR703N and downloaded the image (http://www.wr703.com/firmware-updateslboat_mod_build_20131220/)
• My TL-WR703N v6 came with dd-wrt preinstalled. I followed these directions to flash directly to OpenWRT without reverting to the stock firmware. It worked great! http://www.madox.net/blog/2013/03/10/how-to-install-openwrt-on-a-tl-wr703n-that-came-with-dd-wrt/
So now I've got OpenWRT running on my router, and was able to ssh in and install the avahi-utils package using opkg. But shairport doesn't appear to be in the standard package list. I've found plenty of sites that talk of how to compile shairport for 12.09 aa, but since I can't get a build environment working those are a dead end. I'd love to find a feed to add to opkg.conf that includes shairport packages ready for install.
Given how much interest there is in running shairport on this router, I'm kind of surprised nobody has yet uploaded a firmware image that includes OpenWRT 12.09 aa with patched shairport included –or maybe I just haven't found it. If I eventually have to get a build environment going and manage to put it together, I'd happily put the working image on my server (along with all the usual disclaimers). Has someone already done this?
And a ton of work later -- finally got a compilation environment set (debian in vmware) and successfully compiled a firmware that worked with shairport that worked -- when on my local network.
ReplyDeleteI'm now trying to figure out how to have the TL-WR703n create an ad-hoc network that I can join from my iPhone while in the car and stream to via airplay.
I think I have ad-hoc working, but it's not giving my phone an IP address despite my efforts with dnsmasq. When I connect my phone to it, I have to set a static IP, at which point my phone sees that it can connect to the airplay service on the TL-WR703n, but when I try to stream audio to it no sound is heard, playback pauses, and the airport service goes away. Running shairport with "-vv" on the router, I see no connection being made to it. I think my ad-hoc network is just not functioning.
Hi Zach :
ReplyDeleteI'm trying the sme thing as you. I cannot see the airplay symbol in my iPhone. I'm sure I have not the right configuration for the avahi daemon. Do you know how to monitorize the daemon and see where I have the error?
Thanks in advance.