[Jack-Devel] What about the number of buffers?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[Jack-Devel] What about the number of buffers?

Holger Marzen
What is the difference between
  jackd -n2 -p192
and
  jackd -n3 -p128

Both give a total of 384 samples in buffers.
What's the difference for jackd?

Regards
Holger
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: What about the number of buffers?

Ralf Mardorf
On Wed, 2019-08-07 at 16:59 +0200, Holger Marzen wrote:
> What is the difference between
>   jackd -n2 -p192
> and
>   jackd -n3 -p128

Anything other than -n2 is for esoteric reasons:
https://wiki.linuxaudio.org/wiki/list_of_jack_frame_period_settings_ideal_for_usb_interface

There might be some truth behind the theory, but in practise something
like 128 or 256 frames, 2 periods/buffer at 48 KHz works without issues.


_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: What about the number of buffers?

Holger Marzen
On Wed, 7 Aug 2019, Ralf Mardorf wrote:

> On Wed, 2019-08-07 at 16:59 +0200, Holger Marzen wrote:
> > What is the difference between
> >   jackd -n2 -p192
> > and
> >   jackd -n3 -p128
>
> Anything other than -n2 is for esoteric reasons:
> https://wiki.linuxaudio.org/wiki/list_of_jack_frame_period_settings_ideal_for_usb_interface

To get whole 1 ms chunks the example section recommends many
combinations with n=3.

But that's not my question. I'd like to know if there is a difference
for jackd or jack clients between combinations of n and p that result in
the same number of samples in the buffers.
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: What about the number of buffers?

Tim-2
In reply to this post by Holger Marzen
On 8/7/19 10:59 AM, Holger Marzen wrote:

> What is the difference between
>    jackd -n2 -p192
> and
>    jackd -n3 -p128
>
> Both give a total of 384 samples in buffers.
> What's the difference for jackd?
>
> Regards
> Holger

Should not make a difference for clients, they would
  simply see a 384 buffer size in both cases.
Although, I'm not sure 192 is an allowable period size.

Some technical notes from my MusE code, -n appears to
  only affect audio output ports:

For Jack audio:
// For at least the ALSA driver (tested), the input port
//  latency is always 1 period while the output port latency
//  is always n periods (or n-1 periods for Jack1 or Jack2 Sync mode).
// In other words, the Jack command line -n (number of periods)
//  ONLY applies to audio output ports.

For Jack midi:
// For at least the ALSA seq driver (tested), the input port
//  latency is always 1 period while the output port latency
//  is always 2 periods REGARDLESS of Jack command line -n (periods).

Tim.
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: What about the number of buffers?

Robin Gareus
On 8/7/19 9:59 PM, Tim wrote:

> On 8/7/19 10:59 AM, Holger Marzen wrote:
>> What is the difference between
>>    jackd -n2 -p192
>> and
>>    jackd -n3 -p128
>>
>> Both give a total of 384 samples in buffers.
>> What's the difference for jackd?
>>
>> Regards
>> Holger
>
> Should not make a difference for clients, they would
>  simply see a 384 buffer size in both cases.

Nope. The client (jack process cycle) block-size is 192 in this case.

The period configuration is ALSA specific and only affects hardware
playback.

The total round-trip latency is likely be longer. That depends on the
driver and kernel side buffering which is sometimes aligned to powers or
two.  With -p 192, the input buffer is also 192 samples/channel.

In synchronous mode (jack1, or jack2 -S), processing happens in the
following order. Each letter represents a "-p" number of samples (per port).

time    +---------->
Input   :   ABCDEF
Process :   .ABCDE
Out. n=2:   ..ABCD
Outp n=3:   ...ABC


Jack2's async mode adds one period of playback latency. Instead of
synchronous "Read", "Process", "Write". jack2 in async mode does:

- Read from the capture device
- Write result of previous cycle to the playback device
- Process

> Although, I'm not sure 192 is an allowable period size.

For jack-clients it is, it can be any number between 1 and 8192. Some
hardware devices impose a lower limit though.

ciao,
robin
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: What about the number of buffers?

Tim-2
On 8/7/19 4:38 PM, Robin Gareus wrote:

> On 8/7/19 9:59 PM, Tim wrote:
>> On 8/7/19 10:59 AM, Holger Marzen wrote:
>>> What is the difference between
>>>  ???? jackd -n2 -p192
>>> and
>>>  ???? jackd -n3 -p128
>>>
>>> Both give a total of 384 samples in buffers.
>>> What's the difference for jackd?
>>>
>>> Regards
>>> Holger
>>
>> Should not make a difference for clients, they would
>>  ??simply see a 384 buffer size in both cases.
>
> Nope. The client (jack process cycle) block-size is 192 in this case.

...

Right. Sorry, I goofed bigly, I was referring to how -n affects
  total latencies seen.

T.
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: What about the number of buffers?

crocket
In reply to this post by Ralf Mardorf
Do recent usb soundcards need "-n 3"?

On Thu, Aug 8, 2019 at 3:31 AM Ralf Mardorf <[hidden email]> wrote:
On Wed, 2019-08-07 at 16:59 +0200, Holger Marzen wrote:
> What is the difference between
>   jackd -n2 -p192
> and
>   jackd -n3 -p128

Anything other than -n2 is for esoteric reasons:
https://wiki.linuxaudio.org/wiki/list_of_jack_frame_period_settings_ideal_for_usb_interface

There might be some truth behind the theory, but in practise something
like 128 or 256 frames, 2 periods/buffer at 48 KHz works without issues.


_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: What about the number of buffers?

David Nielson-2
On Thu, 2019-08-08 at 12:49 +0900, crocket wrote:
> Do recent usb soundcards need "-n 3"?
>

I have a Focusrite Scarlett 2i2 here that accepts -n2 or -n3 and all
values of p from 64-8192. (8191 is prime, btw.) I was shocked because
I thought all USB interfaces needed -n3, so... idk. YMMV.

The two RME PCI interfaces I have require -n2 and -p must be a power of
2 between 64 and 1024. I haven't fully tested the HDA and HDMI devices
in the house but they seem to have similar restrictions.

$0.03

David Nielson

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: What about the number of buffers?

Ralf Mardorf
In reply to this post by crocket
On Thu, 8 Aug 2019 12:49:42 +0900, crocket wrote:

>On Thu, Aug 8, 2019 at 3:31 AM Ralf Mardorf wrote:
>> On Wed, 2019-08-07 at 16:59 +0200, Holger Marzen wrote:  
>> > What is the difference between
>> >   jackd -n2 -p192
>> > and
>> >   jackd -n3 -p128  
>>
>> Anything other than -n2 is for esoteric reasons:
>>
>> https://wiki.linuxaudio.org/wiki/list_of_jack_frame_period_settings_ideal_for_usb_interface
>>
>> There might be some truth behind the theory, but in practise
>> something like 128 or 256 frames, 2 periods/buffer at 48 KHz works
>> without issues.
>Do recent usb soundcards need "-n 3"?

Seemingly USB's packet size is the reason for the 1 ms cadence. I don't
have a clue if this is the case for USB 3. The Focusrite 3rd generation
Scarlett series are USB 3 audio interfaces, but I don't know if they
still work with Linux. At https://www.gearslutz.com/ forums you could
ask and probably would get a reply from Focusrite.

I once tested a Presonus Audiobox 1818VSL and I own a Focusrite
Scarlett 18i20 2nd generation, but I never tested 3 periods/buffer,
since 2 periods/buffer just do the job, even if the latency isn't a
multiple of 1ms. With USB I even get way lower latency than is
possible with a TerraTec PCI and a RME PCIe card on at least two used
Linux machines. On the newer machine I even don't unbind USB ports,
respl. I don't care about IRQs at all.

YMMV!

--
https://soundcloud.com/der-lichtecho-plan
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: What about the number of buffers?

Ralf Mardorf
On Thu, 8 Aug 2019 07:11:38 +0200, Ralf Mardorf wrote:
>The Focusrite 3rd generation Scarlett series are USB 3 audio
>interfaces

Pardon, they are at least using USB-C type connectors, I don't know if
this means they are using USB 3.

--
pacman -Q linux{,-rt{-cornflower,-pussytoes,,-securityink}}|cut -d\  -f2
5.2.6.arch1-1
5.2_rt1-0
5.0.21_rt16-1
5.0.19_rt11-1
4.19.59_rt24-0
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: What about the number of buffers?

Holger Marzen
In reply to this post by Tim-2
On Wed, 7 Aug 2019, Tim wrote:

> On 8/7/19 10:59 AM, Holger Marzen wrote:
> > What is the difference between
> >    jackd -n2 -p192
> > and
> >    jackd -n3 -p128
> >
> > Both give a total of 384 samples in buffers.
> > What's the difference for jackd?
> >
> > Regards
> > Holger
>
> Should not make a difference for clients, they would
>  simply see a 384 buffer size in both cases.
> Although, I'm not sure 192 is an allowable period size.

It is. But there are some clients that need powers of 2, e.g. the
Guitarix convolvers that handle impulse responses. I read that you can
do FFT even with non-powers-of-2. I use Klangfalter for my impulse
responses and noticed no flaws when using non-powers-of-2.

Regards
Holger
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org