Audio System

From Whitespace (Hackerspace Gent)
Revision as of 19:56, 13 February 2011 by Steamrunner (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 (at the moment only one speaker connected to it)


  • 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
    • 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.



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. After 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.


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

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"

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. 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.

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 right are set up properly.

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 * * 4,5   whitespace DISPLAY=:0.0 /usr/bin/vlc -I dummy --play-and-exit --vout null 
Doctor Who (recent) (80's)


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