Topic: shairport on openwrt

just did some reading on wired about shairport.

http://www.wired.com/gadgetlab/tag/shairport/

apparently the public key encryption scheme for AirTunes streaming has been cracked. This makes it possible to send audio from itunes directly to an linux desktop.

I got it working on ubuntu, but I  I never got the hang of cross compiling for openwrt or building a custom image/package.

Any possibility to get this running on an openwrt router? It would make my asus wl500gp a perfect companion for my home stereo.


Kind Regards

Jasper

2 (edited by gregd72002 2011-04-13 22:39:37)

Re: shairport on openwrt

Ok, I spent some time on it and compiled it (thought it is the ugliest solution I've ever seen)...
Makefile:

# 
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=shairport
PKG_VERSION:=0.04
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://mafipulation.org/static/
PKG_MD5SUM:=3e78487969ca94751801f8e8178c47f7
PKG_BUILD_PARALLEL:=1

include $(INCLUDE_DIR)/package.mk

define Package/shairport
  SECTION:=sound
  CATEGORY:=Sound
  TITLE:=AirPlay speakers
  URL:=http://mafipulation.org/blagoblig  
  DEPENDS:=libao
endef

define Build/Configure
        $(call Build/Configure/Default)
endef

define Build/Compile
    $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
        $(TARGET_CONFIGURE_OPTS) \
        CFLAGS="$(TARGET_CFLAGS)"
    mkdir -p $(PKG_INSTALL_DIR)
endef

define Package/shairport/install
    $(INSTALL_DIR) $(1)/usr/bin
    $(CP) $(PKG_BUILD_DIR)/{hairtunes,shairport.pl} $(1)/usr/bin/
endef

$(eval $(call BuildPackage,shairport))

patch 001-Makefile.patch

diff -c shairport-0.04.orig/Makefile shairport-0.04/Makefile
*** shairport-0.04.orig/Makefile    2011-04-13 19:07:37.000000000 +0100
--- shairport-0.04/Makefile    2011-04-13 19:38:00.000000000 +0100
***************
*** 1,4 ****
  CFLAGS = `pkg-config --cflags --libs ao openssl`
  
  hairtunes: hairtunes.c alac.c
!     gcc hairtunes.c alac.c -lm $(CFLAGS) -o hairtunes
--- 1,7 ----
  CFLAGS = `pkg-config --cflags --libs ao openssl`
+ AO_LIBS = /home/kiwi//openwrt/trunk.26126/build_dir/target-mipsel_uClibc-0.9.32/libao-0.8.8/ipkg-install/usr/lib
+ OPENSSL_LIBS = /home/kiwi//openwrt/trunk.26126/build_dir/target-mipsel_uClibc-0.9.32/openssl-1.0.0d/ipkg-install/usr/lib
+ INCLUDES = /home/kiwi/openwrt/trunk.26126/staging_dir/target-mipsel_uClibc-0.9.32/usr/include
  
  hairtunes: hairtunes.c alac.c
!     mipsel-openwrt-linux-uclibc-gcc hairtunes.c alac.c -lao -lcrypto -L$(AO_LIBS) -L$(OPENSSL_LIBS) -I$(INCLUDES) -lm $(CFLAGS) -o hairtunes

Note the patch contains my personal paths!! AO_LIBS, OPENSSL_LIBS and INCLUDES should be changed!!

Also you will need:
perl
perlbase-essential
perlbase-symbol
perlbase-selectsaver
perlbase-xsloader
perlbase-socket
perlbase-errno
perlbase-config
perlbase-mime
perl-uri
perl-html-tagset
perl-html-parser
perl-www
perlbase-ipc
perl-crypt-openssl-rsa (this one is dodgy)
perlbase-dynaloader
perlbase-autoloader
perlbase-fcntl
perlbase-tie

Hope someone else can make another step!

Thanks,
Gregory Dymarek

Re: shairport on openwrt

You'll need the perl dependencies as well, but good work smile Any small and neat USB soundcards to recommend?

4 (edited by gregd72002 2011-04-13 22:40:06)

Re: shairport on openwrt

You will also need this:
http://pastebin.com/XviLGjBC (perl-crypt-openssl-rsa Makefile)
http://pastebin.com/HQhHXeKC (perl-crypt-openssl-rsa patch)

and it should work...

In my case everything runs smoothly, itunes recognizes speakers and plays to them but no sound comes through...

root@OpenWrt:/usr/bin# /usr/bin/shairport.pl
**************************************
* IO::Socket::INET6 not present!     *
* Install this if iTunes won't play. *
**************************************

listening...
Established under name '006D0221EC20@ShairPort 3711 on '
new connection from 192.168.1.1
REQ: OPTIONS
closed: IO::Socket::INET=GLOB(0xf0c5e8)
new connection from 192.168.1.1
REQ: ANNOUNCE
REQ: SETUP
launched decoder: 3715 on port: 6000
REQ: RECORD
REQ: SET_PARAMETER
REQ: SET_PARAMETER

Thanks,
Gregory Dymarek

5 (edited by gregd72002 2011-04-14 12:15:36)

Re: shairport on openwrt

Looking at the perl script, it should not be difficult to rewrite it in pure C ... what would knock out all the perl stuff/dependencies...

Maybe someone is up for a challenge?

Or actually... doing it in BASH/SH?

6 (edited by jtonk 2011-04-14 13:58:04)

Re: shairport on openwrt

nice to see some interest on this subject smile like I said, I'm not up to the job to get this thing going, but I support you all!!!

the development of shairport moved to github.com

https://github.com/albertz/shairport

version 0.05 is released, with better error handling.

regards

Jasper

7 (edited by gregd72002 2011-04-14 23:12:16)

Re: shairport on openwrt

It looks like libao is outdated... (v. 0.8..) and hairtunes does not work with it at all...
Below libao Makefile (v. 1.1.0). One step closer but still not able to hear anything...

libao/Makefile (ver. 1.1.0)

#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=libao
PKG_VERSION:=1.1.0
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://downloads.xiph.org/releases/ao/
PKG_MD5SUM:=2b2508c29bc97e4dc218fa162cf883c8

PKG_FIXUP:=libtool
PKG_INSTALL:=1

include $(INCLUDE_DIR)/package.mk

define Package/libao
  SECTION:=libs
  DEPENDS:=+alsa-lib
  CATEGORY:=Libraries
  TITLE:=A cross platform audio library
  URL:=http://www.xiph.org/ao/
endef

define Package/libao/description
    Libao is a cross-platform audio library that allows programs to
    output audio using a simple API on a wide variety of platforms.
endef

CONFIGURE_ARGS += \
    --enable-shared \
    --enable-static \
    --disable-esd \
    --disable-arts \
    --disable-nas \
    --disable-pulse

TARGET_CFLAGS += $(FPIC)

define Build/InstallDev
    $(INSTALL_DIR) $(1)/usr/include
    $(CP) $(PKG_INSTALL_DIR)/usr/include/ao $(1)/usr/include/
    $(INSTALL_DIR) $(1)/usr/lib
    $(CP) $(PKG_INSTALL_DIR)/usr/lib/libao.{a,so*} $(1)/usr/lib/
    $(INSTALL_DIR) $(1)/usr/lib/ao/plugins-4
    $(CP) $(PKG_INSTALL_DIR)/usr/lib/ao/plugins-4/*.so $(1)/usr/lib/ao/plugins-4/
    $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
    $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/ao.pc $(1)/usr/lib/pkgconfig/
endef

define Package/libao/install
    $(INSTALL_DIR) $(1)/usr/lib
    $(CP) $(PKG_INSTALL_DIR)/usr/lib/libao.so.* $(1)/usr/lib/
    $(INSTALL_DIR) $(1)/usr/lib/ao/plugins-4
    $(CP) $(PKG_INSTALL_DIR)/usr/lib/ao/plugins-4/*.so $(1)/usr/lib/ao/plugins-4/
endef

$(eval $(call BuildPackage,libao))

P.S. It looks like there are some flows in hairtunes... First of all it looks like my device (asus rt n16) is too slow to decode the stream in real time... second of all it looks like hairtunes has a 'deadlock' issue when it comes to buffering (functions/threads: buffer_put_packet and buffer_get_frame) ... just investigating the issue.

8 (edited by jlars 2011-04-15 17:55:23)

Re: shairport on openwrt

Did you have to manually set the port number somewhere to 6000?

listening...
Established under name '0071EAC6F683@ShairPort 5394'
new connection from 192.168.0.11
REQ: OPTIONS
REQ: ANNOUNCE
REQ: SETUP
sh: /usr/bin/usr/bin/hairtunes: not found
died
Expected port number from decoder; got  at shairport.pl line 336.
died
died

Edit: just noticed my path to hairtunes is botched, guess I should actually read all of the output

9 (edited by gregd72002 2011-04-15 19:10:16)

Re: shairport on openwrt

ok got it working!!! and actually is smooth without any problems!! smile

OK, requirements are as per the pervious post.
I'm running it using alsa (libao.conf)

Details:
Makefile:

# 
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=shairport
PKG_VERSION:=0.05
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://mafipulation.org/static/
PKG_MD5SUM:=8225347a80f1b83e430782a255ff5a32
PKG_BUILD_PARALLEL:=1

include $(INCLUDE_DIR)/package.mk

define Package/shairport
  SECTION:=sound
  CATEGORY:=Sound
  TITLE:=AirPlay speakers
  URL:=http://mafipulation.org/blagoblig  
  DEPENDS:=libao
endef

define Build/Configure
        $(call Build/Configure/Default)
endef

define Build/Compile
    $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
        $(TARGET_CONFIGURE_OPTS) \
        CFLAGS="$(TARGET_CFLAGS)"
    mkdir -p $(PKG_INSTALL_DIR)
endef

define Package/shairport/install
    $(INSTALL_DIR) $(1)/usr/bin
    $(CP) $(PKG_BUILD_DIR)/{hairtunes,shairport.pl} $(1)/usr/bin/
endef

$(eval $(call BuildPackage,shairport))

100-fixes.patch

diff -c shairport-0.05-orig/alac.c shairport-0.05.b/alac.c
*** shairport-0.05-orig/alac.c    2011-04-13 05:38:16.000000000 +0100
--- shairport-0.05.b/alac.c    2011-04-15 18:44:30.000000000 +0100
***************
*** 219,225 ****
      return i;
  }
  #elif defined(__GNUC__)
! static int count_leading_zeros(int input)
  {
      return __builtin_clz(input);
  }
--- 219,225 ----
      return i;
  }
  #elif defined(__GNUC__)
! inline static int count_leading_zeros(int input)
  {
      return __builtin_clz(input);
  }
***************
*** 239,245 ****
      return output;
  }
  #else
! #warning using generic count leading zeroes. You may wish to write one for your CPU / compiler
  static int count_leading_zeros(int input)
  {
      int output = 0;
--- 239,245 ----
      return output;
  }
  #else
! #warning GENERIC using generic count leading zeroes. You may wish to write one for your CPU / compiler
  static int count_leading_zeros(int input)
  {
      int output = 0;
diff -c shairport-0.05-orig/hairtunes.c shairport-0.05.b/hairtunes.c
*** shairport-0.05-orig/hairtunes.c    2011-04-11 15:37:08.000000000 +0100
--- shairport-0.05.b/hairtunes.c    2011-04-15 18:45:52.000000000 +0100
***************
*** 73,79 ****
--- 73,81 ----
  #endif
  
  void rtp_request_resend(seq_t first, seq_t last);
+ int init_rtp(void);
  void init_buffer(void);
+ int init_output(void);
  void ab_resync(void);
  
  // interthread variables
***************
*** 306,313 ****
          abuf->ready = 1;
      }
  
!     if (ab_buffering && buf_fill >= START_FILL)
          pthread_cond_signal(&ab_buffer_ready);
      if (!ab_buffering) {
          // check if the t+10th packet has arrived... last-chance resend
          read = ab_read + 10;
--- 308,317 ----
          abuf->ready = 1;
      }
  
!     if (ab_buffering && buf_fill >= START_FILL) {
          pthread_cond_signal(&ab_buffer_ready);
+         //pthread_mutex_unlock(&ab_mutex);
+     }
      if (!ab_buffering) {
          // check if the t+10th packet has arrived... last-chance resend
          read = ab_read + 10;
***************
*** 414,420 ****
      si.sin6_flowinfo = 0;
  #else
      si.sin_family = AF_INET;
!     si.sin_len = sizeof(si);
      si.sin_addr.s_addr = htonl(INADDR_ANY);
  #endif
  
--- 418,427 ----
      si.sin6_flowinfo = 0;
  #else
      si.sin_family = AF_INET;
!     //si.sin_len = sizeof(si);
!     #ifdef SIN_LEN
!     si.sin_len = sizeof(si);
!     #endif
      si.sin_addr.s_addr = htonl(INADDR_ANY);
  #endif
  
***************
*** 607,612 ****
--- 614,621 ----
              *outptr++ = dithered_vol(*inptr++);
          }
      }
+ 
+     return frame_size + stuff;
  }
  
  void *audio_thread_func(void *arg) {
***************
*** 655,660 ****
--- 664,670 ----
  
          ao_play(dev, (char *)outbuf, play_samples*4);
      }
+     return 0;
  }
  
  int init_output(void) {
***************
*** 673,679 ****
  
      int err;
  #ifdef FANCY_RESAMPLING
!     if (fancy_resampling)
          src = src_new(SRC_SINC_MEDIUM_QUALITY, 2, &err);
      else
          src = 0;
--- 683,689 ----
  
      int err;
  #ifdef FANCY_RESAMPLING
!     if (fancy_resampling) 
          src = src_new(SRC_SINC_MEDIUM_QUALITY, 2, &err);
      else
          src = 0;
***************
*** 681,684 ****
--- 691,695 ----
  
      pthread_t audio_thread;
      pthread_create(&audio_thread, NULL, audio_thread_func, dev);
+ 
  }
diff -c shairport-0.05-orig/Makefile shairport-0.05.b/Makefile
*** shairport-0.05-orig/Makefile    2011-04-13 05:39:59.000000000 +0100
--- shairport-0.05.b/Makefile    2011-04-15 18:50:31.000000000 +0100
***************
*** 1,4 ****
  CFLAGS = `pkg-config --cflags --libs ao openssl`
  
  hairtunes: hairtunes.c alac.c
!     gcc hairtunes.c alac.c -lm $(CFLAGS) -o hairtunes
--- 1,7 ----
  CFLAGS = `pkg-config --cflags --libs ao openssl`
+ AO_LIBS = /home/kiwi//openwrt/trunk.26126/build_dir/target-mipsel_uClibc-0.9.32/libao-0.8.8/ipkg-install/usr/lib
+ OPENSSL_LIBS = /home/kiwi//openwrt/trunk.26126/build_dir/target-mipsel_uClibc-0.9.32/openssl-1.0.0d/ipkg-install/usr/lib
+ INCLUDES = /home/kiwi/openwrt/trunk.26126/staging_dir/target-mipsel_uClibc-0.9.32/usr/include
  
  hairtunes: hairtunes.c alac.c
!     mipsel-openwrt-linux-uclibc-gcc hairtunes.c alac.c -lao -lcrypto -lpthread -L$(AO_LIBS) -L$(OPENSSL_LIBS) -I$(INCLUDES) -lm $(CFLAGS) -O3 -o hairtunes

Please note that the above includes my personal path... needs updated!

Also, it looks with -O3 I'm on around 36-40% CPU utilization. Depending on the actual platform might be useful to edit file alac.c and rewriting function 'count_leading_zeros()'. Once example my be:

static int count_leading_zeros(int input)
{
    int output;
//asm("clz %0, %1" : "=r" (output) : "r" (input));
    __asm
    {
        mov r9, input
        clz r8, r9
        mov output, r8
    }
    return output;
}

Hope this help!
I would really like to see someone to rewrite the whole perl script in a compilable language! This would save a lot of space!

Thanks,
Gregory Dymarek

Re: shairport on openwrt

gregd72002 wrote:

I would really like to see someone to rewrite the whole perl script in a compilable language! This would save a lot of space!

Ditto. Perl, python on routers  it's a no go for me

Re: shairport on openwrt

ratbug wrote:
gregd72002 wrote:

I would really like to see someone to rewrite the whole perl script in a compilable language! This would save a lot of space!

Ditto. Perl, python on routers  it's a no go for me

That's just a initialization script. This could be rewritten in a pure shell or C... Is someone up for the challenge?

Re: shairport on openwrt

Nice work gregd.  I finally have this working now too using the latest source from github with only one small patch to the Makefile.  In my case I get better performance with -O2 or -Os and no patches to the C source files.  -O3 does work well with the "inline" patch to count leading zeros in alac.c, but -O2 and -Os worked best without this patch.  It seems the other improvements are already implemented on github.  I get around 30% cpu usage on an Atheros AR9132 with a 400Mhz cpu.

I placed the output of:

svn diff feeds/packages/{sound/shairport,libs/libao,lang/perl*}

at http://pastebin.com/DknUpn7f.  I believe this captures everything I did to get this working with the exception of downloading a tarball from github then putting an unpacked, renamed, and then repacked tarball on my local webserver.  This is why the source url is now commented in the Makefile. However it should be sufficient just to put a shairport-0.05.tar.gz in the "dl" directory prior to running make.

The revision I used was 2c3206c.

Re: shairport on openwrt

I updated my Makefile to download the source directly from github.  Here is the relevant excerpt:

PKG_NAME:=shairport
PKG_VERSION:=0.05
PKG_RELEASE:=$(PKG_SOURCE_VERSION)

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/albertz/shairport.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=8fbbfad4f49b7d19dccfff5382a688b59a06e290
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz

I also updated the 100-makefile.patch to work with this github version:

--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 PKGFLAGS:=$(shell pkg-config --cflags --libs openssl ao)
-CFLAGS:=-O2 -Wall
-LDFLAGS:=-lm -lpthread
+CFLAGS+=-O2 -Wall
+LDFLAGS+=-lm -lpthread
 
 all: hairtunes

The new svn diff is here: http://pastebin.com/Lh8ae4hx.

The github shairport has added some more perl dependencies.  Here is my current list of all shairport dependencies:

+libopenssl +libao +avahi-daemon +avahi-utils +perl \
+perl-crypt-openssl-rsa +perl-getopt-long \
+perl-http-message +perl-uri \
+perlbase-autoloader +perlbase-config +perlbase-cwd \
+perlbase-digest +perlbase-dynaloader +perlbase-errno \
+perlbase-essential +perlbase-fcntl +perlbase-feature \
+perlbase-file +perlbase-findbin +perlbase-io \
+perlbase-ipc +perlbase-mime +perlbase-posix \
+perlbase-selectsaver +perlbase-socket +perlbase-symbol \
+perlbase-tie +perlbase-xsloader

where perl-crypt-openssl-rsa, perl-getopt-long, and perl-http-message are new packages and libao is updated to 1.1.0.

Let me know if any of these perl dependencies are extraneous.

Re: shairport on openwrt

arokh wrote:

Any small and neat USB soundcards to recommend?

I recently bought the Syba SD-CM-UAUD just to try shairport.  It is a nice size and works fine.  Although I may eventually upgrade to a Turtle Beach Micro II which has an optical digital out.

I also noticed that eBay has some generic ones for <$2 and dealextreme has some for <$3.

Re: shairport on openwrt

What an interesting project for a Seagate DockStar with a Marvell CPU clocked @1.2GHz. When I get some times, I will sure try this. Thanks everyone.

Mazi

Re: shairport on openwrt

Can someone share the builded package for openwrt? I have some troubles with this Makefile on mac os.

Re: shairport on openwrt

gut4 wrote:

Can someone share the builded package for openwrt? I have some troubles with this Makefile on mac os.

I dont think so anyone will... given the amount of information you provided. Anyway, I thought the toolchain is not supposed to work on mac os?
Please install toolchain and then the makefile and you should be fine.

Re: shairport on openwrt

I would love to get this working too, but can somebody give me some pointers on where to start with the toolchain/makefile? There is a lot of information on openwrt, but I find the documentation very fragmented, scattered, obsolete or old.

Can somebody help me? I just need some pointers where to start and what steps to take. Is there a thread/tutorial that you would recommend to read?

tnx

Jasper

Re: shairport on openwrt

jtonk wrote:

Can somebody help me? I just need some pointers where to start and what steps to take. Is there a thread/tutorial that you would recommend to read?

There are tons of invaluable information here that you can peruse.

Mazi

Re: shairport on openwrt

Here is a brief summary of the steps:

1) Have a linux "host" system (dedicated or VM)
2) Install all prerequisites for OpenWrt build environment (refer to wiki) 
3) Create a base directory and do an svn checkout of openwrt
  a) mkdir ~/openwrt && cd ~/openwrt
  b) svn co svn://svn.openwrt.org/openwrt/trunk/
  c) cd trunk
4) Update package feeds, download, patch, and install shaiport package
  a) ./scripts/feeds update -a
  b) wget -O shairport.patch http://pastebin.com/raw.php?i=Lh8ae4hx
  c) echo "" >> shairport.patch
  d) patch -p0 < shairport.patch
  e) ./scripts/feeds update -a
  f) ./scripts/feeds install shairport
5) Generate the initial configuration and confirm build environment prerequisites
  a) make defconfig
  b) Repeat a) and install any missing host packages until there are no errors on "make defconfig"
6) Select your target and add shairport to your build configuration
  a) make menuconfig
  b) Select appropriate "Target system", e.g. Atheros AR71xx/AR......
  c) Select appropriate "Target Profile", e.g. Buffalo WZR-HP-G30XNH
  d) Select Sound --> shairport (highlight shairport and press "m" to build shairport as a package)
  e) Exit and save configuration
7) Build image and packages
  a) make
  b) If you encounter an error rerun with "make V=99" for verbose output
  c) After a successful build images and packages will be under ~/openwrt/trunk/bin

This is mostly from memory so be sure to read the wiki for full details and better understanding of what is going on.  Essential reading:

http://wiki.openwrt.org/doc/howto/buildroot.exigence
http://wiki.openwrt.org/doc/howto/build
https://dev.openwrt.org/wiki/GetSource

Re: shairport on openwrt

part 4 was the part I couldn't find out myself. TNX!!!

I'll post my results as soon as possible...

regards Jasper

Re: shairport on openwrt

Thanks a lot for the detailed instructions. Now it is running nicely on my nslu2 smile

Re: shairport on openwrt

The instructions are perfect, I also got it working on my asus wl500gp, but the audio quality is not so good. This probable has to do with the usb sound card...
although I do get this error message:

ERROR: Failed to load plugin /usr/lib/ao/plugins-4/libalsa.so => dlopen() failed

alsa-lib is installed, any idea's?

Re: shairport on openwrt

jtonk wrote:

ERROR: Failed to load plugin /usr/lib/ao/plugins-4/libalsa.so => dlopen() failed

alsa-lib is installed, any idea's?

This plugin is from the updated libao (1.1.0) which should have been packaged in the build with shairport.  Can you confirm that you have 1.1.0 installed and that it includes libalsa.so (opkg files libalsa)?

Thanks

25 (edited by jtonk 2011-04-23 12:18:40)

Re: shairport on openwrt

root@OpenWrt:/# opkg files libao
Package libao (1.1.0-1) is installed on root and has the following files:
/usr/lib/libao.so.4
/usr/lib/ao/plugins-4/libalsa.so
/usr/lib/libao.so.4.0.0
/usr/lib/ao/plugins-4/liboss.so
root@OpenWrt:/#

I found out librt was not installed when I tried alsamixer. Message didn't come back since.

Audio quality is still bad, now I am sure that is the hardware, but I couldn't solve that in the past when I gave MPD a try

ao_alsa WARNING: sample rate 44100 not supported by the hardware, using 48000

I see this messages come by when I start the audio. the difference in sample rate could be the reason for the bad audio quality (cracks, noise, loud, no volume control).

my usb audio hardware is a TP6911:

root@OpenWrt:/# lsusb
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 1130:f211 Tenx Technology, Inc. TP6911 Audio Headset

Any ideas, or should I switch to C-media usb audio?

EDIT: definitely is the hardware. music goes faster at a higher pitch