group delay equalization
 User Name Stay logged in? Password
 Home Forums Rules Articles diyAudio Store Blogs Gallery Wiki Register Donations FAQ Calendar Search Today's Posts Mark Forums Read Search

 PC Based Computer music servers, crossovers, and equalization

 Please consider donating to help us continue to serve you. Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
 27th October 2015, 03:39 PM #21 GDO diyAudio Member     Join Date: Jul 2009 Have fun with your weird nerdish stuff!
CharlieLaub
diyAudio Member

Join Date: Mar 2007
Location: Michigan
Quote:
 Originally Posted by GDO Have fun with your weird nerdish stuff!
Until you posted in this thread yesterday you haven' posted in this forum since 2012, and this is how you choose to do it?

You are really a class act, dude!
__________________

 27th October 2015, 04:43 PM #23 GDO diyAudio Member     Join Date: Jul 2009 Will try to keep away, no problem...
CharlieLaub
diyAudio Member

Join Date: Mar 2007
Location: Michigan
I've done some modeling of the FIR group-delay-correction filter using the technique described earlier in this thread. The results are encouraging.

Here is an overview of what I have done.

1. I start with the desired group delay EQ curve. This was shown earlier in this post or see first attachment.

2. I calculate the corresponding phase lag by integrating, using the definition of group delay. The result is attachment 2. Note the phase is shown unwrapped. This data is still on the equally-logarithmic-spaced frequency grid from another program.

3. In the next step, I interpolate the phase onto the equal-linear-spacing frequency grid that will be used for the discrete transform processing.

4. I then generate the real and imaginary components of the complex number that results for this phase angle, with the magnitude of the response equal to 1.0. These are pretty boring so I don't bother to show them here. I make sure that H(k) = H*(N-k).

5. I take the inverse DFT of the real and imaginary components to transform the response to the time domain. The output has both a real and an imaginary component, however, the imaginary component is essentially zero. To show what is going on I have attached plots of the "beginning" of the real data as well as the "end" (with additional magnification). These correspond to time near zero for positive time values and negative time values.

6. I manipulate the real component of the time domain response (the impulse). The data is shifted "to the right" to move the part of the impulse that is at small negative times (at the "end") to positive time. I then apply a rectangular window to the data, setting everything outside the window to zero. The imaginary component of the time domain response is also set to zero. The remaining non-zero values are the FIR filter coefficients.

7. What will the response of this FIR filter look like? To find out, I perform the forward DFT on the shifted, windowed impulse to bring the data back into the frequency domain. I then calculate and plot the filter SPL, the phase, and finally the group delay. This is shown as the last two attached plots.

The FIR filter magnitude (SPL) is very flat across the 20-20k frequency band, with deviations of much less than 0.1dB. The group delay plot shows that the filter produces the desired group delay EQ, plus latency (frequency independent delay) of about 20.75 milliseconds.

QED.

.
Attached Images
 target_GD_correction.PNG (21.0 KB, 125 views) phase_lag.PNG (21.9 KB, 122 views) time_domain_real_part-FIRST_500.PNG (17.7 KB, 122 views) time_domain_real_part-LAST_500_zoomed.PNG (13.0 KB, 123 views) FIR_filter_frequency_response.PNG (22.7 KB, 121 views) FIR_filter_group_delay.PNG (27.1 KB, 34 views)
__________________

CharlieLaub
diyAudio Member

Join Date: Mar 2007
Location: Michigan
In the post above, the inverse FFT used 32768 points to generate the impulse response, however, after the windowing was applied only 2000 points had non-zero values. This produced a smooth and error free result. Let's see what happens as we reduce the number of coefficients further.

When we window out all but 1000 points from the impulse response (e.g. use 1000 FIR filter taps) some small artifacts start to appear. The first two attachments show the FIR filter SPL and group delay. Some small oscillations are starting to appear in the filter SPL. These are still extremely small, much less than 0.1dB, and are negligible. Small deviations also begin to appear in the group delay, for instance around 100Hz the delay dips slightly before rising and above and below 100Hz there some oscillations are visible. Note that the latency has been reduced.

The next two plots show the result for 800 points. The oscillations have slightly increased but are still not very significant. Again, the latency has been further reduced.

The next two plots show the result for 600 points. The deviations increase further, while latency is reduced as well.

The last two plots show the response for 400 points. At this point we are starting to truncate enough of the impulse that it is having more significant effects. The frequency response now has a large deviation above 10kHz that is off scale in the plot (it reaches -1.5dB before coming back up). The group delay response is starting to show some more significant deviations and oscillations.

It seems that in this case an FIR filter with well under 1000 taps (as low as 600) would be sufficient for correcting the group delay but not changing the frequency response. Another type of window function may allow even fewer points to be used. It's surprising that even with only a few hundred taps, the group delay correction is largely implemented correctly. It remains to double check the time domain response of the truncated FIR filters so see what artifacts, if any, are present there.
Attached Images
 1000_coefficient_FIR_frequency_response.PNG (23.3 KB, 36 views) 1000_coefficient_FIR_group_delay.PNG (27.6 KB, 22 views) 800_coefficient_FIR_frequency_response.PNG (24.1 KB, 21 views) 800_coefficient_FIR_group_delay.PNG (27.4 KB, 21 views) 600_coefficient_FIR_frequency_response.PNG (25.3 KB, 23 views) 600_coefficient_FIR_group_delay.PNG (19.1 KB, 23 views) 400_coefficient_FIR_frequency_response.PNG (28.1 KB, 23 views) 400_coefficient_FIR_group_delay.PNG (27.6 KB, 26 views)
__________________

CharlieLaub
diyAudio Member

Join Date: Mar 2007
Location: Michigan
I did a quick check on the 1000 tap filter and there is no ringing whatsoever in the time domain. See attached plots (same data, just different y-scaling).
Attached Images
 1000_coefficient_FIR_impulse response.PNG (8.9 KB, 42 views) 1000_coefficient_FIR_impulse response-ZOOMED.PNG (18.9 KB, 40 views)
__________________

CharlieLaub
diyAudio Member

Join Date: Mar 2007
Location: Michigan
I've been getting some more experience with the process of generating the FIR filter to EQ delay (e.g. linearize the phase). I discovered it is important to "tailor" the phase so that the real and imaginary components undergo a seamless transition at the half-sampling-rate boundary. Doing this minimizes the noise in the impulse and eliminates some of the ripples and deviations in the resulting filter delay, especially at high frequencies, that can arise after windowing the impulse. You can see an example of this kind of high frequency noise in the zoomed view of the impulse response in the last post.

I have also experimented with a correction filter that provides linear-phase/flat-delay to a lower frequency: 50Hz. Because the filter has non-zero phase changes at lower frequencies than the previous examples, the window width must be increased proportionally. The first attachment shows the filter with 5000 taps in orange with the target delay curve in green. Filter latency is 46 milliseconds because of the window width used. When the width is reduced to 2500 taps some small oscillations in the delay start to appear but the latency is almost halved. Further reduction in the number of taps causes the amplitude of these oscillations to become excessive, however, 2500 taps is still a very economical filter size for creating a linear phase system response to 50Hz. This makes the application of FIR "lightweight" and processing can be done with very little latency.

One other trick that I have implemented can be seen in the plots. Previously the target delay EQ curve had an abrupt transition upwards from zero at low frequency. For the correction down to 50Hz, the slope of this was steeper and the transition more discontinuous. This caused some ringing in the filter response because a very large number of taps is needed to reproduce sharp features. To alleviate the discontinuity, I introduced a smooth transition in place of the discontinuity. This helps the filter have smoother response overall for a given number of taps, and/or allows fewer taps to be used for the same general level of reproduction of the target EQ curve.

By implementing a couple of tricks I have been able to create very lightweight (e.g. a low number of taps) FIR filters that can change the loudspeaker response so that it has linear phase above a user-determined frequency. This is something that I plan to include in future loudspeaker crossover projects.

.
Attached Images
 5000-point-filter-GD.PNG (29.1 KB, 34 views) 2500-point-filter-GD.PNG (32.0 KB, 27 views)
__________________

Last edited by CharlieLaub; 29th October 2015 at 03:57 PM.

 29th October 2015, 04:51 PM #28 Barleywater   diyAudio Member   Join Date: Jan 2008 I'm not sure what you are seeing for plots in post #26. To me it appears that you've got 300 samples of low frequency ringing before apparent peak at about sample 700, and after wards high frequency ringing that trails beyond plot. Not sure what your worries about latency are. 46ms or 23ms, in either case this is useless for live applications, or use with video without using video delay. This is typical group delay results I get with FIR:
 29th October 2015, 06:00 PM #29 CharlieLaub   diyAudio Member   Join Date: Mar 2007 Location: Michigan Sure, that's nice, but how many taps are required (or are you just using some "black box" correction system)? With my filter correction, the group delay would look the same (except possibly smoother) above 50Hz, and rising below that frequency, while using very few taps. Maybe I did not make that clear enough... Honestly I could really care less about live applications. I listen to music and I don't watch any "video". But if I did I could just delay the video stream. Something that's s pretty standard, as you seem to know. As for the impulse response in post #26, this is the impulse of the FIR FILTER when different frequencies are delayed by different amounts that are essentially the REVERSE of the usual delay for those frequencies. Instead of more delay for low frequencies and less to zero delay for high frequencies the impulse shown has more delay for high frequencies and less delay for low frequencies. This is why the "spike" part of the impulse comes "later" - it's delayed WRT the other frequencies. Maybe you were thinking it was the impulse of the system AND filter? __________________ Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins
CharlieLaub
diyAudio Member

Join Date: Mar 2007
Location: Michigan
To make it more clear, I have attached the group delay for the system+FIR filter delay EQ. In this case the group delay was equalized down to about 60Hz (AKA linear phase). I also did two level of zoom, to make low level details more clear. Please note that these are just the modeled system+filter. I have not yet actually implemented the FIR filter on a real system. This is just my attempt at filter design for a special application, using as few taps as possible.

The filter should be able to make the group delay flat above whatever frequency the user desires. Reducing the lowest frequency of delay correction requires that the number of taps are increased dramatically and I want to use as small of a number of taps as possible. As a result I only EQ the delay above some low frequency where the ear is not very sensitive to delay (e.g. 100Hz or so). If the number of taps was not of concern the delay correction can be applied as low in frequency as desired.
Attached Images
 corrected_system_GD.PNG (24.7 KB, 28 views) corrected_system_GD_ZOOM-10.PNG (25.8 KB, 28 views) corrected_system_GD_ZOOM-1.PNG (27.5 KB, 29 views)
__________________

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Site     Site Announcements     Forum Problems Amplifiers     Solid State     Pass Labs     Tubes / Valves     Chip Amps     Class D     Power Supplies     Headphone Systems Source & Line     Analogue Source     Analog Line Level     Digital Source     Digital Line Level     PC Based Loudspeakers     Multi-Way     Full Range     Subwoofers     Planars & Exotics Live Sound     PA Systems     Instruments and Amps Design & Build     Parts     Equipment & Tools     Construction Tips     Software Tools General Interest     Room Acoustics & Mods     Music     diyAudio.com Articles     Car Audio     Everything Else Member Areas     Introductions     The Lounge     Clubs & Events     In Memoriam The Moving Image Commercial Sector     Swap Meet     Group Buys     The diyAudio Store     Vendor Forums         Vendor's Bazaar         Sonic Craft         Apex Jr         Audio Sector         Acoustic Fun         Chipamp         DIY HiFi Supply         Elekit         Elektor         Mains Cables R Us         Parts Connexion         Planet 10 hifi         Quanghao Audio Design         Siliconray Online Electronics Store         Tubelab     Manufacturers         AKSA         Audio Poutine         Musicaltech         Holton Precision Audio         CSS         exaDevices         Feastrex         GedLee         Head 'n' HiFi - Walter         Heatsink USA         miniDSP         SITO Audio         Twin Audio         Twisted Pear         Wild Burro Audio

 Similar Threads Thread Thread Starter Forum Replies Last Post pargon Subwoofers 5 29th January 2010 07:37 PM 69stingray Multi-Way 12 1st November 2005 11:27 AM BAM Multi-Way 1 23rd November 2003 05:07 PM OMNIFEX Multi-Way 0 14th March 2003 07:30 AM Ignite Multi-Way 6 13th November 2001 05:52 AM

 New To Site? Need Help?

All times are GMT. The time now is 02:52 PM.