KX mini manual

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

Moderators: MattKingUSA, khz

danboid
Established Member
Posts: 1327
Joined: Sun Aug 26, 2012 11:28 am
Location: England
Has thanked: 1 time
Been thanked: 4 times

Re: KX mini manual

Post by danboid »

I was planning to build the PDF from the wiki, yes. The problem is that, except for the last 'Useful links' chapter, I'll prob have to unembed the links for the PDF.

One of the aspects I really like about AV Linux is that it is desgned to be fully usable straight after installation. Even if you don't have an internet connection and you were new to Linux, you'd still be able to get off the starting blocks because the PDF manual is included on the DVD.

My desire to replicate this great feature for KXStudio is the reason I started the KX docs we have on the wiki now, but when they're 'finished' I think F wants to mirror and/or reformat them for inclusion on his site. I don't think that version will be publicly editable though.
RockHopper
Established Member
Posts: 142
Joined: Thu Apr 18, 2013 3:19 pm
Contact:

Re: KX mini manual

Post by RockHopper »

Sorry to be a nuisance, I just noticed on the “Cadence Introduction” page under “Jack Status” it states that “Latency is the delay in milliseconds between the audio being received by JACK and being sent to the output device.” Cadence (as well as Ardour and other apps) actually only shows the capture latency – the time taken to fill up the audio capture buffer. To get the total latency of a system:

Total latency = capture latency + playback latency + loopback latency

Capture latency = “Buffer Size” / “Sample Rate”
Playback latency = “Periods/Buffer” x “Buffer Size” / “Sample Rate”
Loopback latency = “jack_iodelay result” / “Sample Rate”

I ran jack_iodelay as per your instructions to check this:

Sample Rate: 48000
Buffer Size: 128
Periods/Buffer: 2

Capture latency = 128 / 48000 = 2.7ms
Playback latency = 2 x 128 / 48000 = 5.3ms

Output from jack_iodelay:

444.608 frames 9.263 ms total roundtrip latency
extra loopback latency: 60 frames
use 30 for the backend arguments -I and -O

Loopback latency = 60 / 48000 = 1.2ms

Total latency = 2.7 + 5.3 + 1.2 = 9.2 ms (as confirmed by jack_iodelay)
Last edited by RockHopper on Tue Apr 30, 2013 2:36 pm, edited 1 time in total.
wolftune
Established Member
Posts: 1350
Joined: Fri Feb 24, 2012 7:40 pm
Location: Portland, OR
Been thanked: 2 times
Contact:

Re: KX mini manual

Post by wolftune »

danboid wrote:I was planning to build the PDF from the wiki, yes. The problem is that, except for the last 'Useful links' chapter, I'll prob have to unembed the links for the PDF.

One of the aspects I really like about AV Linux is that it is desgned to be fully usable straight after installation. Even if you don't have an internet connection and you were new to Linux, you'd still be able to get off the starting blocks because the PDF manual is included on the DVD.

My desire to replicate this great feature for KXStudio is the reason I started the KX docs we have on the wiki now, but when they're 'finished' I think F wants to mirror and/or reformat them for inclusion on his site. I don't think that version will be publicly editable though.
But Dan, there is no point in making links readable if there's no internet connection! Anyway, PDFs can include embedded links so that someone reading the PDF can still access the link and even copy the URL as long as they are reading on a computer and not on printed paper. But my point is: if they have an internet connection, they can use the wiki. Now, if they don't have connection, it certainly is nice to include an offline PDF or something, but then links are useless anyway!
Aaron Wolf
Music teacher, scholar
http://wolftune.com
Pablo
Established Member
Posts: 1274
Joined: Thu Apr 17, 2008 9:57 pm
Been thanked: 3 times

Re: KX mini manual

Post by Pablo »

RockHopper wrote:To get the total latency of a system:

Total latency = capture latency + playback latency + loopback latency

Capture latency = “Buffer Size” / “Sample Rate”
Playback latency = “Periods/Buffer” x “Buffer Size” / “Sample Rate”
Loopback latency = “jack_iodelay result” / “Sample Rate”

I ran jack_iodelay as per your instructions to check this:

Sample Rate: 48000
Buffer Size: 128
Periods/Buffer: 2

Capture latency = 128 / 48000 = 2.7ms
Playback latency = 2 x 128 / 48000 = 5.3ms

Output from jack_iodelay:

444.608 frames 9.263 ms total roundtrip latency
extra loopback latency: 60 frames
use 30 for the backend arguments -I and -O

Loopback latency = 60 / 48000 = 1.2ms

Total latency = 2.7 + 5.3 + 1.2 = 9.2 ms (as confirmed by jack_iodelay)
However, note that jack1 and jack2 behave differently.

In jack2, by default, as you noted (just summing capture + playback latency here):

Capture latency + playback latency = “Periods/Buffer + 1” x “Buffer Size” / “Sample Rate”

However, in jack1, there is one period less latency. Like this:

Capture latency + playback latency = “Periods/Buffer” x “Buffer Size” / “Sample Rate”

You can use the synchronous mode in jack2 to make it behave like jack1 and hence reduce latency. Just add --sync to the jackd command.

With the settings above + sync mode, one period counts for 2,7 ms, so total latency will result in 2.7 x 2 + 1.2 (extra in your case) = 6.6 ms
RockHopper
Established Member
Posts: 142
Joined: Thu Apr 18, 2013 3:19 pm
Contact:

Re: KX mini manual

Post by RockHopper »

Pablo wrote:You can use the synchronous mode in jack2 to make it behave like jack1 and hence reduce latency. Just add --sync to the jackd command.
Ah, that’s interesting! I tried to find out more about synchronous/asynchronous mode on the JackAudio wiki. From the table it seems it has to do with multiprocessor support, but the explanation went somewhat over my head:
Jack2 can run in 2 different modes : "asynchronous" when the server does not wait for graph end for a given cycle but just write the outputs computed at the previous cycle. In this case an extra period of latency is added. Jack 2 can also be run in "synchronous" mode, when the server waits for the graph activation end in a given cycle, in which case it works like Jack 1.
I’m guessing this means that in asynchronous mode Jack2 can support multiple processors at the expense of an extra period of latency, and in synchronous mode latency is reduced at the expense of ditching multiprocessor support?
tbritton
Established Member
Posts: 33
Joined: Sun Jan 29, 2012 4:22 am
Been thanked: 2 times

Re: KX mini manual

Post by tbritton »

While discussing latency, keep in mind that you'll want to use even-numbered latency "theoretical" numbers when employing a USB interface, as explained in this article:

List of JACK Frame & Period settings ideal for USB interface

Or link to the same info at the Wiki: http://wiki.linuxmusicians.com/doku.php ... _interface

Feel free to include this table in the PDF if you like.

Terry
Last edited by tbritton on Tue Apr 30, 2013 10:07 pm, edited 2 times in total.
danboid
Established Member
Posts: 1327
Joined: Sun Aug 26, 2012 11:28 am
Location: England
Has thanked: 1 time
Been thanked: 4 times

Re: KX mini manual

Post by danboid »

Rockhopper:

Thanks for pointing that out - it was a pretty major error so I have now fixed it with a hopefully more accurate description.

Pablo:

Thanks for pointing that out but KXStudio ships J2 and I'm not even going to discuss JACK1 vs JACK2 in this manual - its the sorta stuff only devs and advanced users need to know.

Wolftune:

I'm not so sure about embedded links within PDF files - I need to think about that more but whats for sure is the installation chapter isn't much use right now without reproducing the Ubuntu install guide. There are a number of links that are extraneous and non-critical too.
danboid
Established Member
Posts: 1327
Joined: Sun Aug 26, 2012 11:28 am
Location: England
Has thanked: 1 time
Been thanked: 4 times

Re: KX mini manual

Post by danboid »

Hi Terry!

I went through most of the suggested settings on that list but in the end I discovered that I got the best performance using the usual power of 2 buffer sizes 'recommended' by Cadence and 'enforced' by qjackctl (without editing config files, I think) and I've also heard of some plugins having difficulty with non power of 2 buffer sizes.

Thanks for the suggestion!
danboid
Established Member
Posts: 1327
Joined: Sun Aug 26, 2012 11:28 am
Location: England
Has thanked: 1 time
Been thanked: 4 times

Re: KX mini manual

Post by danboid »

Pablo:

Sorry, what I meant to say was I may mention about sync mode but I don't think we need to go into any equations or deeper detail for the purposes of this manual.

Is rockhopper correct in his assumption about async mode enabling SMP support (at the expense of latency)?
Pablo
Established Member
Posts: 1274
Joined: Thu Apr 17, 2008 9:57 pm
Been thanked: 3 times

Re: KX mini manual

Post by Pablo »

I use jack2 in sync mode because years ago, for my simple recording setups, I found it more robust in addition to reducing latency.
However, I am not an expert and I can't add anymore to what faltkx and the jack wiki say.

Danboid: About the kxstudio wiki, great work! I am not sure if it is worth mentioning the sync mode but I agree on keeping it simple.

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

Re: KX mini manual

Post by wolftune »

I'd like to add: The whole recent discussion about buffer sizes, Jack1 vs Jack2, sync mode, all this is totally baffling to me.

Either:

(A) it is really not important and should be left out of the manual
OR
(B) it actually matters, in which case I hope it will be included somewhere because I am confused and want to read an easy-to-follow manual thing about this.
Aaron Wolf
Music teacher, scholar
http://wolftune.com
Pablo
Established Member
Posts: 1274
Joined: Thu Apr 17, 2008 9:57 pm
Been thanked: 3 times

Re: KX mini manual

Post by Pablo »

Maybe this article can shed some light:

http://apps.linuxaudio.org/wiki/jack_latency_tests

Note that this article is not very recent. For example, they refer to "jack_delay" which is the original tool for measuring latency. Jack devs merged jack_delay into jack and they even improved it by adding the recommendations for latency compensation. And they called it jack_iodelay.

Jack_iodelay is the only way to know the total round trip latency, and this includes what the article calls the "processing latency" (which only depends on jack settings, i.e, frames per period, periods per buffer, sample rate and async/sync mode) and the rest, which jack_iodelay calls "extra loopback latency". The latter can and should be compensated, as per jack_iodelay instructions, as the KXstudio wiki already explains.

But there are some caveats.

For PCI cards, at least for my m-audio card, the extra latency doesn't vary with jack settings. It is always 60 frames, more or less, so the total latency only depends on jack settings and the compensation works fine for any settings.

However, it seems that, surprisingly, for USB cards not only the processing latency changes with jack settings, but also the extra latency. Do some test to see what I mean.
danboid
Established Member
Posts: 1327
Joined: Sun Aug 26, 2012 11:28 am
Location: England
Has thanked: 1 time
Been thanked: 4 times

Re: KX mini manual

Post by danboid »

New chapter 'Package Management' done

http://www.wiki.linuxmusicians.com/doku ... management

I decided against covering apt-get, aptitude, dpkg etc etc and instead I have just covered the bare essentials ie how to update, install, remove and fix packages mostly just using Muon.

We could include a link to a more detailed guide to APT and friends but I think I've covered enough to get people going.
danboid
Established Member
Posts: 1327
Joined: Sun Aug 26, 2012 11:28 am
Location: England
Has thanked: 1 time
Been thanked: 4 times

Re: KX mini manual

Post by danboid »

Just the one chapter left to do now!

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

Re: KX mini manual

Post by wolftune »

Hi Dan and all,

I added to and edited the new chapter, mostly clarifying wordings, but also section on adding PPA's and some other items. I think it's better in many ways, but it could use further edits to get to a more accessible point.

I agree overall with being minimal here and not getting into too much CLI stuff. On the other hand, I think it would be easy enough and helpful to just mention in places what the CLI version of each action is. I didn't do that at this time though.

PROBLEM: The wiki is interpreting two hyphens and turning them into an n-dash which means a non-functional command (see the last thing on the page).
Aaron Wolf
Music teacher, scholar
http://wolftune.com
Post Reply