Tag Archives: MPD

Audiophile wireless headphones for free

Here’s a neat idea. MPD (Music Player Daemon) has added opus streaming support. Opus allows absolutely excellent quality audio to be compressed down to a stream size that would be considered “low quality” for mp3. BSPlayer for Android has the ability to play opus streams. I compiled and installed the latest version of MPD on my internet facing workstation, disabled remote access to mpd control, and created a http opus stream for output. With a Mpd client on my workstation to control the music playing, and BSPlayer connected to the http stream, I have nearly CD quality audio on my wired headphones (connected to my Android phone), playing music from (and controlled by) my desktop. Yeah, it’s not really wireless, but it’s a lot easier to slip a phone into my pocket and walk away than it is to do that with my desktop computer. The neat thing, is, the “range” of my “wireless headphones” is basically infinite as it goes over the internet.

Configuration notes:

  • Opus-tools and opus-tools-dev are installed so that mpd is compiled with opus streaming support.
  • libsamplerate dev package needs to be installed so it can be used for sample converting between 44.1 (CD audio) and 48Khz (soundcard audio). Without it, sound quality was terrible, with aliasing and artifacts.
  • be sure to check the output when running ./configure. Things with a “-” sign rather than a “+” sign are not being compiled in due to lack of dev packages.
  • Point BSPlayer to http://machine_address:8000 and ensure that the network buffer (in settings) is on high.

Here are the necessary config lines from mpd.conf:

# Only allow mpd control connections on local machine (or SSH tunnel)
bind_to_address "localhost"

# Opus http output (In my own testing, I cannot tell 128kb opus from CD audio, on 96kb,
#                 I could hear slight distortion on complex music (orchestral strings especially)
audio_output {
        type            "httpd"
        name            "Opus shout stream"
        encoder        "opus" 
        port        "8000"
#       bind_to_address    "0.0.0.0"        # optional, IPv4 or IPv6
#       quality        "5.0"            # do not define if bitrate is defined
        bitrate        "128000"            # do not define if quality is defined
#       format   "48000:16:2" #Disable to use input file format
        max_clients    "2"            # optional 0=no limit
}

# Use a very good algorithm to convert CD audio to Soundcard audio sample rates. 
# See mpd.conf man page
samplerate_converter        "0" # MPD's best, most CPU intensive algorithm.

Leave a comment

Filed under Science and Skepticism