User Tools

Site Tools


doc:howto:usb.audio

USB Audio Support

As long as you have the necessary hardware connected, OpenWrt can play audio, as can any other GNU/Linux distribution. Any USB Audio device supported by GNU/Linux should work with OpenWrt as well. But, because of it's lightbuild structure OpenWrt does not come with audio support. You have to install that afterwards. If you are new with Linux, you should read the Notes.

Preparations

Prerequisites

  1. utilize a USB sound card with GNU/Linux support, see the Notes on that
  2. »You must have enabled the ALSA support in the kernel«
  3. install the packages kmod-usb-audio and kmod-sound-core for Kernel audio support and ALSA drivers
  4. plug the USB sound card of your choice into the USB port of your OpenWrt router

Required Packages

Server (OpenWrt)

Name Size Description
Required
kmod-usb-audio 51909 Kernel support for USB audio devices
kmod-sound-core 135315 Kernel modules for sound support
Optional
kmod-sound-cs5535audio 56695 support for the integrated AC97 sound device on olpc
kmod-sound-i8x0 66521 Support for the integrated AC97 sound device on motherboards with Intel/SiS/nVidia/AMD chipsets, or ALi chipsets using the M5455 Audio Controller.
kmod-sound-soc-core 25290 SoC sound support
usbutils 186470 package includes 'lsusb', if you want to check your usb-device is properly detected

Configuration

There is nothing much to configure, but if you need to, you could use the package alsa-utils to do that.

Alternative

Applications

Once your sound card is up and running, you need some programs to play the sound:

Name Version Dependencies Size Description
madplay 0.15.2b-3 libid3tag libmad 34047 MAD is an MPEG audio decoder. It currently only supports the MPEG 1 standard, but fully implements all three audio layers (Layer I, Layer II, and Layer III, the latter often colloquially known as MP3.). There is also full support for ID3 tags.
mpd 0.15.8-6 alsa-lib, libaudiofile, libfaad2, libmad, glib2, libcurl, libflac, libmms, libpthread, libshout, libvorbis, libvorbisidec, libid3tag 114565 MPD is a music player supporting flac, mp3 and ogg files. It is typically controlled over a network using one of it's many clients including mpc(console), gmpc(gnome), phpmp(php), etc…
sox 14.0.1-3 lame-lib, libmad, libid3tag, libvorbis, libvorbisidec, libgsm 202816 SoX is a command line utility that can convert various formats of computer audio files in to other formats. It can also apply various effects to these sound files during the conversion. As an added bonus, SoX can play and record audio files on several unix-style platforms.

MPD

MPD (Music Player Daemon) is a small music player with support for FLAC, MP3 and OGG files. It is a daemon process which is typically controlled by a client such as gmpc running on another desktop machine. For more information: http://mpd.wikia.com

MPD is configured in the file /etc/mpd.conf. The default config file probably won't work as-is, but it should have enough comments to be edited easily. The MPD package does not currently contain a script to start MPD at boot. Check other HowTos to easily write one.

Madplay

In combination with wget it can act as an Internet radio. Find some MP3 stream and try something like:

wget -O - http://64.236.34.97:80/stream/1014 | madplay -

Sox

sox -q $1 -t ossdsp /dev/sound/dsp

PulseAudio

LIRC

If your USB sound card has a microphone input, you can use it to connect an infrared receiver module, and use any remote to send commands to the router.

Troubleshooting

Generic Alsa init:

alsactl init
Required for AC97 Sound in Virtual Box.

Unmute sound with:

amixer sset Master unmute

Test sounds with:

speaker-test -Dplug:front -c2 -tsine -f440
speaker-test -Dplug:front -c2 -twav -f440

Notes

Buy an USB sound card with excellent Linux support. It does not have to be expensive, but it's Linux drivers need to be mature and stable. You do not want some basic drivers, you want the best FOSS drivers available. You find help here:

  • ALSA ← this Wiki needs some major overhaul
  • The safest bet is to have some really competent friends, tell you which drivers are fully developed and exhaust the hardware.
doc/howto/usb.audio.txt · Last modified: 2014/01/06 14:52 by saraedum