Audio System

From Whitespace (Hackerspace Gent)
Revision as of 01:23, 18 June 2011 by Jaroslov (Talk | contribs)

Jump to: navigation, search

Audio System
Creating a network controlled integrated music system for the entire space.
Audio system hacking

Current Configuration

  • Two channel amplifier placed in the rack
  • Stereo also placed in rack connected to TUNER input
  • Extra analog audio line from main room to amplifier connected (CD input)
  • PC connected to VIDEO/AUX input, see Software section below for more info
  • Small stereo used as rear amplifier


  • Playing files/web-streams:
    • Power-up the main amplifier
      • Make sure at least one zone is selected (A = Front room / B = Back room)
      • Make sure the volume isn't all the way turned down (or up ;-))
      • Select VIDEO/AUX
    • Boot the Audio server
    • Use any MPD client you like to connect to audio:6600
    • note there is now a playlist provided which has the streams for a selection of popular Belgian radio stations.
  • Playing audio from another laptop/music player
    • Power-up the main amplifier
      • Make sure at least one zone is selected (A = Front room / B = Back room)
      • Make sure the volume isn't all the way turned down (or up ;-))
      • Select CD (label: 'MPD')
    • Connect audio source to analog line in the main room and turn it on
  • Playing plain old FM radio
    • Power-up the main amplifier
      • Make sure at least one zone is selected (A = Front room / B = Back room)
      • Make sure the volume isn't all the way turned down (or up ;-))
      • Select TUNER
    • Power-up the stereo and use it as before
    • note volume is controlled by amplifier


  • Fixed amp sound level at max we'll allow
  • Volume controlled with software
  • Software: The silent guy, MPD, Play Airwolf at due time --> combined using Jack (some people suggest pulseaudio can also be used for this purpose)
  • FM? Transmitter of receiver?
  • Make all use cases configurable via the network, proposed solutions:
    • Hack the main amplifier
    • Hack the main amplifiers remote
    • Do a full software solution
      • connect extra audio line to the PC's line-in
      • use a analog capture card to get FM input, and make these streams configurable by MPD (The Medion used as table-PC seems to have a capture card)
  • use djmount to automatically mount uPNP shares enabling easy access to media files on other devices


What we have available

  • A two channel amplifier. (Bert)
  • Two big speakers (Bert)
  • An average sized stereo (Kurt)
  • A small stereo (Impy)
  • A desktop with surround sound-card (Tom)
  • Jack to cinch cables
  • Cinch to cinch cables

Thanks to all who have contributed hardware!

What we need

  • The small stereo currently used as aft amplifier could use an update.


  • Hang all speakers
  • Connect all speakers to there amplifiers (Only one left todo, rear left)
  • Rack mount the amplifier
  • Connect the amplifiers to the PC
  • Give the Audio System a fixed IP


  • Figure out what the s-control port does on the main amplifier.
  • Make the amplifier for the aft speakers powered only when music is played in that room.


This configuration was made original on (K)Ubuntu 10.10, now (K)Ubuntu 11.04.


We will try to use Jack to make smooth combination of the audio sources. Jack was installed from the repositories. It's currently working however audio quality is horrible and now unusable. Some further investigation led me to the conclusion that Pulse-audio can also be used for this purpose. Since Pulse-audio is the default sound back-end for Ubuntu these days that option has proven to be easier to implement.


Ubuntu 11.04

PulseAudio does not recommend running it system wide (link). So from now on we run everything audio related as the whitespace user. This will user will autologin and start mpd,xbmc,...

Enable auto-login under Gnome/GDM:

  • System -> Administration -> Login Screen
    • "Log in as" 'whitespace'

No further changes are needed.

Ubuntu 10.10

In Ubuntu 10.10 Pulse-audio is normally started on a per user basis when you log in to you gnome session. As we would like to run MPD even if nobody is logged in we also need to run Pulse-audio system-wide. This can easily be done by putting the following line in /etc/default/pulseaudio:


Now we can start Pulse-audio system-wide:

sudo killall pulseaudio
sudo /etc/init.d/pulseaudio start

After this only users in the pulse-access group can use the audio device. So we need to add both our regular user and the user running MPD (default mpd) to this group. This can be done using the following command:

sudo usermod -a -G pulse-access whitespace

MPD Server

Ubuntu 11.04

As PulseAudio runs per user, we will let mpd (and everything else audio related) run under whitespace account. References:

Install mpd and disable automatic startup:

$ sudo apt-get install mpd
$ /etc/init.d/mpd stop
$ sudo update-rc.d mpd disable
$ sudo vi /etc/default/mpd

Create config files:

$ sudo cp /etc/mpd.conf /home/whitespace/.mpdconf
$ sudo mkdir -p /home/whitespace/.mpd/playlists
$ sudo chown -R whitespace /home/whitespace/.mpdconf /home/whitespace/.mpd/
$ vi /home/whitespace/.mpdconf
music_directory         "/var/lib/mpd/music"
playlist_directory      "~/.mpd/playlists"
db_file                 "~/.mpd/tag_cache"
log_file                "~/.mpd/mpd.log"
pid_file                "~/.mpd/pid"
state_file              "~/.mpd/state"
# COMMENT the user section:
#user                   "mpd"

# enable mpd to control Master volume:
audio_output {
        type            "alsa"
        name            "MPD"
        device          "pulse"
        mixer_control   "Master"
# enable mpd to use PulseAudio:
audio_output {
        type            "pulse"
        name            "My Pulse Output"

Now you should be able to run mpd:

$ su - whitespace
$ mpd

Enable automatic startup at gnome-startup:

  • System -> Administration -> Login Screen
    • "Log in as" 'whitespace'
  • System -> Preferences -> Startup Applications
    • Add -> Name: mpd / Command: mpd

Ubuntu 10.10

MPD or Music player Deamon. Installed from repositories. By default MPD is configured to run system wide and use Alsa as a sound back-end. Because we want to blend several audio streams together we cannot use Alsa but Pulse-audio. To make MPD use Pulse-audio the Alsa section in /etc/mpd.conf needs to be commented out and the Pulse-Audio section needs to be uncommented.

#audio_output {
#	type		"alsa"
#	name		"My ALSA Device"
#	device		"hw:0,0"	# optional
#	format		"44100:16:2"	# optional
#	mixer_device	"default"	# optional
#	mixer_control	"PCM"		# optional
#	mixer_index	"0"		# optional

audio_output {
	type		"pulse"
	name		"My Pulse Output"
#	server		"remote_server"		# optional
#	sink		"remote_server_sink"	# optional

After this we can restart MPD.

sudo /etc/init.d/mpd restart

To make MPD control not only it's own volume but the machines master volume we must change the Alsa audio_output type again to the following:

audio_output {
	type		"alsa"
	name		"My ALSA Device"
	device		"pulse"		# optional
#	format		"44100:16:2"	# optional
#	mixer_device	"default"	# optional
	mixer_control	"Master"	# optional
#	mixer_index	"0"		# optional

Make sure these things are all commented out:

#mixer_type		"hardware"
#mixer_type		"software"
#mixer_type		"disabled"

Then restart Pulse-audio and MPD again. note For some reason my volume was muted after this step.

To make MPD accessible from every PC on the local network make sure the following line is in you mpd.conf.

bind_to_address         "any"


XBMC is 'xbox media centre', a media server. Is used to watch videos on the beamer. The beamer is connected to the audio server. Gnome auto-logins and starts xbmc.

  • System -> Preferences -> Startup Applications
    • Add -> Name: xbmc / Command: xbmc

XBMC clients

  • Android: 'xbmc remote'
  • Webinterface: work in process

MPD sound Menu

To allow the locally logged in user on the audio server easy control over the MPD daemon we installed mpd-sound-menu. This a small applet for the Gnome sound menu in the top menu bar. Installation instructions:

sudo add-apt-repository ppa:torkvemada/torkvemada
sudo apt-get update
sudo apt-get install mpd-sound-menu

This application was configured to automatically start when the user whitespace logs in.


We will use djmount to make all UPNP shares on the local network available to MPD. Like most software djmount can be installed straight from the repositories. The next commands allow you to mount and umount all UPNP servers on your network.

sudo djmount -o allow_other /var/lib/mpd/music
sudo fusermount -u /var/lib/mpd/music

To start djmount automatically every time the system is booted the following needs to be added to the /etc/rc.local file.

djmount -o allow_other /var/lib/mpd/music

UPNP Servers


This server is used on Polaris. To learn how to configure it out see here.


If you quickly want to share your music in the space w/o setting up a lot, install ushare (apt-get install ushare || yum install ushare) and do a

ushare -c /some/directory/with/music -i wlan0/eth0/whatever -n $HOSTNAME

The last parameter gives your server a unique name and it will show up in the djmount. In case you use a packet filter, please open UPNP, while you are sharing your music. That's all.

MPD Clients

There are a wide range of MPD clients available for a wide range of platforms. Feel free to add you experiences here:



  • Ario (has avahi a.k.a zeroconf support and finds the server automatically)
  • GMPC
  • Sonata
  • MPC (CLI) usage mpc --host=audio --port=6600 (play/stop/toggle/pause/next/prev/volume +xx/-xx/xx)
  • Xfmpc


Mac OS X



Web client

Ampache (No longer active)

A web interface to stream one's media library and control an MPD server. The debian install package seems to have a bug so it is necessary to create an extra symlink before configuration can begin. This web interface is available at http://audio/ampache. Try it using user root and password ****** (the one we often use)

Ampache requires a MySQL database. It was installed from repositories with as root password the one we use too often. The ampache user in the MySQL db is ampache, the password is """"


A very simple and straight forward PHP application. Make sure Apache, PHP and the Apache PHP module are all installed properly. Download the tar file from this site Then all you have to do is untar it to your www directory and make sure user rights are set up properly. When you're in the space you can access it by simple visiting http://audio.

Silent Guy

Playing Airwolf

The Airwolf theme should be played on midnight Thursday and Friday. The file will come straight from YouTube, so we are not storing copyrighted information on our server. Play Airwolf from command line straight from YouTube ignoring video:

vlc -I dummy --vout null

with additions for running in crontab

DISPLAY=:0.0 /usr/bin/vlc -I dummy --play-and-exit --vout null

full crontab line for now (still running more frequent to allow testing):

*/2 * * * * DISPLAY=:0.0 /usr/bin/vlc -I dummy --play-and-exit --vout null

finally use this line in /etc/crontab do NOT use sudo crontab -e. I thought this had the same effect but it doesn't.

0 0 * * 5,6   whitespace DISPLAY=:0.0 /usr/bin/vlc -I dummy --play-and-exit --vout null 
Youtube VLC issue

After Youtube did an update to their service the implementation explained above stopped working. A solution was found here: There are two possibilities explained. The approach using the compiled version of the .lua file failed on my configuration.

cd /usr/lib/vlc/lua/playlist
sudo mv youtube.luac youtube.luac.backup
sudo wget
sudo unzip

After executing these commands the code mentioned in the Airwolf section above worked again.

Doctor Who (recent) (80's)


A list of some links that where useful setting up this system: