FIR And FIlter Stuff

Subjects that don't have their own home
chris661
Shed dweller
Posts: 2556
Joined: Mon Feb 22, 2010 7:29 am
Location: Sheffield

#1 FIR And FIlter Stuff

Post by chris661 »

Nick, I'm certain I'm talking about FIR filtering here, although I can understand the confusion - I think it should take more processing, too.

Here are a couple of images to show what I've been doing:

First, I use RePhase to make an impulse file (32-bit .WAV) with the curves I want.

Image

There are two curves there - one red and one blue. Blue is what I've programmed, red is what is achieved with that many taps and that level of optimisation. With a million taps, apparently anything is possible, including a linear-phase boost at 15.6Hz, as well as a (programmed, and implemented) phase swing below 100Hz. There are also some linear-phase EQ changes in the midrange to make it more audibly obvious when the filter is switched in/out - I'm listening through this laptop's built-in speakers.

Next, I import that impulse file into EQ APO:

Image

Which shows the right amount of latency, the EQ curve I programmed into RePhase, 1000000 taps at 192kHz, and 2.1% CPU usage.

In use, if I enable that filter the audio delays for a few seconds before resuming with the audible EQ changes. Watching task manager, CPU usage barely changes.


So, I don't think this is a static delay that's being implemented. What I'm doing with my HiFi is using a system-wide FIR filter to provide a couple of small EQ corrections, and unwrap the phase curves of the passive crossovers I've implemented. In theory, this could be done with any HiFi system that has a computer as the source. My previous post: http://www.audio-talk.co.uk/phpBB3/view ... 80#p175902
Shows the before/after curves of what I've done with my stereo with about 2ms of delay - 1000 taps at 192kHz.

Chris
chris661
Shed dweller
Posts: 2556
Joined: Mon Feb 22, 2010 7:29 am
Location: Sheffield

#2 Re: FIR And FIlter Stuff

Post by chris661 »

Thought I'd put together a more complete report.

My HiFi system is as follows:
- Laptop source. Well, half a laptop - the screen & hinge were damaged, and the result passed on to me. I removed the screen and hinge, connected it to the projector via HDMI, and there's a USB connection to...
- A Cambridge CXA80 amplifier - just a boring HiFi amp. 80w/ch* into 8ohm, plenty of I/O. I mostly wanted it for the built-in USB DAC. Driving..
- A pair of speakers. 8" 2-way with Seas H1252 bass drivers, B&C DE250 compression drivers on 18Sound XT120 horns. I built them to sound decent driven from any amplifier, so there's a pretty extensive crossover: 3rd order lowpass, Zobel and bottomless notch for the 4.5kHz cone breakup on the woofer; 3rd order highpass, series notch to dip the 3kHz region, L-pad for the tweeter. They're drivers that wouldn't typically work together, so they did require quite a lot of persuasion to play nice.

* The Powersoft amplifiers I have provide a readout of peak voltage per channel, so I used that to calculate my power requirements - ideally, it would've been more like 150w/ch, but the difference is less than 3dB, so I decided 80w/ch would be acceptable given that the amplifier does everything else I want.

Image

I set off with my speakers measuring like this:

Image

Which isn't bad in the grand scheme of things. The mic I used is a Beyer MC930, which is a relevant detail: it has a bump around 12kHz on-axis, and because of the directional nature of the thing, the low-frequency pickup isn't accurate. NB - at the listening position, the LF response is different again:
Image
^ Taken with a Beyer MM1 omni measurement mic.

Since I'm using a laptop, I have the option to use EQ APO. It's a piece of software that sits between the media player(s) and the physical output. The first thing I did was flatten out that big 40Hz bump in the low end, and also the 70-80Hz bump.

However, we can go much much further than this.

Cue FIR filtering.

FIR processing is a way of being able to alter the phase and frequency response of a system independently from one another, in exchange for a time penalty.
In an analogue way, if we have a speaker that has a 90-degree phase lag at 100Hz, what we can do is apply an FIR filter to selectively delay some frequencies more than others. ie, 100Hz means one cycle takes 10ms (milliseconds). 90 degrees is 1/4 of a cycle, so if we pass 100Hz straight through our filter and delay everything else by 2.5ms, then the phase shift will effectively be removed.

The way that's all implemented digitally is a beyond my understanding at the moment, but I'm sure I'll get there.

So, going back to the initial measurement again,

Image

We can cast an eye over what we might want to change using FIR processing specifically. Above about 900Hz, the phase response sets off in a negative direction, and stays out there for the duration of the treble. It'd be nice if that was all brought back to zero degrees.
The gentle rise around 3kHz might also be worth attenuating a little, and the bumps at 1.2 and 1.6kHz could also come down a little.
There's also a bump around 500Hz where the phase isn't far off zero anyway, so we might want to make an EQ cut around there, but without altering the phase response.

Below that, there are some peaks and dips due to cancellations in the room.

RePhase is a piece of software that makes FIR filter files for other programs to interpret. EQ APO wants a .WAV file to use for convolution, while my Powersoft amps want a .CSV text file.

So, we import the initial measurement into RePhase.

Image

What I've done here is applied the EQ changes I wanted with a linear-phase EQ (not a typical minimum-phase EQ), and then played with the phase EQ to get things nice and linear above 600Hz-ish.
The blue line is what I programmed, and the red line is the best that the software could do, given the input settings.

Some notes on that:
- Delay, sample rate, and number of taps are related. The overall delay (remember the 2.5ms example above) is approximately proportional to the number of taps used, and inversely proportional to the sample rate.
- A larger number of taps means you can process lower frequencies effectively. Note the discrepancy at 500Hz - there weren't quite enough taps to match what I wanted perfectly, but it's pretty close.
- The green text shows some useful information. The system-wide delay that's caused by this filter is 2.6ms. That's important for me, since this system gets used for movies, so lip sync is a concern. It might have been nice to sort out the +45-degree bit below 400Hz, but more and more taps would be required - more delay, more lip-sync issues. A dedicated HiFi system could have a delay of a couple of seconds before becoming irritating (ie, press Play and the music comes out a short while later), and could therefore have FIR filtering applied over the entire frequency range.

We can see then, that for me at least, using a high sampling frequency was necessary. Normally I'm an advocate for 44.1kHz/16-bit audio (it's more than enough for music playback, no matter what the glossy HiFi mags say - further discussion should be in a separate thread if anyone's interested), but in this case, 192kHz was the answer. That's the highest sampling rate the Cambridge amp would allow, so that was what I went for.

So, I've got an impulse response file from RePhase, and I import it into EQ APO.

Here's a screenshot of when I tried to use a one million tap FIR filter:
Image
Image

That was just to see what would happen. Despite the ridiculous amount of maths involved, CPU usage was still very low. No idea why, but I'll dig around and find the files for Nick to look over.

After arguing with my laptop about signal routing, I managed to get REW to pass signal through EQ APO, and got this:
Image

With the original to compare with:
Image

Which has done everything we'd like. The phase response is now nice and linear, and the frequency response is smoother, too.
NB - it would've been possible to program EQ APO with a load of standard EQ filters to make the frequency response alterations, and then edit the phase response after that. I just decided to roll it all into one.

For me, the improvement is subtle, but I suspect I'm not particularly sensitive to phase shifts. Those of you that are more sensitive to phase shifts will probably find this a rather enjoyable system to listen to.

I think I've covered everything there.

If anyone has any questions, I'll try to answer them.

Chris
User avatar
IslandPink
Amstrad Tower of Power
Posts: 10041
Joined: Tue May 29, 2007 7:01 pm
Location: Denbigh, N.Wales

#3 Re: FIR And FIlter Stuff

Post by IslandPink »

From what I can tell so far, it's not a sort of method that can easily be adapted to working one section of a speaker - looks like you have to run the whole frequency range from it - bearing in mind the delay or latency or whatever.
This is discouraging, as I've worked very hard to get maximum transparency in the upper frequencies, with the ribbons and the special 45 amp. I'm not sure how much of that finesse would survive.
"Once you find out ... the Circumstances ; then you can go out"
vinylnvalves
Old Hand
Posts: 1074
Joined: Sat Jan 26, 2013 12:08 pm

#4 Re: FIR And FIlter Stuff

Post by vinylnvalves »

I think generally you will find that the delay from a long horn or TL will be longer than the minimum delay the electronic crossover induces. I remember when I borrowed the TL bass from you to “play” with I determined that it needed to be 11 ft front of my midrange drivers, due to its group delay.
User avatar
IslandPink
Amstrad Tower of Power
Posts: 10041
Joined: Tue May 29, 2007 7:01 pm
Location: Denbigh, N.Wales

#5 Re: FIR And FIlter Stuff

Post by IslandPink »

I don't think that was group delay - it's just the path length !
"Once you find out ... the Circumstances ; then you can go out"
chris661
Shed dweller
Posts: 2556
Joined: Mon Feb 22, 2010 7:29 am
Location: Sheffield

#6 Re: FIR And FIlter Stuff

Post by chris661 »

IslandPink wrote: Mon May 25, 2020 8:38 pm From what I can tell so far, it's not a sort of method that can easily be adapted to working one section of a speaker - looks like you have to run the whole frequency range from it - bearing in mind the delay or latency or whatever.
This is discouraging, as I've worked very hard to get maximum transparency in the upper frequencies, with the ribbons and the special 45 amp. I'm not sure how much of that finesse would survive.
I suppose you might be able to use FIR filtering over just part of the frequency range, but it would have limitations - you wouldn't be able to delay anything in the HF spectrum to allow the LF to "catch up".

I'm not sure I understand where any transparency might be lacking, though. Is this a bias against digital sources..?
If you have a digital source, then it'd be possible to go digital source into PC, and then out to the DAC - effectively using the PC as a DSP box.

Chris
vinylnvalves
Old Hand
Posts: 1074
Joined: Sat Jan 26, 2013 12:08 pm

#7 Re: FIR And FIlter Stuff

Post by vinylnvalves »

I through I would give REW another go today....... After a couple of hours of playing I am confident I have no idea what I am doing :( . Loop back calibration and mic calibration files loaded, fine... downhill from there. Couldn’t check spl levels suggesting I adjust levels to match my spl meter... I don’t have an spl meter... I have a calibrated mic... :? Managed to get a response out but not confident even with the impulse response, first reflection suggests my room is only a few cm’s across, so couldn’t gate the response. I either need an idiots idiots guide or simpler. I do need to load a more upto date version as my speaker calibration notebook has ver 5 on it. I never got on with it before, strange as I successfully use the ATRa and holmimpulse tools without much issues, I am used to generating FFT’s from strain gauge data and accelerometers for work, or has 10 weeks of working from home frazzled my brain.
chris661
Shed dweller
Posts: 2556
Joined: Mon Feb 22, 2010 7:29 am
Location: Sheffield

#8 Re: FIR And FIlter Stuff

Post by chris661 »

Don't worry about calibrating SPL - all that does is make sure your vertical scale is accurate. Unless I'm doing THD vs SPL measurements, I don't really care about the absolute SPL.

Feel free to post an REW file and I'll take a look.

Chris

PS - Chances are the reflection within a few cm is the baffle edge.
User avatar
IslandPink
Amstrad Tower of Power
Posts: 10041
Joined: Tue May 29, 2007 7:01 pm
Location: Denbigh, N.Wales

#9 Re: FIR And FIlter Stuff

Post by IslandPink »

chris661 wrote: Tue May 26, 2020 12:00 pm Is this a bias against digital sources..?
Chris
Well, there's no question in my mind that the best digital sources don't quite equal good analogue. Some fall very far adrift. Nick's DAC is the most successful I've heard. So it's not a bias, just bitter experience.
However my main gripes with digital in any form are in the frequency from midrange up to high treble.
So my interest would be in what FIR could do for me in the problematic phase areas from lower-mids downwards. However if this comes with the baggage of having to put the upper frequency bands through the whole processing, then I get wary.
"Once you find out ... the Circumstances ; then you can go out"
chris661
Shed dweller
Posts: 2556
Joined: Mon Feb 22, 2010 7:29 am
Location: Sheffield

#10 Re: FIR And FIlter Stuff

Post by chris661 »

Well, it looks like here we part ways. I won't turn this into a digital vs analogue debate, as it's usually the case that neither side will ever change their views. Suffice to say that I consider digital superior, but vinyl can be nice on occasion.

Best of luck with your journey, Mark. If you're still interested in a day with the Powersoft amps when the lockdown is over, feel free to get in touch.

Chris
vinylnvalves
Old Hand
Posts: 1074
Joined: Sat Jan 26, 2013 12:08 pm

#11 Re: FIR And FIlter Stuff

Post by vinylnvalves »

Which is superior, as you say is a battle not worth starting....better outcome than if you started it on the Lencos forum :) though.
From my experience you have to separate the digital source from the xover section. I must admit I like the sound of Vinyl even through the DSP. Obviously you aren’t getting anymore data off the LP than you would be getting of HQ digital recordings - it’s all limited by the 192kHz through the DAC.
I heard a number of years ago a digital pre-amp with a “vinyl” and “tubes” settings. Most of the people including myself preferred the “vinyl” setting. All these settings were are emphasis curves to contour the output away from a flat response. The modern equivalent of tone control. We don’t like flat “audiophile” output, Audionote have been adding a few db around 2.5k for years for that beguiling midrange people apparently like, bit like Lowther shout. Musson curves explain loudness control very well.
What we need to consider in all this is that the pressure transducer(s) at the end of the line are the most inaccurate part of the chain. We accept db’s worth of variation in speaker FR the cheapest amps are magnitudes better than this. Adding horrible inductors into the chain - screw up the signal even more.

I think Mark you will maintain the “superior midrange” detail your amps will give, as they will still be adding their artefacts to the chain, just the input signal will be less screwed up.

I wait to be tarred and feathered for this.......
chris661
Shed dweller
Posts: 2556
Joined: Mon Feb 22, 2010 7:29 am
Location: Sheffield

#12 Re: FIR And FIlter Stuff

Post by chris661 »

To, to clarify, you'd suggest taking the vinyl signal and running it through DSP?
Interesting approach. FWIW, if someone does like the vinyl "sound", then it seems pretty sensible.

If anyone's interested, there's some good reading/watching here:
Article - had to use the Wayback Machine as the original page is down at the mo: https://web.archive.org/web/20200417053 ... young.html
Video: https://xiph.org/video/vid2.shtml

There's a lot of misinformation about digital audio around, and IMO this cuts through the crap.

Chris
vinylnvalves
Old Hand
Posts: 1074
Joined: Sat Jan 26, 2013 12:08 pm

#13 Re: FIR And FIlter Stuff

Post by vinylnvalves »

What I am suggesting is I don’t think the DSP will add anything if done right. The source will add, I have a rule for vinyl, if it was recorded on an analogue system/mixing desk - I would buy it. If it was recorded and mixed in a modern studio then it’s digital, so keep it digital.
Many years ago on one of my infrequent visits to Tom fletcher he let me listen to some of his master recordings of folk and brass - not my cup of tea. ( whilst trying to sell me something) He had borrowed/acquired the old BBC mobile recording truck. The music was recorded in a barn, tracks were single take, captured on 4 microphones, direct cut vinyl no pressing- he was selling them for £80 in the early 90’s, like Jazz in a Pawn Shop, they could make any system sound good. ( we used it when I was flogging linn, naim and kef - my Saturday job in the 80’s) Remastered vinyl done digitally - horrible.
Mtec Joplin Phono stage - this is a digital phono stage that does the RIAA in the digital domain with I2S output amongst others. I went to WAM bake-off where the Joplin an Ear 834 and some ugly looking Allnic were demo’d. The Ear 834 sounded like a valve phono stage... no surprise, the Allnic was better, but the Joplin was most transparent and dynamic. At the end of the bake-off the ulterior motive for the event came out.. he had digitised all his vinyl and wanted to sell the Joplin, the slight issue of £1400 stopped me buying it. I think like lots I enjoy buying old vinyl, cleaning it and maybe playing it :) I like the routine of putting the record on the deck, so digitising it is wrong even if sounds the same as the original vinyl.

So my observation/experience is the characteristics of analogue, even cassettes, people like, good amplification/ processing doesn’t take that away.
On my latest work project we are instrumenting some hardware for dynamic testing - the outputs of the strain-gauges etc go through op amps AD converters close to source before being recorded at many thousand records per second. We wouldn’t have spent millions converting to digital data capture if any artefacts could occur in the signal processing.
User avatar
IslandPink
Amstrad Tower of Power
Posts: 10041
Joined: Tue May 29, 2007 7:01 pm
Location: Denbigh, N.Wales

#14 Re: FIR And FIlter Stuff

Post by IslandPink »

chris661 wrote: Wed May 27, 2020 9:28 am If you're still interested in a day with the Powersoft amps when the lockdown is over, feel free to get in touch.
Thanks - & that's all I was really going to do at this stage - ie. wait for someone to demo something interesting to me - I need to be convinced the approach is worth changing large parts of my existing system, to accommodate.
Last edited by IslandPink on Wed May 27, 2020 8:14 pm, edited 1 time in total.
"Once you find out ... the Circumstances ; then you can go out"
User avatar
IslandPink
Amstrad Tower of Power
Posts: 10041
Joined: Tue May 29, 2007 7:01 pm
Location: Denbigh, N.Wales

#15 Re: FIR And FIlter Stuff

Post by IslandPink »

vinylnvalves wrote: Wed May 27, 2020 7:31 pmThe source will add, I have a rule for vinyl, if it was recorded on an analogue system/mixing desk - I would buy it.
I agree, because most the vast majority of my vinyl collection is pre-1985.
There are a scattering of good re-releases from the audiophile labels in recent years, I think the best I've heard so far are the recent re-releases of the Rendell/Carr quintet work.
"Once you find out ... the Circumstances ; then you can go out"
Post Reply