• SONAR
  • Sampling rate and latency
2012/10/17 13:14:03
Sixfinger
I've seen it stated a few times that higher sampling rate settings in Sonar will yield lower latency.
 
Anyone care to explain why this is?
2012/10/17 14:03:01
robert_e_bone
I believe that mathematically you take the sample buffer size and divide it by the sample rate to give you the latency, so that:

512 sample buffer size at 44.1 khz sample rate gives you 11.6 (rounded) ms latency

512 sample buffer size at 96 khz sample rate gives you 5.3 ms latency

It of course comes at a price, that being curb-stomping your CPU at higher sampling rates.

I have a crazy fast CPU and 43 GB of memory, with what I believe is a reasonable audio interface (specs are below), and I still record at 44.1 because I don't want things pushed to the edge where it is a constant worry.

I suppose I will spend some more time tweaking things - but if there is not that much gain to it, I will probably not do too much.  For example, I found that I could trim off about 2 ms in total round trip latency by turning off all kinds of services and disabling my antivirus software and all of that, but that just didn't float my boat for having to lose internet capability during audio processing, so I undid it.

Remember too, that it is the Total Round Trip Latency that is ultimately sets the quality of sound output - that initial calculation is only a piece of that.

Bob Bone

2012/10/17 14:03:02
Bigdogs
I think that this is due to the fact that latency is in part defined by the size of buffers in use. So, if you have a buffer size of 512 samples, a higher sample rate means this buffer stores a shorter length of audio. 
2012/10/17 14:16:19
robert_e_bone
I withdraw my math - as I was typing it I realized that if that were the case then mathematically speaking if I cut the sample buffer size to 256 and the sample rate to 44.1 it should end up somewhere around the same as the 512 at 96.

So I am back to I don't know either.

Sorry if I expended anyone's neuron firings for no reason, 

Bob Bone
2012/10/17 14:31:35
CJaysMusic
Its because of the circumference of the higher rate equals the radius of the buffer squared. So if you take A minus B and divide that by the higher rate and then round that to the nearest point in a linear field, you'll see that its non contextual. 

That is why you have lower latency with higher sample rates
2012/10/17 14:51:03
robert_e_bone
Was that Latin?

WOW - now I REALLY withdraw my math - I am glad I am just a keyboard player and blissfully ignorant of what I really should know about all of this.

You sir, have just exponentially raised my already deep appreciation for what sound guys give to this planet.

Thanks, 

Bob Bone
2012/10/17 15:35:37
gswitz
just bc 512 samples pass during different time durations at different rates doesnt mean your pc handles more work in less time. as a matter of fact, as the queue approaches capacity, latency goes up very fast. see queueing theory. this is a good reason to stay ay lower rates and set buffer appropriately.
2012/10/17 15:41:15
gswitz
ffor a real world test, notice processor work under 44.1, then 88.2 with th2 on the track. you should notice processor load more than double.
2012/10/17 15:57:46
robert_e_bone
Thanks - on my system it seems to work OK at 128 sample buffer size and 44.1 - my interface has an additional setting Fastest/Normal/Safe, and I run on Normal.

If I disable a bunch of services and all that I can change that one setting to Fastest, and it gives me about 2 ms lower latency, but then I don't have any Internet access and all of that, so I don't bother - I just leave it on Normal, whatever that is telling it to do.

Bob Bone
2012/10/18 05:49:27
Bristol_Jonesey
One benefit of using higher sample rates is that most converters sound better at high sample rates because their anti aliasing filter is less than optimal.

But great converters and good programming can solve that problem.

But, higher rates can lead to lower latency because:

Let's say your soundcard buffer is 128 samples.
At 44100 sample rate, this equals 128/44100 ~ 2.9 msec.
At 96000, the same buffer is 128/96000 ~ 1.33 msec.

Latency is measured in samples, the closer those samples are together, the less actual time it takes.
© 2026 APG vNext Commercial Version 5.1

Use My Existing Forum Account

Use My Social Media Account