[LAD] wrapper script (hack alert!) for jack + pulseaudio

Fernando Lopez-Lezcano nando at ccrma.Stanford.EDU
Tue Jul 14 19:24:06 UTC 2009


Well, I could not find one so I wrote this simple perl jackd wrapper
script[*], I really needed something that would enable jack and
pulseaudio to coexist while the jack + pulseaudio situation stabilizes.
Not a finished product but seems to work around here (tested lightly on
Fedora 10). 

If you want to try it out (don't blame me if everything stops working!)
you should rename your current jackd executable to "/usr/bin/jackd.bin"
and put the script in its place ("/usr/bin/jackd" by default, don't
forget to make it executable). You need to have pulseaudio, pacmd and
pactl available in /usr/bin/. 

If pulseaudio is running the script will suspend it, start the real
jack, wait for it to be ready and finally load the pulseaudio module
module-jack-sink (but it does not make it the default). You could then
manually transfer pulseaudio streams to it. If pulseaudio is not running
the script just execs the real jackd (set $verbose to 0 in the script if
you don't want the extra messages). 

The script also traps <ctrl>c and the kill signal, unloads the
module-jack-sink module, passes the signal to the real jack and when it
is dead unsuspends pulseaudio. I don't know if trapping more signals
would be necessary. 

WARNING: if you transfer a pulseaudio stream to the jack sink module and
then stop jack without unloading it, pulseaudio becomes very very
unhappy and dies, oh well. You can get it going again with "pulseaudio
--start" (at least in Fedora 10).

I guess more code could be added to automagically transfer pulse audio
streams back and forth to the jack sink module when jack starts and
stops, and also make it the default. It seems it would take a lot of
parsing of command outputs to do that. 

Anyway, as I said before, just a __temporary__ hack...
Enjoy!
-- Fernando


[*] why perl? tried bash and could not get the signal stuff to work and
don't know no python :-) Perl hackers: I could not make exception
catching work around the open3 call to catch potential errors, help with
that would be welcome!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: jackd
Type: application/x-perl
Size: 3828 bytes
Desc: not available
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-dev/attachments/20090714/e7635123/attachment.bin>


More information about the Linux-audio-dev mailing list