In my previous post I wrote about using TL-WR703N and testing it as a wireless music player. Now I will try to provide some observations on what was working and what not in both cases.
Honestly I spent disproportionate ammount of time trying to make work the "PulseAudio" approach. That is because it leaves many options open and provides for clean separation between the "sound generator" and the "sound player".
The setup - I was using the TL-WR703N with OpenWrt (trunk)*. Connection was over WiFi, N mode, 40MHz channel. On the other side of the connection is a TL-WDR3600. The server is directly connected to the WDR3600 over gigabit ethernet.
name "PulseAudio remote player"
server "pulseaudio" #server name
I was running mpd on a home server with all the music files on a disk attached to this server. Alternatively I was streaming some internet radios. When listening to radios there was a small ammount of incomming traffic - compressed audio comming from the Internet, while there was a huge ammount of outgoing traffic towards the PA server running on the router. Could not conclusevely establish if it was a wifi overload issue, but the whole system was too unstable for me.
Additionally I tried rtp with pulseaudio. That was a failure. The streams never syncronized correctly.
MPD (mpd-full) with radio
Finally I settled on a simpler design. mpd running on the router being controlled by a computer or a phone (there are good clients for Android and iOS). As the router has some storage (8GB) it can easily be shared via SAMBA in the local network for local files. I even mounted my SAMBA share from the server with a lot of files. The indexing of all files was bringing down the router and the kernel was killing mpd, as a sacrifice :).
At some point I noticed that the router was instable and often restarting. I thought it was power issue, but after changing 3 different power adapters each less no-name that the previous there was inconclusive evidence.
I looked in the logs. When audio was played the kernel was spitting some strange errors. I added a parameter for the usb-audio module - nrpacks=1 which led to no more reboots, for now.
In the code repository I tried to share all the files that are relevant to the project.
As I had already 8GB attached to the router for extroot I decided to share it for uploading music to it as a form of local storage. It is relatively easy to enable Samba and have the unit visible in a local network.
Additionally I decided I want to add some sort of display. So I went the easiest route - grabbed an Arduino Pro Micro clone (Atmega 32u4) and Nokia 5110 display clone (PCD8544 controller) and "quickly" slapped a sketch. Additionallty I spent quite some time writing a bash script that monitors the state of mpd and sends it to the Arduino over the serial interface.
What I learned:
- After programming the Atmega board will be in some intermediate state where the serial connection will not be available (indicated by blinking RX led). This lasts 5-10 seconds.
- The library I used - U8glib uses some sort of double buffering that caused me quite a bit of trouble to figure out that it messes up with the timings in my script. Using ready Arduino libraries without understanding how they work can lead to a lot of headscratching.
Most of the important code created for this project is available here:
* Using OpenWrt trunk is a no-no :). You'll have trouble updating or even installing few days later when a new default kernel appears in the trunk and all the packages depend on it. Go for the last stable version instead.