• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required as is 20 years of participation in forums (not all true). There are daily reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

DSP filter latency

digitalfrost

Major Contributor
Forum Donor
Joined
Jul 22, 2018
Messages
1,291
Likes
2,322
Location
Palatinate, Germany
I am using EqualizerAPO both for crossover duties as well as overall correction. So far, I used custom made biquad IIR filters in EqAPO to do the crossover (24dB LR). Mind you I have no idea what I'm doing I'm just good at copying others homework.
I measure the whole system with those filters applied and then I use convolution created with DRC-FIR to get the correction done. Latency is important to me, I game on this sytem as well so it's not just for music. At the moment, EqAPO tells me I have about 64ms of latency for a convolution file with 32768 samples. This is good for me but I'd like to keep it under 100ms. If I disable covolution, latency shows 0ms. So that would be my baseline.

I thought it would be nice to try some steeper filters and I downloaded rePhase. If I do a standard 48dB LR highpass at 80hz with the default settings, I get a whopping 185ms delay just from that.

1646573753536.png


Going down with the taps obviously improves it:

1646573782139.png


But the biggest gain can be had by changing the centering.

1646573812380.png


So I am wondering. What are good settings here? I noticed that linear phase filters are quite heavily affected by impulse centering (in their quality) while the minimum phase ones don't seem to care. No biggie I use minimum phase at the moment anyway. So is there any downside to just set the centering to 1? Not even 1%, just the first sample? How many taps do I need? If I set centering to 1 I can use a ridiculous amount of taps without any latency penalty.

Are there any guidelines or best practices that can be understood even by dummies?

I didn't notice any latency penalites from db/oct so what prevents me from using values like 192db/oct? Is there any downside to that?
 

ernestcarl

Major Contributor
Joined
Sep 4, 2019
Messages
2,392
Likes
1,738
Location
Canada
Unfortunately, I can't answer many of your questions myself. @pos might if he reads this, and has the time...

However, in the meantime, you may find an answer already in the dedicated DIY forum thread: https://www.diyaudio.com/community/...nearization-eq-and-fir-filtering-tool.221434/

For me, using the least taps necessary with a linear/minimum phase HPF, I'd go with at least 8192 and set optimization to 'moderate'. At a sample rate of 48kHz this should give you a delay of ~85ms.

1646594248509.png


The phase response won't hit the target exactly when using a minimum phase filter, but it should be close enough. But... I'd rather use an IIR filter for this, honestly, if minimum delay time were a priority.
 

dc655321

Major Contributor
Joined
Mar 4, 2018
Messages
1,564
Likes
2,152
IIR biquads have two samples of delay, by definition. So, around 50 usec for a 44.1kHz input signal.

For linear phase filters, group delay is constant and approximately 1/2 the number of taps divided by sample rate.

The frequency resolution of an FIR filter is proportional to the number of taps. This becomes important when trying to shape response at low frequencies.

Minimum phase FIR filters have variable group delay, hence variable latency, as a function of frequency.

No free lunch is the message.
 

gnarly

Senior Member
Joined
Jun 15, 2021
Messages
484
Likes
575
At the moment, EqAPO tells me I have about 64ms of latency for a convolution file with 32768 samples. This is good for me but I'd like to keep it under 100ms. If I disable covolution, latency shows 0ms. So that would be my baseline.

Hi, assuming EqAPO is running at 44.1kHz (like in your rephase files), the 64ms latency you are getting using a FIR file size of 32768 samples, indicates impulse peak at around 2822 samples, or about 8.6% into the FIR file. (The whole file has a time span of 32768/44100 or .743 sec.)

That means the file is being used more for IIR (minimum phase replication) than for linear phase, which is about impulse peak centering.
I thought it would be nice to try some steeper filters and I downloaded rePhase. If I do a standard 48dB LR highpass at 80hz with the default settings, I get a whopping 185ms delay just from that.

View attachment 190757

Going down with the taps obviously improves it:

View attachment 190758

But the biggest gain can be had by changing the centering.

View attachment 190759

So I am wondering. What are good settings here? I noticed that linear phase filters are quite heavily affected by impulse centering (in their quality) while the minimum phase ones don't seem to care.
Yep, impulse centering is linear phase. But there is nothing to say a FIR file needs to be used as linear phase. As you've noticed, if impulse center is at or near the beginning of the FIR file, the file is being used as minimum phase. Or impulse centering can be placed at the end, for maximum phase work. Or anywhere in between, anywhere if the file, goals depending.
Great tutorial here...https://eclipseaudio.com/fir-filter-guide/

No biggie I use minimum phase at the moment anyway. So is there any downside to just set the centering to 1? Not even 1%, just the first sample? How many taps do I need? If I set centering to 1 I can use a ridiculous amount of taps without any latency penalty.

I use FIR like that, but typically set center to some small number like 100 taps. Sometimes, for unknown reasons, things go wonky when set right at sample 1.
Are there any guidelines or best practices that can be understood even by dummies?

I didn't notice any latency penalites from db/oct so what prevents me from using values like 192db/oct? Is there any downside to that?
A couple of things to remember when using FIR for minimum phase work.

First, just like bi-quads, analog IIR, any minimum phase implementation, we get 90 degrees of phase rotation per every order (each order being 6/dB/oct. Folks debate phase audibility all the time, but at the same time there is a strong consensus that lower order xovers (or hpf/lpf filters) sound better.

Second, when a FIR file is used as IIR replication, with the impulse peak up front, it does not have the frequency resolution of a bi-quad.
The bi-quad has theoretically infinite freq resolution, whereas the FIR file is about how many taps are in play.

For instance, using your last rephase screen with 8192 taps at 44.1kHz. That equals processing time of 8192/44100 or 0.186 seconds.
Freq resolution is bound by the rule F = 1/T. So F = 1/0.186 = 5.38Hz.

That's it....that's all the freq resolution you get, and is like a form of smoothing applied to whatever xover slope or EQ etc, you are trying to use.
It's why rephrase will show some slippage around the knee of a xover when trying to use too much slope for the size of the filter.

This is usually not too big a problem for high-pass p and low-pass with their inherently smooth nature. Until you get into needing a high-pass for the sub itself, where a hpf @ 30 Hz simply needs better resolution than 5Hz.
But it can be a problem for sub EQs that have a higher Q.

Hope all that made sense.
 

ernestcarl

Major Contributor
Joined
Sep 4, 2019
Messages
2,392
Likes
1,738
Location
Canada
@gnarly

Thanks for the explanation! In my test it works very well. I do not foresee myself using this anytime soon since I still keep my IIR EQ in JRiver separate with the FIR phase EQ, but this might come in handy for others out there.

Some of my results replicating my current right surround (Rs) EQ using only rePhase:

FREQUENCY MAGNITUDE (FDW 15 cycles)
1646685660472.png


FREQUENCY PHASE (FDW 15 cycles)
1646685667741.png



rePhase window
1646685735181.png


16384 taps at 48kHz sample rate with 1% centering gives out an ~3.4 ms delay
 
Last edited:

ernestcarl

Major Contributor
Joined
Sep 4, 2019
Messages
2,392
Likes
1,738
Location
Canada
@digitalfrost

Were you able to reduce the FIR delay successfully for your use case?


... I've been experimenting some more with the centering settings in rePhase and found that I could use the maximum taps, yet still keep the total delay relatively as low as I want. For instance, I figured that if I take advantage of the very steep roll-off already present in my front mains, I could actually get away with only a "partial EQ".

1646929507628.png



7.3 ms was the amount of delay necessary for the mains to align best with the sub given the phase profiles:


FDW 15 cycles (closed ports)
1646932104842.gif

*old settings used built-in internal DSP low cut filter of the monitors -- the native delay always being around 3 ms either way.

Hmmn... not so easy for me to say which is "better" given the summed responses are so similar. Widely overlapping range seems to be between 50 - 250 Hz. The new mixed phase xo EQ, while reduces GD by a few milliseconds, however, also increases the xo dip around 135 Hz.

Sorry, I know I'm grappling with what must be rather stupidly insignificant differences here. ;)
 
OP
digitalfrost

digitalfrost

Major Contributor
Forum Donor
Joined
Jul 22, 2018
Messages
1,291
Likes
2,322
Location
Palatinate, Germany
I have to say after the initital explantion by gnarly, I tought I might be better off staying with my biquad filters. I mean yeah, I built my sats closed and they have their rolloff at 80hz, so I could probably get away using a 12db/oct highpass for them and join the subs at 24db/oct. But, at the moment I don't feel changing anything would be worth it. After all I'm already at 24db/oct with 0 latency.
 

ernestcarl

Major Contributor
Joined
Sep 4, 2019
Messages
2,392
Likes
1,738
Location
Canada
I have to say after the initital explantion by gnarly, I tought I might be better off staying with my biquad filters. I mean yeah, I built my sats closed and they have their rolloff at 80hz, so I could probably get away using a 12db/oct highpass for them and join the subs at 24db/oct. But, at the moment I don't feel changing anything would be worth it. After all I'm already at 24db/oct with 0 latency.

No worries. I figure gaming is something you absolutely must keep delay to an absolute minimum. I notice anything more than 10ms already starts becoming noticeable in streamed videos for me because of the contributing total system delay in the chain. FIR tweaking seems to be one of the few things left for me to do as I see little else to optimize.
 

DWPress

Addicted to Fun and Learning
Forum Donor
Joined
May 30, 2018
Messages
649
Likes
790
Location
MI
I've no worries synching to video as I'm all 2 ch stereo here but thanks for the work and information!

This might help with helping the delay in my playback zones, one zone is a 3 way XO done in rePhase and in another nearby zone a traditional set of 2 way speakers with analog XO. I know the rest of my convolution filters will still affect delay but getting the XO working with a shorter one will definitely help.
 
Last edited:

oversky

Active Member
Joined
Apr 22, 2021
Messages
153
Likes
148
There is a fixed latency of 10 ms that comes from the buffering for APO processing. You get this latency whenever any APO (also any APO bundled with your sound card driver) is enabled and does not increase when E-APO is used in combination with another APO.

Apart from that, the parametric EQ filters do not add a latency, as far as I know, just some phase distortion that varies with frequency. The only command currently implemented that will cause latency is the Delay command, but that is actually its purpose :)

Graphic EQ is also convolution so there isn't much difference between the two. As for the latency, it's probably in nanoseconds rather than milliseconds. Btw. Using peak and other filters for EQ-ing is even much faster (and more versatile).
 

ZolaIII

Major Contributor
Joined
Jul 28, 2019
Messages
2,360
Likes
1,340
As much as I am not crazy latency will be determined by DSP's capabilities to handle workload of given calculations with added system latency (micro ops calls). It's not an issue for music listening (lag), it is regarding synchronisation with video 40 ms is 30 FPS and half of it for progressive 60 FPS (and cetera for gaming les as possible and such).
As EQ Apu is based on the FPU - MCU implementations (at it's best) it's either you get a faster CPU and more responsive MB or simplify the calculation (lower the TFT chunk) or both.
Convolution matrix is pre baked graphic EQ with everything in processing chain already taken into account so it's not computionaly intensive.
What's the system latency without any kind of processing?
 

h2oxide

Member
Joined
Sep 24, 2022
Messages
7
Likes
0
There is a fixed latency of 10 ms that comes from the buffering for APO processing. You get this latency whenever any APO (also any APO bundled with your sound card driver) is enabled and does not increase when E-APO is used in combination with another APO.
Do you know if this is also the case with Sonarworks' new filter aptly referred to as "Zero Latency mode" which is also achieved via APO driver.
 

oversky

Active Member
Joined
Apr 22, 2021
Messages
153
Likes
148
Do you know if this is also the case with Sonarworks' new filter aptly referred to as "Zero Latency mode" which is also achieved via APO driver.
IMPORTANT! True zero-latency monitoring can only be achieved using the SoundID Reference DAW plugin format. The standalone app still has some latency introduced by the virtual device driver chain (latency is affected externally due to the Sonarworks virtual audio driver relationship with the operating system audio engine).


Near-zero latency can now be achieved in the standalone app format too, using our brand new APO driver mode on Windows (less than 10 ms latency introduced), more details here: Audio driver types in SoundID Reference app [WIN]
 

h2oxide

Member
Joined
Sep 24, 2022
Messages
7
Likes
0
I read that however what I wanted to know, specifically, was if it suffered the same aforementioned 10ms latency penalty inherited by APO implementation, or if it may be a lower/different figure.
 

Waxx

Addicted to Fun and Learning
Joined
Dec 12, 2021
Messages
956
Likes
3,419
Location
Wodecq, Hainaut, Belgium
I read that however what I wanted to know, specifically, was if it suffered the same aforementioned 10ms latency penalty inherited by APO implementation, or if it may be a lower/different figure.
APO is used when you use wdm (windows) drivers, asio and wasapi drivers bypass the windows system and have their own latency. It's the reason why asio drivers were invented as the windows latency is a big issue in studio recording and mixing. Good recording interfaces should have a latency that is much lower (<5ms).
 

h2oxide

Member
Joined
Sep 24, 2022
Messages
7
Likes
0
APO is used when you use wdm (windows) drivers, asio and wasapi drivers bypass the windows system and have their own latency. It's the reason why asio drivers were invented as the windows latency is a big issue in studio recording and mixing. Good recording interfaces should have a latency that is much lower (<5ms).
Now you've got me thoroughly confused; this is what Sonarworks quotes about their APO implementation.
Capture.PNG
 

Waxx

Addicted to Fun and Learning
Joined
Dec 12, 2021
Messages
956
Likes
3,419
Location
Wodecq, Hainaut, Belgium
Now you've got me thoroughly confused; this is what Sonarworks quotes about their APO implementation.
View attachment 233159
There is an option to use it with Wasapi (and not even with all drivers), but it's not standard. It needs to be activated and then the latency is also there. And it is a bit defeating the point of wasapi, which was avoiding the WDM driver and all it's processing. Asio does not allow such insert.
 

h2oxide

Member
Joined
Sep 24, 2022
Messages
7
Likes
0
There is an option to use it with Wasapi (and not even with all drivers), but it's not standard. It needs to be activated and then the latency is also there. And it is a bit defeating the point of wasapi, which was avoiding the WDM driver and all it's processing. Asio does not allow such insert.
Right. All I'm trying to discern is which of the two introduces the least amount of latency between Equalizer APO and Sonarworks SoundID Reference; we've got one at 10ms and the other at supposedly "<10ms", whatever that means. Maybe I should've just opened with this question.
 
Last edited:
Top Bottom