alsa-jack(plugin) or alsa-loop-jack?

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

Moderators: MattKingUSA, khz

wolftune
Established Member
Posts: 1350
Joined: Fri Feb 24, 2012 7:40 pm
Location: Portland, OR
Been thanked: 2 times
Contact:

alsa-jack(plugin) or alsa-loop-jack?

Post by wolftune »

I don't understand the difference between these two options in Cadence. For me, ALSA-JACK(plugin) has been working fine, but I'm just curious what is the difference? I know loop is listed in my sound settings for the system, but I don't understand what it is.
Aaron Wolf
Music teacher, scholar
http://wolftune.com
wolftune
Established Member
Posts: 1350
Joined: Fri Feb 24, 2012 7:40 pm
Location: Portland, OR
Been thanked: 2 times
Contact:

Re: alsa-jack(plugin) or alsa-loop-jack?

Post by wolftune »

Thanks! This should be in the documentation, of course

Cheers!
Aaron Wolf
Music teacher, scholar
http://wolftune.com
ToddMWorth
Established Member
Posts: 225
Joined: Tue Oct 23, 2012 3:59 am

Re: alsa-jack(plugin) or alsa-loop-jack?

Post by ToddMWorth »

This is interesting to see... This thread got me to take a look at how to disable pulse... well that was really easy hahaha I literally just had to click a button. I'm becoming a kxstudio fanboy.

So, awesome, I'm pulse-free... But how might I get the loopbacks to represent an 8 channel (7.1 or independent) card? I found the cadence-aloop-daemon.py file, but a very quick glance told me that it might not be so easy... Any ideas? I fear I might have my homework cut out for me on this one ;)

Edit FYI:

Code: Select all


$ aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: Gina24 [Gina24], device 0: Analog PCM [Gina24]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 0: Gina24 [Gina24], device 1: Digital PCM [Gina24]
  Subdevices: 7/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 1: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 1: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
  Subdevices: 7/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7

ToddMWorth
Established Member
Posts: 225
Joined: Tue Oct 23, 2012 3:59 am

Re: alsa-jack(plugin) or alsa-loop-jack?

Post by ToddMWorth »

Sounds like it's time for me to learn the cadence codebase and brush up on my python ;)

What's the 'right' way to do this? Do we put an option in the cadence UI, to set the number of ports to create and connect... or do we detect the number of ports available (on the loopback side or the jack side?) and connect them? Something else?

I hope you have a moment to explain to me... how is the loopback device created? I'm wondering if it's using the defaults (according to the alsa wiki, the aloop module defaults to the maximum of 8 ports) or if it's created with 8 ports because that's what my card is using?
ToddMWorth
Established Member
Posts: 225
Joined: Tue Oct 23, 2012 3:59 am

Re: alsa-jack(plugin) or alsa-loop-jack?

Post by ToddMWorth »

Thanks mate that helped :)

Okay so I have it working. How to implement it is a bit tricky (because of the different hardware and use-cases of multi-channel cards).

As it turns out, yes there are 8 channels of playback created by default. However for the input, it only creates two. That's solved in asoundrc (note the one added line, channels 8):

Code: Select all

# ------------------------------------------------------
# alsa_in -j alsa_in -dcloop -q 1
pcm.cloop {
  type dsnoop
  ipc_key 3
  ipc_key_add_uid true
  slave {
    pcm "hw:Loopback,1,0"
    channels 8
    format S32_LE
    rate {
      @func igetenv
      vars [ JACK_SAMPLE_RATE ]
      default 44100
    }
    period_size {
      @func igetenv
      vars [ JACK_PERIOD_SIZE ]
      default 1024
    }
    buffer_size 32768
  }
}

# ------------------------------------------------------
Then just need alsa_in/out to know about the 8 channels in the cadence-aloop-daemon.py script (Note the added -c 8 arguments)

Code: Select all


        procIn.start("env",  ["JACK_SAMPLE_RATE=%i" % sampleRate, "JACK_PERIOD_SIZE=%i" % bufferSize, "alsa_in",  "-j", "alsa2jack", "-d", "cloop", "-q", "1", "-c", "8"])
        procOut.start("env", ["JACK_SAMPLE_RATE=%i" % sampleRate, "JACK_PERIOD_SIZE=%i" % bufferSize, "alsa_out", "-j", "jack2alsa", "-d", "ploop", "-q", "1", "-c", "8"])

So that's great. I guess it would be pretty straightforward to then automate patching of 8 jack ports...

Anyway, please let me know how you'd like to progress from this stage :)

PS I now have a lot of "Bridge Type: Custom" entries in the drop-down list in cadence; I think it added a new one every time I changed asoundrc or the py script, so now there are five... is there a way to make them go away?
ToddMWorth
Established Member
Posts: 225
Joined: Tue Oct 23, 2012 3:59 am

Re: alsa-jack(plugin) or alsa-loop-jack?

Post by ToddMWorth »

Thanks so much man :D

I'm curious to see how it goes... as far as I can tell, the 8 channel loopback should work on a machine with 2 channel hardware. Users of 8 channel hardware should probably know how they'd like to patch it up (multi-out vs 5.1 vs 6.2 vs 7.1 etc) so I think that aside from the first two channels (as they are now) it would probably be best implemented as the users manually patches channels 3+ into jack.

I don't know if there's a performance cost in running 8 channels for everyone, but if there is not, then perhaps that's an easy implementation for you....?

Anyway, hope that helps. Thanks again, you make a kick ass daw!
ToddMWorth
Established Member
Posts: 225
Joined: Tue Oct 23, 2012 3:59 am

Re: alsa-jack(plugin) or alsa-loop-jack?

Post by ToddMWorth »

That sounds awesome :)

PS, the excess 'Custom' entries in cadence, went away after a reboot.
i2productions
Established Member
Posts: 544
Joined: Sun May 22, 2011 6:14 pm
Location: New Hampshire, US
Been thanked: 1 time

Re: alsa-jack(plugin) or alsa-loop-jack?

Post by i2productions »

Better question is what purpose patching 8 channels of audio through loop would serve? Mixing in x.1 wouldn't be effected, as you're still going to do that in JACK. The only case I could see it being used for is for playing a movie with and x.1 codec. Linux has never done particularly well at actually processing surround signals anyway. If you really needed it for a movie, I would say to shutdown JACK and let ALSA or Pulse take over for that specific use. I just don't see what purpose it would serve in pro-audio work, but please enlighten me if you have such a use case.
ToddMWorth
Established Member
Posts: 225
Joined: Tue Oct 23, 2012 3:59 am

Re: alsa-jack(plugin) or alsa-loop-jack?

Post by ToddMWorth »

I didn't really go for use cases, I just wanted it to be as transparent as possible - I run 8 channels in and out of my pc, they're available on the real alsa card, they're available in jack... I guess it comes down to a desire for symmetry or something, I'd like them to be there in the loopback, too. I had a good think about what you said though, and I had to think real hard about whether it even matters to me, aside from in principle, but in actual practical need for it. I came up with a few in the end though:
External hardware surround mixer
Sampling movies
Sampling or consuming HD from DVB (television)
Testing content that I stream, as though I were a consumer of it who owns a normal surround card

Still, even if I can't think of a practical use case now, I remain biased towards uniformity or parity or symmetry or something... so it works just like the hardware under it. Maybe I'm being 'Sheldon'. I'm good at that :)
Post Reply