How best to share audio?

What other apps and distros do you use to round out your studio?

Moderators: MattKingUSA, khz

Post Reply
fiddlesticks
Established Member
Posts: 5
Joined: Thu May 26, 2016 5:19 pm

How best to share audio?

Post by fiddlesticks »

Ok I've got myself into a bit of a mess having installed Jack, Pulse, KX Studio etc etc. I can't seem to do what i'm trying to do, despite having made a major breakthrough (or so I thought) with the alsa loopback interface.

This is what I'm trying to do:

I have a USB sound interface (Scarlett 2i2) which has 2 channels of audio going IN to it, and 1 channel of audio coming OUT of it. Basically I want to share the audio with other applications, so to that end I have switched the first application to using the alsa loopback interface instead of the hardware interface.

Now I am trying to use Claudia (and have also tried Jack Patchbay) to map the alsa loopback interface to both the hardware interface, *and* leave a hook available for other applications. This is the bit I'm failing at. I can only ever see one interface at a time, so I can't patch, say, the alsa loopback to the hardware interface.

I'm missing some logic here?!
witchspace
Established Member
Posts: 60
Joined: Sun Jul 13, 2014 7:14 pm
Location: Eindhoven

Re: How best to share audio?

Post by witchspace »

Disclaimer: it works like this here, no guarantee it's the same on every distro:

If you use JACK:

- It claims the ALSA audio inputs/outputs for itself. JACK can mix an arbitrary number of output streams into one output, so you can run many JACK applications and it will just work, no need to change routing manually. But you can't run other ALSA applications.
- There is a PulseAudio backend that outputs to Jack. If you use it, you can run PulseAudio applications at the same time as running Jack.

If you don't use JACK, but run Pulse, then Pulse will basically have the same behavior as ALSA above. It will claim the ALSA interface, so you can run only Pulse applications.

If you run an ALSA application and either JACK or Pulse (or another ALSA app) is running, it will just block/hang in many cases without a clear error. JACK and Pulse support multiple applications at once, ALSA does not (or maybe it does with some hw, it doesn't for me...).

Sorry, this seems like quite a garbled story now. I wish I could say audio on Linux was simpler.
fiddlesticks
Established Member
Posts: 5
Joined: Thu May 26, 2016 5:19 pm

Re: How best to share audio?

Post by fiddlesticks »

Heh, thanks I think that makes sense, almost ;)

What I don't understand is that I thought if I used JACK I would be able to view all the interfaces of hardware and software devices in a patchbay, and map them together.

IE if I output audio to the Alsa loopback interface (or a virtual jack interface which I created following this article http://alsa.opensrc.org/Jack_and_Loopba ... ack_bridge) then I should be able to map that virtual interface via effects racks or whatever, and then finally on to the physical interface itself.

What I'm actually getting, is only the visibility of the hardware interface *or* the virtual interface, depending on what I select in qjackctl. So patchbay / claudia / cartrina / others I have tried, give me no ability to do those mappings?!
fiddlesticks
Established Member
Posts: 5
Joined: Thu May 26, 2016 5:19 pm

Re: How best to share audio?

Post by fiddlesticks »

...now experimenting with alsa_in and alsa_out, which is showing up additional interfaces in JACK now, but they don't seem to do anything...
Pablo
Established Member
Posts: 1274
Joined: Thu Apr 17, 2008 9:57 pm
Been thanked: 3 times

Re: How best to share audio?

Post by Pablo »

I suggest you should read

http://www.jackaudio.org/faq/multiple_devices.html

to learn why jack was not designed to work with multiple devices. And, of course, the workaround :) .

However, instead of the alsa_in / alsa_out jack clients, an equivalent but better option is the zita-ajbridge

http://kokkinizita.linuxaudio.org/linux ... guide.html

Cheers, Pablo
fiddlesticks
Established Member
Posts: 5
Joined: Thu May 26, 2016 5:19 pm

Re: How best to share audio?

Post by fiddlesticks »

Thanks Pablo - and sorry if there is any crossover in posts it's taking a little while to get my posts moderated - can anyone authorise me to post??

Using alsa_in and alsa_out I could only get one way audio working. I forget which one, I've been working 15 hour days on this to try and get it working, my brain is breaking. Getting rather frustrated as nothing has ever vexed me like this is.

I can't figure out a2j at all, it errors with dbus exceptions and unknown ALSA sequencer port. Not helping that I can't find any decent documentation on it.

I still don't even understand why I'm having to consider implications of using multiple devices, when all I want to do is share audio between two apps (one of which, FreeSWITCH, is portaudio based and is hanging onto the device).

I usually get to the bottom of any issue, but having spent over a week of long hours and getting nowhere I'm running out of steam here :(
Pablo
Established Member
Posts: 1274
Joined: Thu Apr 17, 2008 9:57 pm
Been thanked: 3 times

Re: How best to share audio?

Post by Pablo »

I think you are confusing a2j, which is a a2jmidid wrapper, which is an alsa MIDI sequencer to jack MIDI bridge with zita_a2j which is alsa audio to jack audio bridge, equivalent to alsa_in.

As I see it, in zita_a2j, the the "a" refers to "audio hardware supported by alsa" and the j refers to jack audio.
I think you only want an audio bridge, not MIDI.
Pablo
Established Member
Posts: 1274
Joined: Thu Apr 17, 2008 9:57 pm
Been thanked: 3 times

Re: How best to share audio?

Post by Pablo »

... so, for example, say you have started jack in duplex mode with the hw:0 audio card and you have another hw:1 with one or more audio inputs you want to use, then you would run:
zita_a2j -dhw:1

a2j is for applications that have alsa sequencer ports that you want to connect to Jack MIDI ports. Nothing to do with audio.

HTH, Pablo
Post Reply