Forums

Sharp DSP notch filter

Started by Eeyore May 20, 2009
On May 20, 6:54&#2013266080;pm, Eeyore <rabbitsfriendsandrelati...@hotmail.com>
wrote:
> I am proposing to engage on a project regarding mains voltage 'purity' > (and absence of ) with regard to audible clicks and pops in high-end > professional and hi-fi audio equipment. > > Typical EMC filters operate in the RF band and are threfore no use to > filter audio 'in band' noise that can travel through transformer > interwinding capacitance etc. > > I have found some of the TI INA series that will with suitable > preconditioning, tolerate mains voltages and give excellent common-mode > etc rejection. So assembling a 'preamp' front end should be no problem. > > What I will need to do however is to filter all the mains frequencies > and harmonics to a very large degree. > > I imagine I would need for example to null 50 Hz +/- 2 Hz to ~ -100dB. I > have done only a little DSP ( I can't see it happening with analogue > filters ) and I don't even know where to begin with such a severe filter > without affecting the pass-band. Same will go for harmonics up to some > serious number. > > Can &#2013266080;anyone offer some advice as to algorithms ( number of cycles for > such a deep notch ) and even better, a readily available eval board upon > which it could be set up ? Remember I only need to 'hear' audio band, so > 44.1 or 48 kHz sampling should be OK esp given the oversampling ADCs > today. > > Many thanks, &#2013266080; &#2013266080;Graham
I'd be more inclined to sample the AC by phase locking to it. Then you could easily create a comb filter to kill the power line fundamental and harmonics. This implies that you should use a 48kHz sample rate. I'm not sure you need any filtering prior to sampling given the dynamic range of ADCs these days.If your spike is say 70dB down from the carrier (60/50 Hz mains), I can't believe it be significant to the power supply design. Besides basic DSP filtering, you could use LMS to get rid of the fundamental. I suppose you could then LMS for each harmonic.
On 2009-05-21, Eeyore <rabbitsfriendsandrelations@hotmail.com> wrote:
> > That's what we need to find out. Where are the clicks and pops getting in. We > can't randomly spend the client's cash trying this and that. It needs to be a > scientific investigation.
I've been working on a tool at work that looks for problems in digitally filtered audio. One thing that is very effective at finding "pops" is a spectrogram. Even a single-cycle discontinuity shows up as a big line (assuming your inputs are one or two tone such as your power line). And you can look at the spectrogram much faster than you can listen to the equivalent audio. You can also display several sources simultaneously. -- Ben Jackson AD7GD <ben@ben.com> http://www.ben.com/

Jerry Avins wrote:

> Eeyore wrote: > > Jerry Avins wrote: > > ... > > >> How does mains noise get into the equipment? > > > > That's part of the project. To find out. I suspect many different possibilities > > but we can't rebuild the equipment so we need to find out what it's suspectible > > too. Plus we expect to be tackling this problem for many types of equipment. > > > > > >> Power supplies are filtered > >> and regulated, so any noise you experience must enter by another > >> route. You might look into ferro-resonant transformers. These are > >> primarily intended to regulate load voltage, but they also suppress > >> voltage spikes. http://www.elect-spec.com/trnsreg.htm has examples. > >> > >> A capacitive shield between primary and secondary of the power > >> transformer may be all you need. Isolation transformers are built that way. > > > > Yup I know. An ultra-isolation transformer will be part of our 'toolkit' too. > > I've used them before.But we need to know what interference is on the AC line. > > You're on the way, then. Have you analyzed the line's harmonic content? > There's plenty of instrumentation that can do that. One problem is what > I call "dilution". The troublesome signals are transient, and tend to be > swamped by the rest. The spectrum of impulsive noise is rarely impressive.
Well for example the equipment in this instance, an 'antique' EMI mixing desk produces 'clicks' when certain other loads are swiched. Now that varied from an air condition unit drawing some 120A at start-up ( that also dimmed the lighting momentarily until we put that on another supply ) to common or garden area lighting and an outdoor security light switching. The fact that it doesn't always click indicates to me that the phase angle of the supply when swiched is part of the problem which is why I've designed a zero-voltage switching 'add-on' for use with light switches. I also suspect magnetic field interference from 'loopy' wiring. We can only tell by testing the various possibilities and to do that we're going to need to make a certain amount of our own test instrumentation. At another studio we found interference from railway signalling currents. The track ran right behind the plot. An EMC company had passed the site OK because they only measure from 150kHz up and not in the audio band. I have a recording of the signal made a simple pickup loop.That studio, along with some others required a total Faraday cage. Graham

Tim Wescott wrote:

> Eeyore wrote: > > Tim Wescott wrote: > >> On Thu, 21 May 2009 02:54:36 +0100, Eeyore wrote: > >> > >> > I am proposing to engage on a project regarding mains voltage > >> > 'purity' (and absence of ) with regard to audible clicks and pops in > >> > high-end professional and hi-fi audio equipment. > >> > > >> > Typical EMC filters operate in the RF band and are threfore no use to > >> > filter audio 'in band' noise that can travel through transformer > >> > interwinding capacitance etc. > >> > > >> > I have found some of the TI INA series that will with suitable > >> > preconditioning, tolerate mains voltages and give excellent > >> > common-mode etc rejection. So assembling a 'preamp' front end should > >> > be no problem. > >> > > >> > What I will need to do however is to filter all the mains frequencies > >> > and harmonics to a very large degree. > >> > > >> > I imagine I would need for example to null 50 Hz +/- 2 Hz to ~ > >> > -100dB. I have done only a little DSP ( I can't see it happening with > >> > analogue filters ) and I don't even know where to begin with such a > >> > severe filter without affecting the pass-band. Same will go for > >> > harmonics up to some serious number. > >> > > >> > Can anyone offer some advice as to algorithms ( number of cycles for > >> > such a deep notch ) and even better, a readily available eval board > >> > upon which it could be set up ? Remember I only need to 'hear' audio > >> > band, so 44.1 or 48 kHz sampling should be OK esp given the > >> > oversampling ADCs today. > >> > > >> > Many thanks, Graham > >> > >> This sounds like an adventure into audiophoolery, which isn't what I'd > >> expect of you. > > > > No it's not. It's come about as a requirement from a real recording > > studio. > > > > > >> What, exactly, are you planning on filtering, and what are you planning > >> on filtering it against? > > > > That's what we need to find out. Where are the clicks and pops getting > > in. We can't randomly spend the client's cash trying this and that. It > > needs to be a scientific investigation. > > > > > >> I suppose that you could filter your power supply rail with a supply > >> that has infinite rejection at all the power line harmonics -- but it > >> seems that a good switcher followed by a good linear regulator for > >> clean up would pound the power-line stuff down by many tens of dB. > > > > The power supply rail is generated inside the console in this case from > > a balanced AC power feed. NO changes are possible. > > > > > >> If you absolutely had to get it down further you could incorporate a > >> resonant element in the feedback of the linear regulator, arranged to > >> provide a good notch. Doing this with a DSP may just make sense in > >> that case. > > > > I want the DSP to analyse what's going into the console PSU so I can see > > what needs to be addressed and where. > > > > > >> Filtering anything else sounds like flat-out magic. > > > > Fine, come round to S. London and listen for yourself. > > > > > >> And finally, if it's clicks and pops you're trying to eliminate, that > >> would seem to indicate a problem with transients on the line, which > >> aren't things that you're going to notch out. > > > > Yes it does seem to be audio in band transients and my colleague and I > > have several ideas how it's getting into the audio and have already > > explored in some depth but we need more specialist tools to find the > > exact path. > > > > Graham > > I think I understand now. So this is just a measurement application, you > want to monitor the power line, eliminate all the predictable stuff, and > just look at what's left?
You've got it exactly. The frond end will enable differential, common-mode and line to earth measurements.
> _That_ should be doable. You'll still see some of the powerline content > as the line voltage sags and recovers, but who knows? That may be > important, too.
That'll be quite slow compared to the clicks which I expect to be in the lowish to mid kHz range so should be readily discernible.
> For a first cut I'd suggest averaging successive 1/10th second intervals > of incoming data to build up an image of the power line voltage, then > subtract that out of your incoming signal. The averaging should probably > be done with some forgetting factor for each point (i.e. low-pass filter > each point).
I was thinking of doing this in real time ( hence the +/- 2 Hz requirement of the 50 Hz filter ). That's the standard short-term frequency variance allowed in the UK although it's normally within 0.1 Hz.
> For a second cut you'll want to do the same thing, only do a much better > job of synchronizing to the power line frequency, since one of you will > be off.
Hence the tolerance band to avoid that problem. Remember we need to 'catch' these glitches in real time ideally. I'd like to capture them on my colleague's digital scope. We're also going to make an intentional 'interferer' ! Our budget does stretch to Schaffner EMC type kit. ;~)
> There's lots of places you can go from there. > > And I'd be happy to come to S. London and take a listen. But I'd expect > to get paid for the trip, and I have a tin ear*, so maybe you don't > really want me to come out.
How far away are you ? Even with a tin ear you can hear these clicks. I can do rather better but that's another story ( I once found a slightly hummy 'wall wart' in the back of a rack that none of my colleagues could locate ). That's when you start tilting your head and using the ear's directivity, walking around and so on. I was pleased I got that.
> * That's not entirely true. I can hear fast anomalies, and I can hear > when equipment isn't "quite right". But I grew up on cheap radios, so > hearing something subtle underneath the music isn't something I can > easily do.
You can hear this when the console is silent, so no problem there. BTW, if you did drop in, you'd see an impressive collection of platinum albums in the entrance hall ! Graham

Ben Jackson wrote:

> On 2009-05-21, Eeyore <rabbitsfriendsandrelations@hotmail.com> wrote: > > > > That's what we need to find out. Where are the clicks and pops getting in. We > > can't randomly spend the client's cash trying this and that. It needs to be a > > scientific investigation. > > I've been working on a tool at work that looks for problems in digitally > filtered audio. One thing that is very effective at finding "pops" is > a spectrogram. Even a single-cycle discontinuity shows up as a big line > (assuming your inputs are one or two tone such as your power line). And > you can look at the spectrogram much faster than you can listen to the > equivalent audio. You can also display several sources simultaneously.
That sounds interesting. I've done something similar possibly about 20 yrs ago ( durability of the AES / EBU standard connection ). We slung some stuff together that worked as a 'glitch capturer' on a digitised 19kHz tone after the receiver. You'd see regular losses of several cycles. Interestingly we found we could only eliminate glitches totally was by using an ultra-isolation transformer. This was in a standard office environment before PCs were quite as widespread as now. These were very early days of digital audio of course and the receivers weren't what I hope they are now. No dedicated chips back then. I also also saw some stunning difference in jitter on the data. The Studer D820 digital multitrack had the stablest timebase and the Mitsubishi X-850 2 track mastering machine was the worst by a factor of around 200 IIRC. Somewhere I probably still have a faded copy of a printout of the report. Tell me more about your tool. I know a company that might be interested. They already make kit to analyse analogue and digital audio. You may know them. Prism Sound. I was working for them when I did the above. Graham
Eeyore <rabbitsfriendsandrelations@hotmail.com> wrote:

> >At another studio we found interference from railway signalling currents. The track >ran right behind the plot. An EMC company had passed the site OK because they only >measure from 150kHz up and not in the audio band. I have a recording of the signal >made a simple pickup loop.That studio, along with some others required a total >Faraday cage.
This just makes me wonder: Are there digital microphones? Nowadays its easy to build a digital output on a microphone, guitar pick-up, etc. I'm also a bit surprised studio equipment turns out to be so susceptible to electric interference. Ever tried to connect the whole lot to an on-line UPS (AC->DC DC->AC)? That should get you a very clean mains. -- Failure does not prove something is impossible, failure simply indicates you are not using the right tools... "If it doesn't fit, use a bigger hammer!" --------------------------------------------------------------

Martin Brown wrote:

> Eeyore wrote: > > Nico Coesel wrote: > >> Eeyore <rabbitsfriendsandrelations@hotmail.com> wrote: > >> > >>> I am proposing to engage on a project regarding mains voltage 'purity' > >>> (and absence of ) with regard to audible clicks and pops in high-end > >>> professional and hi-fi audio equipment. > >>> > >>> Typical EMC filters operate in the RF band and are threfore no use to > >>> filter audio 'in band' noise that can travel through transformer > >>> interwinding capacitance etc. > >>> > >>> I have found some of the TI INA series that will with suitable > >>> preconditioning, tolerate mains voltages and give excellent common-mode > >>> etc rejection. So assembling a 'preamp' front end should be no problem. > >>> > >>> What I will need to do however is to filter all the mains frequencies > >>> and harmonics to a very large degree. > >>> > >>> I imagine I would need for example to null 50 Hz +/- 2 Hz to ~ -100dB. I > >>> have done only a little DSP ( I can't see it happening with analogue > >>> filters ) and I don't even know where to begin with such a severe filter > >>> without affecting the pass-band. Same will go for harmonics up to some > >>> serious number. > >>> > >>> Can anyone offer some advice as to algorithms ( number of cycles for > >>> such a deep notch ) and even better, a readily available eval board upon > >>> which it could be set up ? Remember I only need to 'hear' audio band, so > >>> 44.1 or 48 kHz sampling should be OK esp given the oversampling ADCs > >>> today. > >> A sharp filter for just one frequency is very easy. One ore more > >> biquad sections (5 multiplies & adds per biquad) are sufficient. That > >> doesn't take a lot of processing power. A cheap & simple ARM > >> microcontroller will do. > >> > >> Still, you should be aware of phase changes near the filter > >> frequencies. > > > > Of course. > > > >> I'm quite sure this will alter the sound. > > > > I'm not interested in the 'sound' of the mains other than to see disturbances > > on it in the audio band. > > Why not null out the 50 & 100 Hz components roughly with an analogue > filter and then look at the rest of them. Chances are at least some of > the clicks and pops are coming from zero crossing lamp controllers, CFL > and other switch mode loads. Fridges, oil boiler and aircon motors seem > to have the nastiest startup transients.
I'd half though of that. Make sure you include 150 Hz btw, the worst on the line and 250 tends to be pretty bad too from memory of previous spectral analyses. However I'd rather go the whole hog because access to studios is relatively rare and you don't want to go in half-assed.
> >> However I have to go along with Tim. Filtering 50Hz harmonics is not > >> going to help. The plops and clicks you mention are not a multiples of > >> 50Hz. > > > > That's why I want to eliminate the 50 , 100 , 150 Hz etc so I can see what > > they ARE. > > It might be easier to grab long chunks of the waveform with the 50 & 100 > Hz components only crudely nulled out and then use an FFT mask IFT type > post processing solution to remove your remaining unwanted fundamentals.
Not really helpful since we want to see it happening in real time in response to specific events.
> You only need to save the buffer when a click is heard. Something that > is sharp in the time domain will be extended and spread out in the > frequency domain. Clicks and pops should still be visible in the FFT > even with some uncancelled fundamental.
Sort of used that method for something else but this really is different.
> I'd be more inclined to monitor the buildings 3 phase mains input power > in realtime and look for contemporaneous sudden changes in the reported > power usage just after a spike/pop/glitch is heard.
It's dual single phase actually. They may even be on the same phase but go back to the street separately.
> >> These are just random spikes on the mains. If these spikes end > >> up in your audio circuitry, then you most likely have a ground loop or > >> another ground related problem somewhere. It means that the current > >> from the spike shares a return path with your audio signal. > > > > Trust me, my colleague and I know all about ground loops, technical earths > > etc and have even completely Faraday caged several studios. > > > > I do not believe it has anything to do with grounds on the basis of what I've > > seen. > > > > What I'd really like to know is just where I can find info on doing what I > > wanted to do, i.e. perform sharp notch filters with a narrowish bandwidth. I > > do know what I'm doing in terms of trying to analyse the problem, I just need > > some help with the DSP. > > I presume you have already tried copper/mu-metal/copper sheets above and > below to prevent ingress of stray magnetic fields.
Not possible. The studio is complete and not suited to modification. Sure, there's lots of things you could do if you went back to the beginning. In another story I could tell you how useless I found mu-metal in an ultra-critical mic amp but that's a LONG story and I suspect relates to transformer winding methods. Graham

Jerry Avins wrote:

> Martin Brown wrote: > > Eeyore wrote: > ... > > >> I'm not interested in the 'sound' of the mains other than to see > >> disturbances on it in the audio band. > > :-) > > > Why not null out the 50 & 100 Hz components roughly with an analogue > > filter and then look at the rest of them. Chances are at least some of > > the clicks and pops are coming from zero crossing lamp controllers, CFL > > and other switch mode loads. Fridges, oil boiler and aircon motors seem > > to have the nastiest startup transients. > > Lamp controllers switch at least once per cycle, usually twice. I can > understand buzzes from them, but not clicks and pops.
I reckon it's the peak inrush current of a standard switch and bulb causing most of the trouble. I just received today a couple of Surgegard samples which I plan to use in combination with zero-voltage ( and hence current for a resistive load ) switching. I'm sure this alone will make a difference.
> >> Trust me, my colleague and I know all about ground loops, technical > >> earths etc and have even completely Faraday caged several studios. > > Is it practical to move some equipment to other studios to see if the > disturbance follows them?
No. It's just the one studio and control room and you should see the sheer size of this stuff. I'm going to test their technical earth next time we're there too.
> >> I do not believe it has anything to do with grounds on the basis of > >> what I've seen. > >> > >> What I'd really like to know is just where I can find info on doing > >> what I wanted to do, i.e. perform sharp notch filters with > >> a narrowish bandwidth. I do know what I'm doing in terms of trying > >> to analyse the problem, I just need some help with the DSP. > > And we've been trying to psych out the problem for you; sorry. Some links:
All help is gratefully received.
> The "online courses" at http://www.bores.com/ Chris Bore is based in > England and he consults. > > Find the appropriate chapters in http://www.dspguide.com/ > > There is a bibliography at http://www.dspguru.com/ > > You should be able to implement the filters on a general-use computer > with a good sound card.
Thanks for that idea. I'd missed that one. Graham

Jan Panteltje wrote:

> On a sunny day (Thu, 21 May 2009 02:54:36 +0100) it happened Eeyore > <rabbitsfriendsandrelations@hotmail.com> wrote > > >I am proposing to engage on a project regarding mains voltage 'purity' > >(and absence of ) with regard to audible clicks and pops in high-end > >professional and hi-fi audio equipment. > > > >Typical EMC filters operate in the RF band and are threfore no use to > >filter audio 'in band' noise that can travel through transformer > >interwinding capacitance etc. > > > >I have found some of the TI INA series that will with suitable > >preconditioning, tolerate mains voltages and give excellent common-mode > >etc rejection. So assembling a 'preamp' front end should be no problem. > > > >What I will need to do however is to filter all the mains frequencies > >and harmonics to a very large degree. > > > >I imagine I would need for example to null 50 Hz +/- 2 Hz to ~ -100dB. I > >have done only a little DSP ( I can't see it happening with analogue > >filters ) and I don't even know where to begin with such a severe filter > >without affecting the pass-band. Same will go for harmonics up to some > >serious number. > > > >Can anyone offer some advice as to algorithms ( number of cycles for > >such a deep notch ) and even better, a readily available eval board upon > >which it could be set up ? Remember I only need to 'hear' audio band, so > >44.1 or 48 kHz sampling should be OK esp given the oversampling ADCs > >today. > > > >Many thanks, Graham > > Dear Rabit: > http://panteltje.com/panteltje/xpequ/humfilter-0.1.tgz
tgz is one of those compressed file types isn't it ? Linux style ?
> Actually it is just an interface I wrote to the code of somebody else, > the original was at http://www.abelian.demon.co.uk/humfilt/ > but no longer seems to respond... > > It is pretty good rejection, but does affect the sound. > C code, of coure.
Aarghhh. No C compiler. Long story. I was offered a job programming in C about 25 yrs ago even though I didn't know it. I hated the syntax so much I didn't take it. I'd probably have made a fortune and be a 'C guru' if I had done back then. Graham

Mirek wrote:

> In comp.dsp Jan Panteltje <pNaonStpealmtje@yahoo.com> wrote: > > Dear Rabit: > > http://panteltje.com/panteltje/xpequ/humfilter-0.1.tgz > > > > Actually it is just an interface I wrote to the code of somebody else, > > the original was at http://www.abelian.demon.co.uk/humfilt/ > > but no longer seems to respond... > > It's moved to http://abelian.org/humfilt/ ;)
Oh, thanks. Graham