jack2 icon indicating copy to clipboard operation
jack2 copied to clipboard

No audio when replacing zita-a2j with internal zalsa client

Open danielnelson opened this issue 4 years ago • 5 comments

Describe the bug

I'm trying to move from the zita-ajbridge over to the new internal client. I am using zita-a2j successfully in order to read from a alsa loopback device, but when replacing it with zalsa_in I'm unable to hear any audio.

Environment

  • JACK Version: Which version of jack2 are you using? (e.g. the output of jackd --version or a git commit checksum)
    $ jackd --version
    jackdmp version 1.9.18 tmpdir /dev/shm protocol 8
    
  • Operating System: What operating system or distribution in which version are you using? (e.g. Linux, macOS, Windows) Gentoo Linux
  • Installation: How did you install jack2? (e.g. package manager, from source) Package manager

Steps To Reproduce

I have a script like this to setup everything:

/usr/bin/jackd -R -ddummy -r48000 -p1024 &
jack_wait -w
jack_load zalsa_in -i "-j alsa -d hw:Loopback,1,0 -L"
jack_load zalsa_out -i "-j dock -d hw:Dock"
jack_connect zalsa_in:capture_1 zalsa_out:playback_1
jack_connect zalsa_in:capture_2 zalsa_out:playback_2

Expected vs. actual behavior

Actual behavior is there is no audio. (Jack aware application are working with zalsa_out)

Expected behavior is to hear audio on the device hooked to zalsa_out.

Here is the output:

jackdmp 1.9.18
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2021 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
`default' server already active
Failed to open server
server is available
zalsa_in is running.
client name = zalsa_in
zalsa_out is running.
client name = zalsa_out

Extra Info

This is the script I use currently with zita-ajbridge and it is working without issue.

/usr/bin/jackd -R -ddummy -r48000 -p1024 &
jack_wait -w

zita-a2j -j alsa -d hw:Loopback,1,0 -L &
zita-j2a -j dock -d hw:Dock &
zita-j2a -j laptop -d hw:Laptop &
sleep 2
jack_connect alsa:capture_1 laptop:playback_1
jack_connect alsa:capture_2 laptop:playback_2

One extra question, the -j option does not appear to be working either, is this expected?

danielnelson avatar Jul 10 '21 23:07 danielnelson

One extra question, the -j option does not appear to be working either, is this expected?

That is correct, use the jack_load client name option to set that. Example:

jack_load alsa zalsa_in -i "-d hw:Loopback,1,0 -L"

Also, something is wrong here:

jackdmp 1.9.18
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2021 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
`default' server already active
Failed to open server

falkTX avatar Jul 11 '21 00:07 falkTX

That is correct, use the jack_load client name option to set that.

Awesome, thank you!

Also, something is wrong here

Ugh, sorry about that, I must have not cleaned up before running it, here is a rerun. Pretty sure most of the noise here is from jack_wait:

jackdmp 1.9.18
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2021 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
server is available
No jack_get_descriptor entry-point for zalsa_in
zalsa_in is running.
client name = zalsa_in
No jack_get_descriptor entry-point for zalsa_out
zalsa_out is running.
client name = zalsa_out

Running this again I discovered that if I'm already sending audio to the loopback when I start zalsa_in then it does work. However, if there is no audio going to the loopback when I load zalsa_in then there is no sound. I recall that I had a similar problem with zita-a2j, but it went away when I added the -L option.

danielnelson avatar Jul 11 '21 00:07 danielnelson

worth checking if connections are being done properly. maybe everything is working fine, but jack_load returns before the client finishes activation?

falkTX avatar Jul 11 '21 00:07 falkTX

I fixed the client names as you showed above, and I switched the jack_wait command to just be sleep. I also added a -v to the initialization string:

/usr/bin/jackd -R -ddummy -r48000 -p1024 &
sleep 5
jack_load alsa zalsa_in -i "-d hw:Loopback,1,0 -L -v"
jack_load dock zalsa_out -i "-d hw:Dock"
jack_connect alsa:capture_1 dock:playback_1
jack_connect alsa:capture_2 dock:playback_2

The connections appear to be made correctly:

$ jack_lsp -c
system:capture_1
system:capture_2
system:playback_1
system:playback_2
alsa:capture_1
   dock:playback_1
alsa:capture_2
   dock:playback_2
dock:playback_1
   alsa:capture_1
dock:playback_2
   alsa:capture_2

I may have spoken too soon about the -L option, I can't reproduce it working when starting with audio playing.

With the new -v option, I get the following output from jackd:

No jack_get_descriptor entry-point for zalsa_in
playback : not enabled
capture  :
  nchan  : 2
  fsamp  : 48000
  fsize  : 128
  nfrag  : 2
  format : S16_LE
Alsa_pcmi: error on capture pollfd.
Alsa_pcmi: error on capture pollfd.
Alsa_pcmi: error on capture pollfd.
Alsa_pcmi: error on capture pollfd.
Alsa_pcmi: error on capture pollfd.
Alsa_pcmi: error on capture pollfd.
Alsa_pcmi: error on capture pollfd.
Alsa_pcmi: error on capture pollfd.
...snip...

danielnelson avatar Jul 11 '21 01:07 danielnelson

Here is the working output from zita-a2j

$ zita-a2j -j alsa -d hw:Loopback,1,0 -L -v
playback : not enabled
capture  :
  nchan  : 2
  fsamp  : 48000
  fsize  : 256
  nfrag  : 2
  format : S16_LE
Starting synchronisation.
   0.011   0.999999     0
  -0.131   1.000044   430
   0.029   1.000013   431
   0.069   0.999989   431
  -0.002   0.999989   431
  -0.047   1.000018   431
   0.100   0.999979   431
   0.032   0.999970   430
   0.045   0.999984   430
   0.044   0.999954   430
  -0.041   0.999985   430
   0.090   0.999926   429
   0.005   0.999962   428
  -0.160   1.000009   428

I changed my jack_load command to this, it looks like everything works now!:

jack_load alsa zalsa_in -i "-d hw:Loopback,1,0 -L -v -p 256"

danielnelson avatar Jul 11 '21 01:07 danielnelson