Need help with audio distribution through jack


I’m a newbie to linux audio and jack and maybe my question is a stupid one but I’m confused now and don’t know where to start with. I’m very appreciated if anyone take some precious time to have a look and help me. Thanks in advance.

Currently I have jackd (0.118.0) installed on two machine running ubuntu (10.04). The goal is to make one machine a master one and it’ll distribute the sound synchronously to multiple slaves (each slave should be in separated rooms and the sound will be output to the speakers connected to them).

What I has come until now is that I can connect the master and slave using the jack_netsource command. On slave I use
jackd -R -d net
and on master I startup jackd with alsa backend and use: jack_netsource -H (IP of the slave). On the master it say connected

I tried to play a music(mp3) on master machine through vlc (or audacious) and connect the vlc output port (out_1 and out_2) to the netjack -playback port (playback_1 and playback_2) but I get no sound output on slave (don’t hear anything from the speakers). The connections showing on the slave machine through qjackctl are system capture ports (capture_1 and capture_2) and system playback ports (playback_1 and playback_2), I also try to connect them but also don’t hear any sound.

I tried the reverse the process that I play the music on the slave and connect the netjack capture ports on master then I can hear the music on master speakers!

Is there any steps or anything that I missed the make the system function as proposed? Is it possible to do so with jackd and netjack or I just can connect multiple slave and whenever a slave play the music the sound will get sound output to the master? (seem what I got is the reverse of the function expected!)

Could someone shed some light on this please?

great :slight_smile:

for the connection, either the patchbay or mplayer’s options. The -ao jack option takes further options where you can specify jack ports of your choice (see mplayer manpage).

I forgot to add! the way you specify specific jack ports in mplayer relies on the jack function jack_get_ports() which uses a regular expression. So, say you want mplayer to play on system:playback_5 and system:playback_6, you will have to use a command like

mplayer -ao jack:port=[5-6] some_file

if you want mplayer to use another client for output, you can use a command like

mplayer -ao jack:port=some_client* some_file

by default, mplayer you will try the “system” client, and ports 1,2 of the specified client.

many thanks, that work great!

The actual command has to be alsa_out -j slave1 -d hw:0 -r44100 (has to match the rate when start jackd on slave).

By the way, is there anyway that when we start playing an audio file the output port is automatically routed to netjack_playback0,1 on master machine. I use mplayer -ao jack filename.mp3 but I have to manually connect the mplayer port to netjack every time I play a file, thanks

I figured out, jack patchbay should solve the problem. Thank you all!

I tried the reverse the process that I play the music on the slave and connect the netjack capture ports on master then I can hear the music on master speakers!

From what I read here ( that’s the way netjack works; the supercomputer (Slave) sends the sound to the cappy PC with the expensive soudcard (Master).

So the Master is always the computer responsible for playback of the audio.

on every slave you have in your system, fire up the tool called ‘alsa_out’ on the slave soundcard, something like

alsa_out -j some_client_name -d hw:0

assuming hw:0 is your ALSA sound device.

A new client will show up in the jack graph of the slave called “some_client_name” which can be used as a “system” playback client if you had connected speakers to the slave.

Note: you can adjust the resampling quality of alsa_out with the -q option: it can take a value of 1, 2, 3 or 4 I think (1 = worst, 4 = best but CPU demanding)