Page 2 of 4

Re: 2 interfaces, 2 jackd, couple them

Posted: Thu May 11, 2023 8:14 pm
by tavasti

Ok, bit more digging, I think I now have answer how this is done.

In jack2 1.9.18 there is new additions, modules zalsa_in and zalsa_out, which are zita-a2j/j2a as jack2 modules. See https://jackaudio.org/news/2021/04/15/j ... lease.html

Then, by mistake (I assume) falktx removed them, and also jack_load in version 1.9.22. So before he adds them back, get git version 1.9.21, and build it:

Code: Select all

./waf configure --prefix=/usr/local/stow/jack2-git --zalsa=yes --dbus --example-tools  --enable-pkg-config-dbus-service-dir
./waf build
./waf clean
cd /usr/local/stow/; sudo stow -v jack2-git ; cd -  

If you don't use stow for keeping your /usr/local clean, then adapt those commands a bit.

If you use jackdbus, you need to restart dbus (or is there way to say it refresh config without restart?) to get new version running. Note that restarting dbus may kill your session (did for me).

Then on usage goes like this:

Code: Select all

jack_load  -i "-d hw:Ultra -c6" ultra-out zalsa_out
jack_load  -i "-d hw:Ultra -c6" ultra-in zalsa_in

Options available for those modules can be seen with

Code: Select all

jack_load  -i "-d hw:Ultra -h" zalsa_in

Options will be shown in jack log, for me it is .log/jack/jackdbus.log

Here is what I found in log:

Code: Select all

zalsa_in-0.4.0
(C) 2012-2018 Fons Adriaensen  <fons@linuxaudio.org> 
Use ALSA capture device as a Jack client.
Options:
  -h                 Display this text
  -j <jackname>      Name as Jack client [zalsa_in] 
  -d <device>        ALSA capture device [none]
  -r <rate>          Sample rate [48000]       
-p <period> Period size [256] -n <nfrags> Number of fragments [2]
-c <nchannels> Number of channels [2] -S Word clock sync, no resampling -Q <quality> Resampling quality, 16..96 [auto] -I <samples> Latency adjustment [0] -L Force 16-bit and 2 channels [off] -w Wait until soundcard is available [off] -v Print tracing information [off]

Re: 2 interfaces, 2 jackd, couple them

Posted: Fri May 12, 2023 4:10 am
by tavasti
tavasti wrote: Thu May 11, 2023 8:14 pm

In jack2 1.9.18 there is new additions, modules zalsa_in and zalsa_out, which are zita-a2j/j2a as jack2 modules. See https://jackaudio.org/news/2021/04/15/j ... lease.html

Then, by mistake (I assume) falktx removed them, and also jack_load in version 1.9.22. So before he adds them back, get git version 1.9.21, and build it:

Ok, it was not mistake, jack_load and also those zalsa-modules were moved to repo https://github.com/jackaudio/jack-example-tools

So solution would be building that, but I don't start trying if that works and what is needed for building it.


Re: 2 interfaces, 2 jackd, couple them

Posted: Fri May 12, 2023 11:29 am
by merlyn

It's possible to use jack_control to do this.

Code: Select all

$ jack_control
Usage: jack_control [command] [command] ...
Commands:
    shell                      - execute commands from stdin until End Of File (Ctrl+D in terminal)
    exit                       - exit jack dbus service (stops jack server if currently running)
    help                       - print this help text
    status                     - check whether jack server is started, return value is 0 if running and 1 otherwise
    start                      - start jack server if not currently started
    stop                       - stop jack server if currently started
    sm                         - switch master to currently selected driver
    dl                         - get list of available drivers
    dg                         - get currently selected driver
    ds <driver>                - select driver
    dp                         - get parameters of currently selected driver
    dpd <param>                - get long description for driver parameter
    dps <param> <value>        - set driver parameter
    dpr <param>                - reset driver parameter to its default value
    asd <driver>               - add slave driver
    rsd <driver>               - remove slave driver
    il                         - get list of available internals
    ip <name>                  - get parameters of given internal
    ipd <name> <param>         - get long description for internal parameter
    ips <name> <param> <value> - set internal parameter
    ipr <name> <param>         - reset internal parameter to its default value
    iload <name>               - load internal
    iunload <name>             - unload internal
    ep                         - get engine parameters
    epd <param>                - get long description for engine parameter
    eps <param> <value>        - set engine parameter
    epr <param>                - reset engine parameter to its default value

Again, jack_control is something that there is not a lot of documentation for. In fact hardly anyone seems to know it even exists, but I found the output above enough to figure it out.


Re: 2 interfaces, 2 jackd, couple them

Posted: Fri May 12, 2023 11:47 am
by tavasti
merlyn wrote: Fri May 12, 2023 11:29 am

It's possible to use jack_control to do this.

Code: Select all

$ jack_control
Usage: jack_control [command] [command] ...
Commands:
    il                         - get list of available internals
    ip <name>                  - get parameters of given internal

Again, jack_control is something that there is not a lot of documentation for. In fact hardly anyone seems to know it even exists, but I found the output above enough to figure it out.

But for some reason it does not cover zalsa-modules:

Code: Select all

tavasti@hermo:~$ jack_control il
--- internals list
audioadapter
profiler
netadapter
netmanager
tavasti@hermo:~$ jack_control ip zalsa_in
--- get internal parameters (type:isset:default:value)
DBus exception: org.jackaudio.Error.InvalidArgs: Invalid container address 'internals':'zalsa_in':'(null)' supplied to method 'GetParametersInfo'.
tavasti@hermo:~$ jack_load -i "-d hw:Ultra" zalsa_in
zalsa_in is running.
client name = zalsa_in

Re: 2 interfaces, 2 jackd, couple them

Posted: Fri May 12, 2023 11:50 am
by merlyn

Does this work?

Code: Select all

$ jack_control ip audioadapter

Re: 2 interfaces, 2 jackd, couple them

Posted: Fri May 12, 2023 11:56 am
by tavasti
merlyn wrote: Fri May 12, 2023 11:50 am

Does this work?

Code: Select all

$ jack_control ip audioadapter

Yeah, that works.


Re: 2 interfaces, 2 jackd, couple them

Posted: Fri May 12, 2023 11:58 am
by merlyn

We can conclude that zalsa_in is not an internal. I found audioadapter to be the best. I haven't tried zalsa_in.


Re: 2 interfaces, 2 jackd, couple them

Posted: Sat May 13, 2023 11:02 am
by tavasti
artix_linux_user wrote: Sat May 13, 2023 8:21 am

It is interesting to read here about using 2 interfaces.
Having said this, from my perspective, it seems, this is just more a theoretically academic discussion then a real life scenario.
I want many in and outputs? I would use an audiointerface with many in- and outputs.
For me there would be exactly one use case scenario for 2 audio interfaces in one PC or notebook:
you want for whatever reason use jack1 instead of pipewire-jack but you still want to hear for example an audio stream from firefox while working and recording with a jack client.
All other scenarios are more academic then really necessary.
Generally spoken, there is one thumb rule:
Like in real life, there is only one master (clock) - there cant be two.
As said before, the clock source can be internal or external; you can use aes/ebu, spdif, smux, adat or madi for that purpose or as mentioned before you can use a word clock generator, even if your audio interface does not have any wordclock ports:
you can pipe the wordclock signal into spdif cable for example.
cheerz

That is your elitistic point of view. From your point, my music production isn't real life case, because I use 2 interfaces, have done it before and will use also after this. Haven't noticed any problems on that, but sure, that does not mean there isn't. I got M-Audio Fast Track Ultra for getting rid of using more than one interface, but unfortunately spdif input does not work (maybe config issue, but so old interface that could not find more info)

Yeah, I would be willing to use one interface, but getting one that would have spdif input would cost more than 250€ (Behringer UMC1820 or Focusrire Scarlet 8i6).

Sure there is elitists on every side of life, but for me sufficient solution is enough.


Re: 2 interfaces, 2 jackd, couple them

Posted: Sat May 13, 2023 11:19 am
by merlyn

@artix_linux_user It might be an idea not to hit the weed so hard before posting. We might get more sense out of you that way.

If you had read the thread you would know that one use case is for a synth with a USB output. More and more devices have a USB out, like drum machines, synths and groove boxes. Without some way of having multiple ins, these USB connections can't be used with a DAW. On Macs, this has been addressed with the 'aggregate device', which apparently works OK. Windows body swerves this, as Windows users can do no more than double click the ASIO installer and expect it to work.

With all these devices with USB, multiple devices is a real world thing.


Re: 2 interfaces, 2 jackd, couple them

Posted: Sat May 13, 2023 12:49 pm
by merlyn
artix_linux_user wrote: Sat May 13, 2023 12:12 pm

Yeah, lets talk about crazy sound machines that do not have sound outputs but only usb ports so you rely on drivers - what a nice idea to earn a lot of money.

Let's deal with the technical aspects. These devices I'm talking about have USB ports in addition to analogue audio out.

So you can not run these synths without a computer.

Again, reading the thread would have helped. I don't know of a synth that has only USB out.


Re: 2 interfaces, 2 jackd, couple them

Posted: Sat May 13, 2023 12:58 pm
by merlyn

Well, thanks for that steaming pile of horse manure.

To get back somewhere near the track -- @tavasti did audioadapter work when using jack_control ?


Re: 2 interfaces, 2 jackd, couple them

Posted: Sat May 13, 2023 1:24 pm
by khz

I ask for a respectful, appreciative tone. See: viewtopic.php?t=270, https://www.gnu.org/philosophy/kind-communication.html. Thank you.

Among many other devices, https://mod.audio/dwarf/as well as SSL Big SiX have optional USB I/O. If you absolutely want to archive or even publish your "$art".


Re: 2 interfaces, 2 jackd, couple them

Posted: Sat May 13, 2023 1:28 pm
by tavasti
merlyn wrote: Sat May 13, 2023 12:58 pm

To get back somewhere near the track -- @tavasti did audioadapter work when using jack_control ?

I can't see any relevant parameters that would be likely to make it working (see my posts may 11, only getting noise), so cannot see why it would make any difference to jack_load. And zalsa_in/zalsa_out were recommended by falktx who maintains jack code. In my previous OS (Ubuntu 18.04) audioadapter worked, but that time I had different audio interface. And sure, difference can be also jack version.


Re: 2 interfaces, 2 jackd, couple them

Posted: Sat May 13, 2023 2:01 pm
by merlyn

After four years I have some idea what is going on here:

bluebell wrote: Thu Nov 28, 2019 6:13 am

The ringbuffer increased after some minutes of operation to ridiculous large values.

The ringbuffer, which I think is the resampling buffer, has a default value of 32768. From my audioadapter parameters that worked I set the ringbuffer to a fixed size of 512 samples

Code: Select all

ring-buffer: Fixed ringbuffer size (uint:set:32768:512)

If left on the default, the ringbuffer doesn't start at 32768 -- that is the maximum. I think it starts at whatever the JACK buffer is set to but the buffer doubles in size every time there is an xrun, some of which can't be heard. This is why to get sensible operation a fixed ringbuffer must be used.

Also audioadapter will use the default sampling rate unless you tell it otherwise. Is that the problem, tavasti?


Re: 2 interfaces, 2 jackd, couple them

Posted: Sat May 13, 2023 2:31 pm
by tavasti
merlyn wrote: Sat May 13, 2023 2:01 pm

Also audioadapter will use the default sampling rate unless you tell it otherwise. Is that the problem, tavasti?

No, I don't think so:

Oh it does not work that great. When started recording, I am getting just noise, and there is error in logs:

../linux/alsa/JackAlsaAdapter.h:327, unable to set format to either 32-bits or 16-bits : Invalid argument(-22)

And if jack maintainer suggests using other module, and that works, I don't see point in hitting head to wall.