Difference between revisions of "Audio System"

From Whitespace (Hackerspace Gent)
Jump to: navigation, search
(MPD sound Menu)
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{Project
 
{{Project
 
|Current=Yes
 
|Current=Yes
|Participants=Koen
+
|Participants=Koen,Jaroslov
 
|Locations=Whitespace
 
|Locations=Whitespace
 
|Events=Audio system hacking,
 
|Events=Audio system hacking,
 
|Short description=Creating a network controlled integrated music system for the entire space.
 
|Short description=Creating a network controlled integrated music system for the entire space.
 
}}
 
}}
 
 
==Current Configuration==
 
==Current Configuration==
 
* Two channel amplifier placed in the rack
 
* Two channel amplifier placed in the rack
Line 22: Line 21:
 
*** Make sure at least one zone is selected (A = Front room / B = Back room)
 
*** 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 ;-))
 
*** Make sure the volume isn't all the way turned down (or up ;-))
*** Select VIDEO/AUX
+
*** Select VIDEO/AUX (label: 'MPD')
 
** Boot the Audio server
 
** Boot the Audio server
 
** Use any MPD client you like to connect to audio:6600
 
** Use any MPD client you like to connect to audio:6600
Line 30: Line 29:
 
*** Make sure at least one zone is selected (A = Front room / B = Back room)
 
*** 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 ;-))
 
*** Make sure the volume isn't all the way turned down (or up ;-))
*** Select CD
+
*** Select CD (label: 'JACK')
 
** Connect audio source to analog line in the main room and turn it on
 
** Connect audio source to analog line in the main room and turn it on
 
* Playing plain old FM radio
 
* Playing plain old FM radio
Line 80: Line 79:
  
 
==Software:==
 
==Software:==
This configuration was made on (K)Ubuntu 10.10.
+
This configuration was made original on (K)Ubuntu 10.10, now (K)Ubuntu 11.04.
 
===Jack===
 
===Jack===
 
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.
 
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.
Line 86: Line 85:
 
===Pulseaudio===
 
===Pulseaudio===
 
==== Ubuntu 11.04 ====
 
==== Ubuntu 11.04 ====
PulseAudio does not recommend running it system wide ([http://www.pulseaudio.org/wiki/WhatIsWrongWithSystemMode link]). So from now on we run everything audio related as the whitespace user. This will user will autologin and start mpd/xbmc,...).
+
PulseAudio does not recommend running it system wide ([http://www.pulseaudio.org/wiki/WhatIsWrongWithSystemMode 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:
 
Enable auto-login under Gnome/GDM:
Line 111: Line 110:
 
===MPD Server===
 
===MPD Server===
 
==== Ubuntu 11.04 ====
 
==== Ubuntu 11.04 ====
As PulseAudio runs per user, we will let user mpd (and everything else audio related) run under whitespace account.
+
As PulseAudio runs per user, we will let mpd (and everything else audio related) run under whitespace account.
 
References:
 
References:
 
* http://gmpc.wikia.com/wiki/MPD_INSTALL_USER_SERVICE_UBUNTU
 
* http://gmpc.wikia.com/wiki/MPD_INSTALL_USER_SERVICE_UBUNTU
Line 216: Line 215:
 
* System -> Preferences -> Startup Applications
 
* System -> Preferences -> Startup Applications
 
** Add -> Name: xbmc / Command: xbmc
 
** Add -> Name: xbmc / Command: xbmc
 
+
====XBMC clients====
Clients:
+
 
* Android: 'xbmc remote'
 
* Android: 'xbmc remote'
* Webinterface: work in process
+
* Webinterface: http://audio:8080/ , work in process
 +
* The console of the server(whitespace session): VNC , work in process
 +
* http://lifehacker.com/5501010/enhance-your-xbmc-experience-with-remote-controls-for-any-device
  
 
===MPD sound Menu===
 
===MPD sound Menu===

Latest revision as of 22:00, 5 November 2011


Audio System
WhitespaceLogo.gif
What:
Creating a network controlled integrated music system for the entire space.
Participants:
Koen, Jaroslov
Locations:
Whitespace
Events:
Audio system hacking
Cornify

Current Configuration[edit]

  • 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

Usage[edit]

Hey-turn-music-down.jpg
  • 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 (label: 'MPD')
    • 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: 'JACK')
    • 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

Ideas:[edit]

  • 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

Hardware:[edit]

What we have available[edit]

  • 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[edit]

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

Todo[edit]

  • 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

Optional[edit]

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

Software:[edit]

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

Jack[edit]

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.

Pulseaudio[edit]

Ubuntu 11.04[edit]

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[edit]

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:

PULSEAUDIO_SYSTEM_START=1

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[edit]

Ubuntu 11.04[edit]

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
START_MPD=false

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[edit]

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[edit]

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[edit]

MPD sound Menu[edit]

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.

djmount[edit]

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[edit]

Mediatomb[edit]

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

uShare[edit]

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[edit]

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

Cross-platform[edit]

Linux[edit]

  • 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

Windows[edit]

Mac OS X[edit]

iPhone[edit]

Android[edit]

Web client[edit]

Ampache (No longer active)[edit]

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

MPDplayer[edit]

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 http://www.renedegroot.nl/mpd.xml. 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[edit]

Playing Airwolf[edit]

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  http://www.youtube.com/watch?v=nr_CJL1YQRc

with additions for running in crontab

DISPLAY=:0.0 /usr/bin/vlc -I dummy --play-and-exit --vout null  http://www.youtube.com/watch?v=nr_CJL1YQRc

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  http://www.youtube.com/watch?v=nr_CJL1YQRc

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  http://www.youtube.com/watch?v=nr_CJL1YQRc 
Youtube VLC issue[edit]

After Youtube did an update to their service the implementation explained above stopped working. A solution was found here: http://forum.videolan.org/viewtopic.php?f=2&t=89164. 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 http://outbreakmonkey.org/downloads/youtubelua.zip
sudo unzip youtubelua.zip

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

Doctor Who[edit]
http://www.youtube.com/watch?v=2CYDgezeQas (recent)
http://www.youtube.com/watch?v=L0TEmJEjUSY (80's)

Links[edit]

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