Audacity and Jack -- reliable patchbay connection??

Support & discussion regarding DAWs and MIDI sequencers.

Moderators: MattKingUSA, khz

Post Reply
Lech123
Established Member
Posts: 32
Joined: Mon Dec 07, 2009 11:52 pm
Location: Poland

Audacity and Jack -- reliable patchbay connection??

Post by Lech123 »

Audacity keeps renumbering it's Portaudio outputs for some unfathomable reason, and I've been unable to use regular expressions in the jack patchbay to get it working.

http://forum.audacityteam.org/viewtopic ... 18&t=29963

out_d*[13579]$
out_d*[02468]$

Their own advice doesn't work properly. Just click play a few times and the output ports are already in double digits. And in Preferences|Devices I can't select the connections that I need. So what if I can choose 'system' or 'calf' when I cannot manage the individual connections?

This is an annoying bug that's really slowing down my work flow. Any ideas?
Drumfix
Established Member
Posts: 299
Joined: Mon Jan 26, 2009 5:15 pm
Been thanked: 11 times

Re: Audacity and Jack -- reliable patchbay connection??

Post by Drumfix »

Thats a problem of the jack implemention within portaudio (which is used by audacity) in the file pa_jack.c when naming the jack ports.
I patched libportaudio2 on my system (ubuntu 14.04 x86_64), so the ins and outs always start from 0.
User avatar
bluebell
Established Member
Posts: 1909
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 111 times
Been thanked: 116 times

Re: Audacity and Jack -- reliable patchbay connection??

Post by bluebell »

jack_plumbing / jack-plumbing can help. My rules are:

Code: Select all

(connect    "alsa-jack\..*jackP\..*:out_000" "jack_mixer:ALSA L")
(connect    "alsa-jack\..*jackP\..*:out_001" "jack_mixer:ALSA R")
(disconnect "alsa-jack\..*jackP\..*:out_.*" "system:playback_.*")

(connect    "Clementine:out_jackaudiosink-.*_1" "jack_mixer:JACK L")
(connect    "Clementine:out_jackaudiosink-.*_2" "jack_mixer:JACK R")
(disconnect "Clementine:out_jackaudiosink-.*" "system:playback_.*")

(connect    "Qtractor:Master/out_1" "jack_mixer:JACK L")
(connect    "Qtractor:Master/out_2" "jack_mixer:JACK R")
(disconnect "Qtractor:Master/out_.*" "system:playback_.*")

(connect    "rosegarden:master out L" "jack_mixer:JACK L")
(connect    "rosegarden:master out R" "jack_mixer:JACK R")
(disconnect "rosegarden:master out .*" "system:playback_.*")

(connect    "MPlayer.*:out_0" "jack_mixer:ALSA L")
(connect    "MPlayer.*:out_1" "jack_mixer:ALSA R")
(disconnect "MPlayer.*:out_.*" "system:playback_.*")

(connect    "PortAudio:out_.*[13579]" "jack_mixer:JACK L")
(connect    "PortAudio:out_.*[02468]" "jack_mixer:JACK R")
(disconnect "PortAudio:out_.*[13579]" "jack_mixer:JACK L")
(disconnect "PortAudio:out_.*[02468]" "jack_mixer:JACK R")
(disconnect "PortAudio:out_.*" "system:playback_.*")

(connect    "PulseAudio.*:front-left"  "jack_mixer:PULSE L")
(connect    "PulseAudio.*:front-right" "jack_mixer:PULSE R")
(disconnect "PulseAudio.*:front-.*" "system:playback_.*")

(connect "jack_mixer:MAIN L" "system:playback_1")
(connect "jack_mixer:MAIN R" "system:playback_2")

Linux – MOTU UltraLite AVB – Qtractor – http://suedwestlicht.saar.de/

Lech123
Established Member
Posts: 32
Joined: Mon Dec 07, 2009 11:52 pm
Location: Poland

Re: Audacity and Jack -- reliable patchbay connection??

Post by Lech123 »

I stumbled upon this old issue again, so I decided to figure it out for connection numbers 1-999:
For odd numbered connections:
out_d*([13579]|[1-9][13579]|[1-9][0-9][13579])$

and even:
out_d*([02468]|[1-9][02468]|[1-9][0-9][02468])$
Baggypants
Established Member
Posts: 188
Joined: Fri Jul 31, 2015 11:28 pm
Has thanked: 14 times
Been thanked: 8 times

Re: Audacity and Jack -- reliable patchbay connection??

Post by Baggypants »

I had a go with this today, This worked for me, I tested up to the pair 'out_108' & 'out_109'.

Code: Select all

out_.*[02468]$
out_.*[13579]$
I'm pretty sure preceding the regex with 'd' is meaningless. '*' means "zero or more of the previous character" so it matches '', 'd', 'dd' and 'ddddddddddddd'. The only one that is ever matched is ''.

Note: I had to save the patch, reactivate the patchbay and in Audacity go to "Transport > Rescan Audio Devices" for it to work.

It will work up to massive numbers. (as big as can be made in a jack port descriptor)

edit: Oh go on then, I tested it up to pair 1050 & 1051, still works fine.

edit2: Oh, I just realised this would work too

Code: Select all

out_[0-9]*[02468]$
out_[0-9]*[13579]$
And would have the advantage of only matching numbers. Whereas the first would match letters, if Audacity generated ports with letters after the '_'
Post Reply