Audio over the network with Jack

Developers
2011-06-24
2013-04-25
  • Matthew Marks
    Matthew Marks
    2011-06-24

    I have been experimenting with the Jack audio framework to transmit audio across the LAN.  This will allow machines to hear players running remotely via, for instance, ssh tunnelling or X-forwarding.  Applications for this include allowing a controller PC to monitor recorder inputs without enabling multicast, or to hear audio while the recorders play back to their SDI outputs.

    I have been using OpenSuSE 11.4.  The version of Jack that comes with 11.1 does not have the network capability, and although I built the latest version, I got a "JACK protocol mismatch (22 vs 24)".  This is presumably due to the older version of libjack0, the Jack Connection Kit Library, against with portaudio etc are built.  So at that point I gave up.

    Here is what to do:

    1) Install packages jack and qjackctl (The latter isn't strictly necessary as everything can be done from the command line/API/setup files, but is useful for experimentation.)
    2) Add the ingex user to the audio group using YaST->Security and Users->User and Group Management
    3) Add the following line to  /etc/security/limits.conf:

    @audio          -       rtprio          99
    

    The above two steps allow the Jack daemon, when run by ingex, to have real-time scheduling.  You will need to log out and in for the group change to take effect; I hear conflicting things about whether you need to do anything to get the limits change (PAM) to take effect.
    4) On the source machine (where you will be running the player), run qjackctl, press Setup…, set Settings->Server->Driver to "netone" and start the server.  Alternatively:

    jackd -d netone
    

    5) On the destination machine (with the audio output), run

    jack_netsource -H <source_machine_hostname>
    

    It should report that it is connected.
    6) On the destination machine, run qjackctl and start the server (if not running) with the default settings.  Then press the Connect button.  You should see "netjack" as well as "system" outputs and inputs.  Drag "netjack" on the left to "system" on the right to route the incoming network audio to the speakers.
    7) On the source machine, run the Ingex player with -audio-dev set to the Jack audio device.  This is 8 on our machines, changing to 7 when accessing via an ssh session.  Philip has added a -print-audio-dev option to the player which will show you which is the Jack device.  (Side note: the "dmix" device is a mixer: if not using Jack, you can connect as many players as you like to this device and it will mix them all together.)

    Jack allows any number of audio channels to be routed over a network.  It claims to be very low latency.

     
  • Matthew Marks
    Matthew Marks
    2011-10-17

    Followup: Pulse Audio interferes with the jack server, so in step 4 above you may instead need:

    pasuspender -- jackd -d netone
    

    This also allows the player to report the jack audio device correctly instead of encountering an error in portaudio.

     
  • Arclyde
    Arclyde
    2011-10-19

    Is it possible to choose audio device in ingexgui?

     
  • Matthew Marks
    Matthew Marks
    2011-10-19

    No it isn't, but I expect it would be quite easy to add.  Would a device number as a command line option be good enough?

     
  • Matthew Marks
    Matthew Marks
    2011-11-08

    I've added an "-a" command line option to set the audio device (available next time GUI source is updated).  It's useful to set this to 1 to use ALSA rather than OSS, because you don't get nasty glitches when starting playback.