AC3Jack is a tool for creating an AC-3 (Dolby Digital) multichannel stream from its JACK input ports. Using this tool, an AC-3 stream (up to 5.1 channels) is created in real time and either written to a file or streamed to a SPDIF output.
If the SPDIF port on your audio interface for connection to a multichannel surround receiver, you can achieve full 5.1 surround mixing and monitoring of your JACK applications with a single digital cable, and no need for hardware supporting discrete outputs and inputs.
AC-3 is a compressed audio stream, so quality will suffer somewhat, but it is the price you pay for easy surround sound. The AC-3 encoder used here comes from the Aften project and although the sound quality seems good, I haven't seen any direct quality comparisons with commercial encoders.
Get the source code to the latest release and build it yourself on Linux or Mac:
ac3jack [-h] [-V] [-H <str>] [-P <num>] [-J <str>] [-S <str>]
-H <str> , --connect-host=<str> connect to remote ac3jack on given host
-P <num> , --connect-port=<num> connect to remote ac3jack on given port
-J <str> , --jack-name=<str> jack client name, default is ac3jack_1
-S <str> , --jack-server-name=<str> specify jack server name
-h , --help this usage output
-V , --version show version only
All other options are controlled from the GUI and can be changed at any time.
2 ch -- 192
5.1 (6 channel) -- 448
However, if doing live streaming to hardware consider using the highest quality bitrate of 640.
The sample rates allowable are 32, 44.1, and 48kHz. Note that for use as part of DVD soundtracks multiplexed with MPEG2 files, only 48kHz is allowed. Currently the sample rate is selected by the native rate of the active JACK server. I highly recommend that you use a buffer size of at least 1024 when using AC3JACK, otherwise the CPU usage will be higher than necessary due to the block processing required for AC3 frames.
The channels options will make the following input ports with each given channel count:
1 - LeftAn LFE channel may be added with an additional flag enabled.
2 - Left, Right
3 - Left, Center, Right
4 - Left, Right, LeftSurround, RightSurround
5 - Left, Center, Right, LeftSurround, RightSurround
If the -t (--jack-transport) option is used, ac3jack will only write to the output when the JACK Transport state is Rolling. This is useful in order to do port connection before the streaming begins, or to synchronize AC-3 stream capture to disk. If extra arguments are added to the end of the command line, they are treated as JACK ports to connect to the inputs (in channel orders shown above).
ac3jack_cli -o file.ac3This will create the ac3jack client with 5 inputs, (L,R,C,LS,RS) to which you can connect with your favorite JACK patchbay (eg. qjackctl). It will create an AC-3 stream and the output will be written to the file specified. As mentioned above, the -t option can be useful here.
ac3jack_cli -SThis will create the ac3jack client with 5 inputs, (L,R,C,LS,RS) to which you can connect with your favorite JACK patchbay (eg. qjackctl). The -S option to ac3jack_cli causes it to try to open the SPDIF portion of your sound card for raw output and send the stream through it.
Some sound cards may not allow the SPDIF to be accessed when JACK is using it. In this case, to do realtime streaming you must either have two sound cards, with JACK running on one, and the -C <card_num> option to specify the audio interface to open the SPDIF output on. Alternatively, if you have a multichannel interface that exposes the SPDIF outputs on specific channels, you can use the Raw JACK Out option to have ac3jack send the raw spdif PCM output to two JACK ports that you can connect to your SPDIF channels using a JACK patchbay.
This option is also for audio interfaces that have SPDIF but don't advertise AC3 passthrough to the OS or that don't allow its use simultaneously with JACK. You must connect the L and R ports to a pair of hardware channels that route to the SPDIF output.
WARNING! Do NOT connect these jack ports to analog channels with speakers attached, or damage might occur! It is wise to keep your target receiver muted until it locks on the AC3 stream.
All of the options for outputting encoded AC3 via SPDIF or Jack ports are available from the GUI as well.