sound - vanaware/openwrt GitHub Wiki

Sound on openwrt

Install USB packages

opkg update
opkg install kmod-usb-uhci kmod-usb-ohci kmod-usb2 kmod-usb3
opkg install kmod-usb-audio kmod-sound-core 
#opkg install usbutils

Install USB packages

opkg install alsa-lib libsndfile alsa-utils

Generic Alsa init and listinings

cat /proc/asound/cards
alsactl init
amixer contents
aplay -l

Install Music Server and player

opkg install mpd-full mpc lame-lib youtube-dl

Configure Music Player Daemon

mkdir -p /mnt/data/media/Music
mkdir -p /mnt/data/mpd
nano /etc/mpd.conf

music_directory         "/mnt/data/media/Music"
playlist_directory              "/mnt/data/mpd/playlists"
db_file                 "/mnt/data/mpd/database"
log_file                        "/mnt/data/mpd/log"
pid_file                        "/var/run/mpd.pid"
state_file                      "/mnt/data/mpd/state"
sticker_file                    "/mnt/data/mpd/sticker.sql"
zeroconf_enabled                "yes"
zeroconf_name                   "OpenWrt15 Music Player"
password                        "12345678@read,add,control,admin"
default_permissions             "read,add,control,admin"

audio_output {
        type            "alsa"
        name            "My ALSA Device"
#       device          "hw:0,0"        # optional
#       mixer_type      "hardware"      # optional
#       mixer_device    "default"       # optional
#       mixer_control   "PCM"           # optional
#       mixer_index     "0"             # optional
}
# 
# An example of an OSS output:
# 
audio_output {
        type            "oss"
        name            "My OSS Device"
#       device          "/dev/dsp"      # optional
#       mixer_type      "hardware"      # optional
#       mixer_device    "/dev/mixer"    # optional
#       mixer_control   "PCM"           # optional
}
audio_output {
        type            "httpd"
        name            "My HTTP Stream"
        encoder         "wave"                # optional, vorbis or lame
        port            "8000"
        bind_to_address "0.0.0.0"               # optional, IPv4 or IPv6
#       quality         "5.0"                   # do not define if bitrate is defined
        bitrate         "128"                   # do not define if quality is defined
        format          "44100:16:1"
        max_clients     "0"                     # optional 0=no limit
}


Play

mpd
mpc
mpc add http://relay3.slayradio.org:8000/
mpc del 1
MPD_HOST=12345678@localhost mpc add http://186.227.162.66:9300/stream
youtube-dl -U
mpc add $(youtube-dl --prefer-insecure -g -f171 Us-TVg40ExM)
mpc play
mpc volume 30
mpc current
mpc stop
mpc outputs

Android Client

M.A.L.P. : https://github.com/gateship-one/malp
MPDroid : https://github.com/abarisain/dmix