too much latency

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Post Reply
lucrus
Established Member
Posts: 15
Joined: Mon Nov 14, 2011 6:09 pm

too much latency

Post by lucrus »

Hello *,

my 1st question, or "The Reason Why I Subscribed Here In The First Place (TM)".
I use my Debian (Wheezy) box to apply effects to my electric guitar. I have a Dell Precision M4400 notebook (fairly decent notebook) with integrated audio and that's all about hardware. Not much actually (from a musician perspective), but that's all I have.

When I use it to play guitar, I plug the guitar jack into the mic, then I have qjackctl configured with a patchbay that routes the signal into rakarrack, then jack_mixer and finally outputs the results to the headphone jack. The headphone jack is connected to my guitar combo amplifier.

I use a custom kernel, which means I dowloaded Debian kernel 3.0.0 sources, reconfigured with
CONFIG_PREEMPT=y
CONFIG_HZ_1000=y
CONFIG_HZ=1000

then recompiled and installed.

When I start the jack server I get:

Code: Select all

$ jackd -T -ndefault -d alsa
jackdmp 1.9.7
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2011 Grame.
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
JACK server starting in realtime mode with priority 10
control device hw:0
control device hw:0
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|1024|2|48000|0|0|nomon|swmeter|-|32bit
control device hw:0
configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 2 periods for playback
and that seems to me good news ("JACK server starting in realtime mode").

However when I play the guitar I get sound delayed enough that I can clearly hear the latency. I cannot measure the delay precisely, but I can estimate it in the order of one or two tenths of a second between when I pick the strings and when I hear the corresponding sound. Useless to say, I have no "Music Delay" effect active in rakarrack.
Am I missing anything in my setup? Is it possible at all to have a latency so small that an average human is not able to hear it?

Thanks in advance.
Lucio.
User avatar
spm_gl
Established Member
Posts: 358
Joined: Wed Apr 22, 2009 7:58 am
Location: Spreewald, Germany
Contact:

Re: too much latency

Post by spm_gl »

Welcome!

The answer lies in the jack (or specifically alsa) settings:

Code: Select all

configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 2 periods
that's 21.3ms latency, far too much to play guitar. You can try lowering the frames, to 256 or so, but I really doubt your built-in soundcard can do much better. So you'll be off shopping for interfaces soon. To be able to play properly, you're aiming for under 10ms, better around 3.
--- Spreemusik ---
Jan Fuchsmann, Audio Engineer
Check our blog at http://www.spreemusik.com/blog
lucrus
Established Member
Posts: 15
Joined: Mon Nov 14, 2011 6:09 pm

Re: too much latency

Post by lucrus »

spm_gl wrote: that's 21.3ms latency, far too much to play guitar. You can try lowering the frames, to 256 or so, but I really doubt your built-in soundcard can do much better.
Do you happen to know how can I lower the frames?
spm_gl wrote: So you'll be off shopping for interfaces soon. To be able to play properly, you're aiming for under 10ms, better around 3.
Ok, let's assume I want a new sound interface with around 3ms latency, which ones are supported by Linux?
User avatar
spm_gl
Established Member
Posts: 358
Joined: Wed Apr 22, 2009 7:58 am
Location: Spreewald, Germany
Contact:

Re: too much latency

Post by spm_gl »

lucrus wrote:Do you happen to know how can I lower the frames?
"jackd -d alsa --help" gives:

Code: Select all

-p, --period 	Frames per period (default: 1024)
-n, --nperiods 	Number of periods of playback latency (default: 2)
so you could try -p 256 -n 2
Sometimes it seems "-n 3" works better for onboard soundchips.
lucrus wrote:Ok, let's assume I want a new sound interface with around 3ms latency, which ones are supported by Linux?
There are too many threads on that topic.
--- Spreemusik ---
Jan Fuchsmann, Audio Engineer
Check our blog at http://www.spreemusik.com/blog
lucrus
Established Member
Posts: 15
Joined: Mon Nov 14, 2011 6:09 pm

Re: too much latency

Post by lucrus »

spm_gl wrote: "jackd -d alsa --help" gives:

Code: Select all

-p, --period 	Frames per period (default: 1024)
-n, --nperiods 	Number of periods of playback latency (default: 2)
so you could try -p 256 -n 2
Sometimes it seems "-n 3" works better for onboard soundchips.
For the record, I've tried this:

Code: Select all

$ jackd -R -P 95 -T -ndefault -d alsa --period 128
...
configuring for 48000Hz, period = 128 frames (2.7 ms), buffer = 2 periods
...
It works like a charm, no more audible latency (at least for my ears), and no xruns. I'm more than happy with this solution, thanks a lot!
Post Reply