my minb

Categories


RSS 2.0 Feed

Links

Sound over Network


For some years now we have a multiseat system based on Ubuntu (since it was initially very easy to set on). Moving to a new apartment made us think about how to place the furniture and most important the working desk (with the two workstations) as well as the speaker boxes. Until now the (Class A, SET vacuum tube) amplifier and the (also vacuum tube) DAC were on the desk with the speaker boxes placed on the two sides of the working table.
However, in the new apartment we decided to place the working desk in a corner. This brought up the question where to place the speakers. We decided to put them on a remote wall of the room. The problem was now how to control the sound from the common machine (client).

This was possible by using a laptop which we have for years and did not use in the recent time. The connection is: external USB HD (to store the high volume files) -> ThinkPad-X40 (server) -> DAC -> amplifier -> speakers.
Two problems had to be solved with this setting. Playing the sound be controllable by any of the workstations on the client and playing occasional sound from other sources (e.g. youtube) should be possible.

Ubuntu uses Pulseaudio as default sound server for several releases now. I always complained about it and tried to remove it on many occasions (having used Xubuntu for a while for that reason only) since it behaved initially horrible esp. in the multiseat setting. Well, the time came to use a functionality Pulseaudio is so proud of: sound over network.

Pulseaudio provides a Network Setup Documentation which was useful in this case. The only change on the client was editing /etc/pulse/client.conf and setting:

default-server = 192.168.1.5
The IP is obviously the one assigned to the server. This tells Pulseaudio to send the sound to the server rather than trying to play it locally on the client.
The Pulseaudio on the server required adding the following lines to the file /etc/pulse/default.pa:
load-module module-esound-protocol-tcp auth-anonymous=1
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.1.0/16
This allows access to the Pulseaudio on the server from any machine of the network 192.168.1.0/16 as well as local (127.0.0.1).

That was it!
The "Output" tab on the Sound Preferences of the client listed the output devices of the server (built-in sound card and USB-DAC) ignoring the own built-in sound card.

Playing large files over the network (esp. 24bit/96kHz) was not possible without breaks and this is the reason we decided to place the files on a drive connected to the server. The next problem in this setting was to make playing audio remotely controllable.
I decided to use mpd for this purpose as it is widely supported and has more than enough clients. Two things had to be considered here: setting the appropriate directories and files for mpd to work and making it not fight with Pulseaudio on the server.
Installing mpd on Ubuntu makes it autostart by default as a system daemon and does not require any other action in this case. The default configuration file of mpd should be edited like this (just listing the changes I made):

music_directory         "/path/to/audio/files"
playlist_directory      "/home/user/.mpd/playlists"
db_file                 "/home/user/.mpd/mpd.db"
bind_to_address         "any"
audio_output {
        type            "pulse"
        name            "MPD Pulse Output"
}
The first 3 variables have arbitrary values. I set bind_to_address to "any" because otherwise mpd complained for unknown reason that the port (default is 6600) is already in use. The audio_output was set (just uncommented) to "pulse" and I commented out everything else (the default one is ALSA).

The only issue I have until now is the slow update of the mpd-database when new files are added to the directory set in the config file. Everything else works nicely and the audio (incl. volume level) is now controllable from both our Android phones as well as from our iPad which is very convenient.
Written by betso on 10/30/2011, 12:00am in"Technology"

Post a Comment

Name (required field!)

Are you a human? Please answer the following:8 times 1 is

(Your email address will never be published nor shared.)

Email (required field!)

Website: 


HTML is not allowed!


Optimized for: Firefox and Google Chrome!    |    Powered by a custom CMS named "minb-zer0", the zero calories CMS!    |    HTML5 and CSS3 valid code as of the last check by W3C.