Trying to set up a second sound device for Pulse programs

Unofficial support for the KXStudio Linux distribution and applications.
More info at http://kxstudio.linuxaudio.org/

Moderators: MattKingUSA, khz

Post Reply
SpeakerToMeat
Established Member
Posts: 3
Joined: Wed Jul 05, 2017 9:35 pm

Trying to set up a second sound device for Pulse programs

Post by SpeakerToMeat »

Hello all. User of KX on debian here.

My workstation at home is a workstation and personal use machine. I've been using a few KX programs so far to work via Jack, with Pulse and Alsa bridges. Mainly to pass all my audio through a Carla with an EQ for room/speaker flattening, and for working with MixBus (eventually).

I used Cadence to set up Jack, Pulse Bridge and Alsa bridge via Alsa->pulse->jack. Using a session set up via Claudia which starts Carla with a profile, and patches through it (Pulse bridge source to carla to hardware sink).

I have a Microsoft USB headset that I'll leave eternally plugged in the back to use with a few programs (Skype, Discord, etc). But of course I'm not trying to make it work with all the bridges and Pulse is proving hard.

I want to create an alsa_in and alsa_out for the headset which I can then patch into extra Pulse Bridges sinks and sources....

The troubles I'm facing and looking for help are:

A) I managed to add the alsa_in and out as custom commands to my session in claudia with these commands:

command: alsa_in -j Headset -d hw:0 -r 44100
name: Headset

command: alsa_out -j Headset -d hw:0 -r 44100
name: Headset

The trouble is they start and run now, but the headset id has changed during boot before... I'm trying to see if there's any systemd/udev way I can stabilize the names for alsa, but I can't find any and any help is welcome.

B) I can't find a way to create extra pulse jack bridges so that I can sink/source the headset to/from it, and choose that bridge (named specially) as the "card" to use in my pulse based programs. There's a mention of a patch to Cadence that adds this option here: https://github.com/falkTX/Cadence/issues/234 but the person who mentions the experimental patch hasn't share it (that I can find) on his github, so I can't test it, and I wonder if there's any config file way to achieve this even right now or if I'll have to modify code for the pulse bridge for this, and if I do, whether there's any such changes somewhere before I embark on trying to do this via code.

C) My session sets up a patch from my default pulse source to carla to the hardware sink... but every time it starts, the system also automatically patches the pulse bvridge source to the hardware sink. There's an option in cadence settings to "Ignore self connect requests to external ports only" but it doesn't seem to affect this behaviour. And whenever I restart my system, that setting is reset back to the default of "Don't restrict self connect requests"... so it seems the setting is not being saved... what I wonder is what config file is this setting applied to? so that I can see its permissions, and try editing the setting directly in vim to see if it takes....

Thanks for any possible feedback and help.
Jack Winter
Established Member
Posts: 381
Joined: Sun May 28, 2017 3:52 pm

Re: Trying to set up a second sound device for Pulse programs

Post by Jack Winter »

For A, you can refer to a device by name and not only index (which might change). If you look at the output of "cat /proc/asound/cards" the name is between the []. So you could use hw:Intel or similar.

Otherwise it's possible to set the index order by using modprobe.conf.
Reaper/KDE/Archlinux. i7-2600k/16GB + i7-4700HQ/16GB, RME Multiface/Babyface, Behringer X32, WA273-EQ, 2 x WA-412, ADL-600, Tegeler TRC, etc 8) For REAPER on Linux information: https://wiki.cockos.com/wiki/index.php/REAPER_for_Linux
User avatar
nikgnomicradio
Established Member
Posts: 109
Joined: Wed Feb 07, 2018 9:31 pm
Has thanked: 1 time
Been thanked: 7 times
Contact:

Re: Trying to set up a second sound device for Pulse programs

Post by nikgnomicradio »

can add any amount of Pulseaudio sink/source connections with 2 basic commands

Code: Select all

pactl load-module module-jack-sink
pactl load-module module-jack-source
use command more than once and can have multiple sinks/sources

helped a friend on arch-based distro recently to get rid of duplicate sinks/sources with Cadence
he had Pulseaudio configuration at etc/pulse/default.pa with 'module-jackdbus-detect' loading one sink/source pair
(Usually not enabled with Cadence? not sure as i use qjackctl)
but he didn't notice they were there and turned on setting for Pulseaudio sinks/sources in Cadence, which created 2nd sink/source pair
simplest fix for that was turn off the Cadence setting (but could also have disabled the Pulseaudio module)

in theory could use that fix in reverse to have 2 sink/source connections easily in JACK, but still has problems OP identified

default names of multiple sinks and sources ( Pulseaudio JACK Sink, Pulseaudio JACK Sink 01 and so on) can get a bit confusing when using multiple connections
these names are also a real pain to use in scripts as the spaces in names have to be escaped with a "/"
for example jack_disconnect PulseAudio/ JACK/ Sink:front-left system:playback_1

this pactl command also defaults to auto-connecting to 'system' in JACK,
but there is a command option "connect=no" to prevent that
JACK's "prevent self-connect requests" probably doesn't work because it is a Pulseaudio command outside JACK control

I also need to option "channels=2" or else Pulseaudio creates 4 channel sink/sources to match my 4x4 audio device
other users with surround sound cards may need this to restrict channels too, but many probably don't need it

i use all of the pulseaudio command options in script that runs after JACK started

Code: Select all

# Pulseaudio Aux to JACK sink
pactl load-module module-jack-sink sink_name=aux2jack client_name=aux_in channels=2 connect=0

# Pulseaudio VOIP to JACK sink/source
pactl load-module module-jack-sink sink_name=voip2jack client_name=voip_in channels=2 connect=0
pactl load-module module-jack-source source_name=jack2voip client_name=voip_out channels=2 connect=0

# set Pulseaudio default sink and source 
pactl set-default-sink aux2jack
pactl set-default-source voip2jack
script loads the 3 sinks/sources i need; with easy to recognise names in Pulseaudio/JACK and no default connections
(i use aj-snapshot command later in script for sorting out connections, but lots of other ways to do that)

The only thing that doesn't work automatically using this script is getting VOIP in Pulseaudio connected to 'voip2jack'
have to manually switch VOIP in 'pavucontrol -t 1' from default sink 'aux2jack'
but Pulseaudio does save the manual adjustment so only need to change it first time around
Post Reply