Newbie trying to emulate Loopback or Blackhole with JACK

Still new to all of this? Feel free to post in any of the subforums on this site, but in this subforum newbie questions are especially encouraged!

Moderators: MattKingUSA, khz

Post Reply
madmalkav
Established Member
Posts: 8
Joined: Fri Jul 31, 2020 2:05 pm
Has thanked: 2 times
Been thanked: 2 times

Newbie trying to emulate Loopback or Blackhole with JACK

Post by madmalkav »

Hi everyone. I'm completely new to audio in general as well as linux audio software.

I was trying to set up Jack to behave similar to software like Loopback or Blackhole in Mac. For software that is not compatible with Jack, I was thinking on creating virtual inputs and outputs with Pulseaudio, seems doable because Cadence already creates one input and one output device, but still reading about how this work to add some more. Also, I wanted to map some different inpouts and outputs with alsa_in alsa_out.

Nearest I got is using Cadence and Catia, but for some reason, even when I configure Cadence to start Jack linked to HW:2,0 , I can't alsa_out hw:0,1 to add a second output device, I suppose because it is because it is already picked by PulseAudio for some reasons. So I suppose the target is to PulseAudio to only detect/work with the vitual inputs and outputs, and manage the real inputs and outputs with Jack.

Doesn't seems to be a weird idea in my head, yet I can't find anyone talking about making a similar setup online, making me think I'm probably misunderstanding something. Anyone have experience with a similar setup and can suggest, or perhaps you have some links my google-fu failed to find?

Thanks for reading.
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: Newbie trying to emulate Loopback or Blackhole with JACK

Post by merlyn »

Hi madmalkav. There is a good chance you will at least be able to get close to what you want. At the moment I'm not sure what that is.
madmalkav wrote: I was trying to set up Jack to behave similar to software like Loopback or Blackhole in Mac.
I don't know what they are, or what they do.
madmalkav wrote:For software that is not compatible with Jack, I was thinking on creating virtual inputs and outputs with Pulseaudio,
Software that isn't JACK-ified often uses ALSA and there is an ALSA-JACK bridge in Cadence.
madmalkav wrote:Also, I wanted to map some different inpouts and outputs with alsa_in alsa_out.
alsa_in is for adding hardware inputs.

For me it would be easier if you provide a specific example of something you want to do and we could see how we go with that, dealing with each specific case.
madmalkav
Established Member
Posts: 8
Joined: Fri Jul 31, 2020 2:05 pm
Has thanked: 2 times
Been thanked: 2 times

Re: Newbie trying to emulate Loopback or Blackhole with JACK

Post by madmalkav »

I was thinking in example to be able to mix the audio with some different colleagues by Skype or DIscord or similar while playing some other audio from my computer without causing a loop. I think that is called a "mix-minus", but definitively my head need a break, so I'm gonna grab a beer and not think about this for some hours :)
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: Newbie trying to emulate Loopback or Blackhole with JACK

Post by merlyn »

madmalkav wrote: I was thinking in example to be able to mix the audio with some different colleagues by Skype or DIscord or similar while playing some other audio from my computer without causing a loop.
I don't think JACK is relevant to this case. I've found this diagram useful :

Image

JACK and Pulse are both sound servers. JACK is for pro audio and Pulse is for desktop audio. We need the server/client model so that multiple apps can access the sound hardware. A long time ago there was only ALSA and that meant in the default setup it was only possible to use one sound app at a time -- it wasn't possible to have sound output from e.g. a browser and a media player at the same time.

Using a server/client model allows multiple audio streams to be directed to the same audio hardware. For desktop audio I don't think there is anything to be gained by adding JACK.
madmalkav
Established Member
Posts: 8
Joined: Fri Jul 31, 2020 2:05 pm
Has thanked: 2 times
Been thanked: 2 times

Re: Newbie trying to emulate Loopback or Blackhole with JACK

Post by madmalkav »

I more or less managed to do what I wanted, with Cadence, some command line, and some small annoyances. I still have to put it in practice though. So let's go with a fictional example. Imagine I'm meeting online with my two colleagues, I want to record the audio of all three of us plus some additional sounds on my computer with some software, but I will also output that mix to a hardware device. I want everyone to hear everything but themselves. So, I use this commands to create the virtual devices I need in PulseAudio:

pactl load-module module-jack-sink client_name=friend_A_audio
pactl load-module module-jack-sink client_name=friend_B_audio
pactl load-module module-jack-source client_name=friend_A_return
pactl load-module module-jack-source client_name=friend_B_return
pactl load-module module-jack-source client_name=Recording

And I add the second output through alsa_out:

alsa_out -j "External Recorder" -d hw:CODEC,0 2>&1 1> /dev/null &

But, for getting the audio to there, I need to "bridge" it. So , let's do:

pactl load-module module-jack-sink client_name=Bridge

And here we have the monster I created, as displayed by Catia:
jack_monster.png
jack_monster.png (218.95 KiB) Viewed 7266 times
You can easily make variations over this, like two persons in the same place recording and another person online, so perhaps you need to add an additional recording device with alsa_in and send the audio to this person to an additional device added with alsa_out, etc...

PS: forget about the Bridge part, that was killing the audio output to the device, I have to just make all the mappings directly to the device to get audio out:
jack monster 2.png
jack monster 2.png (234.11 KiB) Viewed 7265 times
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: Newbie trying to emulate Loopback or Blackhole with JACK

Post by merlyn »

It looks good anyway. :) I can't really follow the connections or have any idea what it is doing, but cool if that's what you wanted. I think you'll like PipeWire when it's available.
madmalkav
Established Member
Posts: 8
Joined: Fri Jul 31, 2020 2:05 pm
Has thanked: 2 times
Been thanked: 2 times

Re: Newbie trying to emulate Loopback or Blackhole with JACK

Post by madmalkav »

Piperwire looks very promising, indeed, hope it will be ready soon.
benwiley4000
Posts: 1
Joined: Sat Jul 10, 2021 2:04 pm

Re: Newbie trying to emulate Loopback or Blackhole with JACK

Post by benwiley4000 »

So does anyone know how to achieve black hole / loopback functionality with pipewire? I just want to configure an input device that forwards the output from the main system audio.

ETA: didn't see the images loaded before I logged in, the posts above might be able to help me out.
Last edited by benwiley4000 on Sat Jul 10, 2021 2:08 pm, edited 1 time in total.
Post Reply