[LAU] Jack & pulse...knickers in a twist.

Len Ovens len at ovenwerks.net
Mon Jun 4 21:46:37 CEST 2018


On Mon, 4 Jun 2018, Mac wrote:

> Ok, so I'm trying to set this up so I control things with a script file.
> 
> I have a script that sets various parameters with jack_control.
> 
> I was attempting to start my own paulse audio sink/source, but when I do I get 2
> sinks/sources, and (I'm guessing) pulse is confused as to the default
> connections.
> So, when, for example, I start a browser and youtube, it doesn't play.

:)

> I did some googling, but, none of the files they say to change are on this
> system. So, where is the paulse auto start configured and started? It does show
> up in ps aux, so something is doing it.

I wuld not (and do not) change any system settings as this will produce 
errors when pulse is upgraded by apt.

> The script:
> 
> #!/bin/bash
> jack_control start
> jack_control ds alsa dps capture none dps playback none
> jack_control dps device hw:PCH
> jack_control dps rate 48000
> jack_control dps nperiods 2
> jack_control dps period 256

I personally would start the script with:
killall -9 jackd jackdbus

That gets rid of any jack processes started by someone else.

Next thing is that you need to move the jack_control start line to the end 
of your jack_control lines otherwise the settings after that will not be 
used.

So:
#!/bin/bash
killall -9 jackd jackdbus
jack_control ds alsa dps capture none dps playback none
jack_control dps device hw:PCH
jack_control dps rate 48000
jack_control dps nperiods 2
jack_control dps period 256
jack_control start

Then I remove pulse's connection to anything alsa:
pactl unload-module module-udev-detect
pactl unload-module module-alsa-card

Those two lines mean that the only output pulse can find is jack and so 
pulse defaults to the jack bridge all the time. Removing any path to an 
alsa device also allows jack to run in freewheel mode without crashing 
because pulse will try to use an alsa device for sync :P

In my case, I also unload the jackdetect module because I want my jack-pa 
bridge to be specific:
pactl unload-module module-jackdbus-detect

Then in place of the above module I do:
pactl load-module module-jack-sink client_name=PulseOut channels=2 connect=no
pactl load-module module-jack-source client_name=PulseIn channels=2 connect=no

I use the connect=no because my outputs are not always 1 and 2 they may be 
9 and 10 if I am using s/pdif.

Then I use jack_connect to connect what ports I do want

jack_connect system:capture_1 PulseIn:front-left
jack_connect system:capture_2 PulseIn:front-right
jack_connect PulseOut:front-left system:playback_9
jack_connect PulseOut:front-right system:playback_10

I have shown one config only in my case the last line might look more 
like:
jack_connect PulseOut:front-right ${device}:playback_${o_port_r}
(well actually most of the above lines would have variables inserted)


--
Len Ovens
www.ovenwerks.net


More information about the Linux-audio-user mailing list