ALSA-Programs and JACK together

Post fully complete "how to" guides and tutorials here. This is a great place to get feedback on stuff you might put in the wiki.

Moderators: khz, MattKingUSA

User avatar
Capoeira
Established Member
Posts: 1226
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil

Re: ALSA-Programs and JACK together

Postby Capoeira » Sun Nov 25, 2012 5:02 pm

falkTX wrote:
Capoeira wrote:
reteo wrote:I noticed that you included zita-ajbridge in your package collection... why not use that in place of alsa-in/out?


anybody got this working?

I can't manage to conect to the alsa devices:

Code: Select all

Can't open ALSA capture device 'cloop'.
Can't open ALSA playback device 'ploop'.

I tried the zita stuff some time ago, it seems to work differently than expected.
For once, I could only start it if there was an alsa app running and using the loopback. I don't know if that's intended, but alsa_in/out already works fine, so I skipped this.



I found the solution here: http://web.archiveorange.com/archive/v/ ... jOLOoAUwbk

I had to adress directly to the Loopback device AND force 16bit

It runs GREAT
no cracling in Skype anymore
CPU usage is 1% also

The lines in your script I've changed are now:

Code: Select all

 
system("env JACK_SAMPLE_RATE=%i JACK_PERIOD_SIZE=%i zita-a2j -L -j alsa_in -d hw:Loopback,1,0 2>&1 1> /dev/null &" % (sample_rate, buffer_size))
  system("env JACK_SAMPLE_RATE=%i JACK_PERIOD_SIZE=%i zita-j2a -L -j alsa_out -d hw:Loopback,1,1 2>&1 1> /dev/null &" % (sample_rate, buffer_size))


perhaps you try it out again?

User avatar
Capoeira
Established Member
Posts: 1226
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil

Re: ALSA-Programs and JACK together

Postby Capoeira » Sun Nov 25, 2012 7:01 pm

falkTX wrote:For once, I could only start it if there was an alsa app running and using the loopback..


this was mentioned in the link I posted.
Forcing zita bridge to 16bit (-L) solves this

User avatar
Capoeira
Established Member
Posts: 1226
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil

Re: ALSA-Programs and JACK together

Postby Capoeira » Sun Nov 25, 2012 9:45 pm

I agree that it's kind of unstable


falkTX wrote:I added support for it in my script:
https://github.com/falkTX/Cadence/blob/ ... _daemon.py
(^This version is a lot more recent that the one you have, but requires python3 + PyQt4, and must be run locally to catch jacklib.py)


This only works with cadence, no?

User avatar
Capoeira
Established Member
Posts: 1226
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil

Re: ALSA-Programs and JACK together

Postby Capoeira » Sun Nov 25, 2012 11:28 pm

I updated cadence here in Arch from git and changed "useZita = True" in /usr/share/cadence/src/cadence_aloop_daemon.py,
but starting the bridge in cadence it still uses alsa_in/out

User avatar
Capoeira
Established Member
Posts: 1226
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil

Re: ALSA-Programs and JACK together

Postby Capoeira » Mon Nov 26, 2012 2:30 am

falkTX wrote:
Capoeira wrote:I agree that it's kind of unstable


falkTX wrote:I added support for it in my script:
https://github.com/falkTX/Cadence/blob/ ... _daemon.py
(^This version is a lot more recent that the one you have, but requires python3 + PyQt4, and must be run locally to catch jacklib.py)


This only works with cadence, no?

no, it works as a generic python(3) script. You just need to have jacklib.py at its side (and the asoundrc file set properly, of course).
The previous version had a small jacklib version built-in, but it's much easier to maintain and fix if it uses the the external jacklib.py.


now I got it. it's not using zita-bridge though, see my post above

User avatar
Capoeira
Established Member
Posts: 1226
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil

Re: ALSA-Programs and JACK together

Postby Capoeira » Mon Nov 26, 2012 11:22 am

falkTX wrote:
Capoeira wrote:now I got it. it's not using zita-bridge though, see my post above

You don't need to edit the file manually, just run it with "--zita".
(Editing the file manually won't work, since it later checks for the "--zita" argv and changes 'useZita' accordingly).



I see, worked


BUT, how to do it in Cadence? there is no option to change to zita.

User avatar
lilith
Established Member
Posts: 1022
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Contact:

Re: ALSA-Programs and JACK together

Postby lilith » Sun Jan 08, 2017 9:36 pm

Is there any update on this? I got cracking with the alsa in/out bridge which is totally gone with the zita bridge. However to get the zita bridge running after a reboot is not that straight forward. I stopped cadence and connections several times and re-opend firefox, etc. ... At some point it worked. CPU usage is < 1% (as seen in system monitor zita-j2a/a2j).

One more question: Do I need to do anything else (theoretically) besides starting jack and the alsa -> loop -> jack with zita? E.g. do I have to modify the .asoundrc - file? Once I did some changes in the file (replacing 44100 with 48000), but somehow it was overwritten again. Shoukd I add the zita bridge in this file somehow?

Code: Select all

# ------------------------------------------------------
# Custom asoundrc file for use with snd-aloop and JACK
#
# use it like this:
# env JACK_SAMPLE_RATE=44100 JACK_PERIOD_SIZE=1024 alsa_in (...)
#

# ------------------------------------------------------
# playback device
pcm.aloopPlayback {
  type dmix
  ipc_key 1
  ipc_key_add_uid true
  slave {
    pcm "hw:Loopback,0,0"
    format S32_LE
    rate {
      @func igetenv
      vars [ JACK_SAMPLE_RATE ]
      default 44100
    }
    period_size {
      @func igetenv
      vars [ JACK_PERIOD_SIZE ]
      default 1024
    }
    buffer_size 4096
  }
}

# capture device
pcm.aloopCapture {
  type dsnoop
  ipc_key 2
  ipc_key_add_uid true
  slave {
    pcm "hw:Loopback,0,1"
    format S32_LE
    rate {
      @func igetenv
      vars [ JACK_SAMPLE_RATE ]
      default 44100
    }
    period_size {
      @func igetenv
      vars [ JACK_PERIOD_SIZE ]
      default 1024
    }
    buffer_size 4096
  }
}

# duplex device
pcm.aloopDuplex {
  type asym
  playback.pcm "aloopPlayback"
  capture.pcm "aloopCapture"
}

# ------------------------------------------------------
# default device
pcm.!default {
  type plug
  slave.pcm "aloopDuplex"
}

# ------------------------------------------------------
# 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 2
    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
  }
}

# ------------------------------------------------------
# alsa_out -j alsa_out -dploop -q 1
pcm.ploop {
  type plug
  slave.pcm "hw:Loopback,1,1"
}


Sry, I'm a noob :oops:
https://soundcloud.com/lilith_93

_____________________________
Debian 9 (XFCE) & KXStudio repos

rghvdberg
Established Member
Posts: 919
Joined: Mon May 12, 2014 7:11 am

Re: ALSA-Programs and JACK together

Postby rghvdberg » Mon Jan 09, 2017 6:28 am

Update cadence. There is a switch to use zita instead of alsa in / out in de alsa bridge.

User avatar
lilith
Established Member
Posts: 1022
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Contact:

Re: ALSA-Programs and JACK together

Postby lilith » Mon Jan 09, 2017 9:03 pm

rghvdberg wrote:Update cadence. There is a switch to use zita instead of alsa in / out in de alsa bridge.


thanks, i'm using that already.
https://soundcloud.com/lilith_93

_____________________________
Debian 9 (XFCE) & KXStudio repos


Return to “HOW TOs, Tips & Tricks”

Who is online

Users browsing this forum: No registered users and 1 guest