template jackd

Most often a computer has multiple soundcards with independent clocks sources. They drift with respect to each other, so trying to group them all in a single jack instance fails.

In some cases this can even apply to multiple devices on the same mainboard or PCB, there may be multple crystals providing clocking

Resolution found is to run a jackd instance per indepently clocked sound entity, creating a plesiochronous bridge between the synchronous jackd islands.

define a environment based pcm in ~/.asoundrc

This can call hw: pcms set in the environment or others defined in asoundrc if useful to shuffle audio channels to put them in order.

Call it from ~/.jackdrc so that it uses the environment

If using qjackctl that can be made to call jds as the input and output alsa device and then different jacks will use their respective alsa hardware

Define a sub-pcm for the p9d ws onboard...

... and an m-audio m2496 pci card. Here shuffle the digital outputs to the beginning for ease of use.

startup some jackd. use of promiscuous mode useful as then jackd does not include uid in files used to communicate with jack clients. This may enable clients to run in other user accounts in future, for 2019 that does not work well and pulseaudio can be opened up in this way instead.

suppose alsaplayer connects to the p9d jackd, since subsequenct jackd attached to a running pulseaudio misbehaved, next best things is to loopback the sound between the clocking islands:

It is possible to swap p9d with sp2dif in the examples if the latter sounds better.

Jackd for OpenAL (Such as ut2004)

Two files in the home directory allow openal applications like unreal tournament 2004 to be used with jack, and so with ALSA cards that do not really have their own mixer.

cat >> ~/.openalrc << EOF
(define devices '(alsa native))
(define alsa-device "plug:SLAVE=jack")

cat >> ~/.asoundrc << EOF
pcm.jack {
        type jack
        playback_ports {
                0 alsa_pcm:playback_1
                1 alsa_pcm:playback_2
        capture_ports {
                0 alsa_pcm:capture_1
                1 alsa_pcm:capture_2

Use Jack / ALSA for festival output

(Parameter.set 'Audio_Method 'Audio_Command)
(Parameter.set 'Audio_Required_Format 'riff)
(Parameter.set 'Audio_Command "aplay -q -D plug:SLAVE=jack $FILE")

Goes in /etc/festival.scm

mkfifo ~/.ut2004/System/speech
while true
        cat ~/.ut2004/System/speech | while read
                echo -ne "(SayText \""
                echo -n $REPLY | sed 's/\\/\\\\/g
                echo -e ".\")"
done | festival

This can now be used to provide a speech device instead of the other method involving a speechd for ut2004