Forums

Sharp DSP notch filter

Started by Eeyore May 20, 2009
On Thu, 21 May 2009 02:54:36 +0100, 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.
[...]
>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.
It looks to me like you're trying to do something similar to the old method for determining harmonic distortion -- inject a pure sine wave, filter the output with a notch filter at exactly the sine wave frequency, and see what's left. In your case, since you can't control the input sine, an adaptive comb filter might be a better choice. The trouble with doing this by filtering, though, is that the transient anomalies are also convolved with the filter impulse response, so you cannot observe them directly. Ideally you'd like to be able to generate a model of the "clean" mains waveform and SUBTRACT that from the actual waveform, instead of filtering. Creation of that waveform model moves you into the realm of system identification. Whatever the case, it will need to be adaptive so that it can follow normal slow variations in the mains voltage and frequency. Greg

Jan Panteltje wrote:

> < snip> > I clearly remember the first C class we had, and after that meeting was over, I went > over to the instructor and asked him: > "Where is the input and output in C?". > He answered: "There is no such thing in C'." > So I replied: "But then I cannot do anything with it, in embedded I need to do I/O". > He then said: "But you can use in line asm to make your own out and in routines".... > Now that was a relief :-)
Hence inc stdio.h presumably ? Graham
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/ ;)
"Eeyore" <rabbitsfriendsandrelations@hotmail.com> wrote in message 
news:4A14B45B.7CDCFC35@hotmail.com...
>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
You might find Julius Smith's work of interest: http://ccrma.stanford.edu/~jos/filters/ It seems the challenge is to create a comb filter with notches much sharper than can be achieved with a simple delay and addition. Maybe the answer is a number of separate single-notch filters that can be made to track the supply frequency. As for development kits, some are available (e.g. Analog Devices SHARC, from Farnell) but at a price greater than a PC nowadays so there may be some merit in doing the whole thing in C/C++ or Synthmaker on a PC if an adequate audio interface is to hand. Especially if there is no intention of manufacturing later on. Chris

Eeyore wrote:

> 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.
The multiple notch filter is simple enough, however it will create the audible artifacts, and it won't do much help against the power interference.
> Can anyone offer some advice as to algorithms ( number of cycles for > such a deep notch )
Short answer: that won't work.
> and even better, a readily available eval board upon > which it could be set up ?
Use a PC with a sound card.
> Remember I only need to 'hear' audio band, so > 44.1 or 48 kHz sampling should be OK esp given the oversampling ADCs > today.
In the broadcasting equipment, they used to inject the AC frequency and its harmonics into the audio to cancel out the power interference. The phases and amplitudes were adjusted for maximum rejection. That helped to some extent, however the power interference is rather nonlinear and nonstationary, which makes the problem difficult and non-trivial. So you shouldn't expect the miraculous improvement anyway. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com

Nils wrote:

> After reading the discussion I wonder: > > Couldn't you simply connect a transformer to the mains, add a resistor > divider at the output to get the signal down and record the glitches?
My front end will do all of that to get the levels right etc. The thing is, you don't seem to be able to see the glitches for the mains, we've already been looking. They must be quite small, or it's getting in via another route. If we knew the route it would be easy but this is the task, to find what the susceptibility is in a 35 year old product. If we had unrestricted access we could try one idea at a time but it won't be like that so we need to be prepared for various eventualities.
> That way we could take a look at the data and see what happends on the > mains. > > You're at a recording studio after all. Recording something shouldn't be > much of a problem. :-)
They might object to losing their hard disk rack. We can record it on a laptop of course but real time would keep the client happier. Graham

Eeyore wrote:

> > 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.
To add to that we don't know if it's voltage transients getting in through the mains and PSU or via magnetic coupling from sloppilly routed wiring for example. Graham
On Thu, 21 May 2009 11:16:37 +0100, 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? _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. 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). 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. 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. * 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. -- http://www.wescottdesign.com
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. Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
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. ...
>> 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?
>> 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: 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. Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;