5
\$\begingroup\$

I've just begun building a bass (20-200Hz) class D amplifier and already ran into some problems.

The audio source is a car radio with 1V p-p signal. I firstly feed that sigal through a band-pass filter with corner frequencies at about 20Hz and 200Hz. This is how it looks like in LTspice:LTspice simulation

Upper three op-amps are configured as high-pass and lower three as low pass active filters. The frequency response of the circuit looks good, but there is -100 to -1300° phase shift. I am wondering what is the importance of phase shift in such amplifiers? Can I just ignore it or should I compensate for it? How would I go about compensating the phase shift?

Note that I am building this for learning purposes and the output doesnt have to be/wont be really clean or anything like that. But I would like it to "sound" reasonably well, so will the phase shift cause distortions or anything like that?

EDIT:

9Hz to 500Hz area, their attenuation levels are ~30dB.

9-500Hz

EDIT2:

100Hz to 500Hz area zoomed into 0dB to -30dB attenuation level.

100-500Hz

EDIT3:

This is a picture of plotted group delay vs frequency.

group delay

\$\endgroup\$
16
  • 2
    \$\begingroup\$ I don't know enough for a full answer, but "group delay" might be a good place to start: en.wikipedia.org/wiki/Group_delay_and_phase_delay \$\endgroup\$
    – Greg d'Eon
    Commented Feb 17, 2015 at 14:50
  • 2
    \$\begingroup\$ You are pretty much stuck with the phase shifts. Anytime there is a changing gain you get a phase shift. It's related the the Kramers-Kronig relations. I'm not an audio guy, but I don't think you can hear them. \$\endgroup\$ Commented Feb 17, 2015 at 15:24
  • \$\begingroup\$ Can you give us a zoomed in plot of the band-pass area? Anything below 30db you definitely won't care about. I'm a little concerned about the 300Hz area. Here you've got ~1000 degree phase shift and it may still be at an amplitude that's high enough to care about. If it is loud enough to hear, all of your 300 hz sounds would come out about 10ms out of sync with the rest of the music which may be detectable. \$\endgroup\$
    – horta
    Commented Feb 17, 2015 at 15:32
  • \$\begingroup\$ @horta Please see edit. \$\endgroup\$
    – Golaž
    Commented Feb 17, 2015 at 15:46
  • \$\begingroup\$ Could you go from 100Hz up to maybe 500Hz? Right now it's still difficult to see what the amplitudes are in that range. Basically, I want the vertical db part of the graph zoomed into 0 to -30db. \$\endgroup\$
    – horta
    Commented Feb 17, 2015 at 15:49

3 Answers 3

7
\$\begingroup\$

You've got it 800 degrees out of phase even at 100Hz where your amplitude is at 0 db. This is going to cause relative distortion between different frequencies of the music you play because your higher frequencies will be going through a different filter will likely less phase shift. The distortion may be less noticable because it's at the low spectrum. It should only moderately distort your music. If you were an audiophile trying to make a really nice sound system, then this wouldn't be the way to go, otherwise, this will likely work fine.

If you want to remove the massive amount of phase shift, you'll want to find different topologies of filters that don't require you chaining 6 in series each additively increasing your total phase delay. You may look into the biquad filter topology: http://en.wikipedia.org/wiki/Electronic_filter_topology#Biquad_filter

Filter design is all about tradeoffs between amplitude, roll-off, phase-shift, and complexity of design.


EDIT: From more research on experimental results and even though they don't go down to 100 hz here, I doubt you can handle the amount of delay you're adding in. Experimental research

You have 20ms of delay (800/360*1/100=22ms) and that significantly higher than the thresholds talked about in the paper. Futhermore, if you have 180bpm music, that's 3 beats a second, and you'll end up with your delay being 1/15th of the time between beats. That's a significant delay that would be very audible I think. I would revamp the design if I were you if you were actually going to build and use this.

Brian recommends a great idea if you use a linear phase filter, you'll just add in an overall delay to your signal rather than delaying some frequencies more or less than others.

A good way of doing this would be to add the high-pass filter as a linear phase filter, and then using a low-pass from this signal for the bass as well as using the same signal for the medium and upper band-pass filters. In this way, if your original high-pass filter is linear phase, they'll all have the same group delay, and you'll only be adding on marginal delays from the various other filters.

This is a block diagram representation of that:

schematic

simulate this circuit – Schematic created using CircuitLab
The first high pass filter needs to be linear phase and is the one that protects your woofers from too much amplitude at the low end. The rest of the filters are designed solely for the individual output stage. This roughly halves the potential phase delay between your signals while still achieving the desired results.

\$\endgroup\$
2
  • \$\begingroup\$ I tried searching for linear phase filters, which lead me to FIR filters. I mean, I've read thru dozens of articles and what not, but all they talk about is theory. Whole bunch of preety graphs and equations but not a single schematic of how to implement a FIR filter with op-amps. I am sorry if I am asking to much from you, but do you know of any article that describes the design procedure of one? \$\endgroup\$
    – Golaž
    Commented Feb 19, 2015 at 11:42
  • \$\begingroup\$ @Golaž I don't think FIR filter will work very well in implementation for you. You need multiple different delays and that's no simple task in the analog world. A FIR filter is much easier implemented in the digital realm, but I don't think that's where you want to head with this. Instead, I think you're either going to have to lower your Q factor (increases the bandwidth) and use a band-pass filter or just deal with the rather large delay. I'm not sure why you say those filter topologies mentioned earlier have too narrow of a band. You should have control knobs in all of them to correct that. \$\endgroup\$
    – horta
    Commented Feb 20, 2015 at 3:53
1
\$\begingroup\$

The main trouble with phase shifts is where the same signal arrives at the listener via two signal paths, and there is a different phase shift in each. In that case, if there is a 180 degree phase shift between the two signals, (and they have the same amplitude) they cancel out, and the signal (at that frequency) disappears.

That certainly can be audible, and it can be worth delaying the earlier signal with a phase shifter to keep them in phase.

It's often more useful to work out the phase shifts in terms of group delays : for example a 360 degree phase shift on a 200Hz signal is 5 ms (1 full cycle) and a 1080 degree phase shift would be 15ms. Now consider the speed of sound : about 1000 feet per second, so one way to delay the other signal is to move its speaker back ... 15 feet! Probably not practical, but often done for high frequency units where a group delay of (say) 0.1ms (3cm) is required.

Another aspect of viewing phase shift as group delay is that it is independent of frequency : consider that 100 degrees at 20Hz and 1000 degrees at 200Hz are an identical group delay.

Also notice the caveat about the same amplitude above : if two 200Hz signals arrive 180 degrees apart, but one is 10dB lower in amplitude (carries 10% of the power) cancellation occurs, but the sum has 90% of the overall power thus causing a 1dB change in amplitude : few listeners will notice. So beyond 10dB attenuation, it becomes less important to worry about phase shift.

EDIT: The fact is, you have massive delays in your passband, not just beyond your -10dB point, amounting to about 2 full cycles at 60Hz, and as Horta comments, this could be quite clearly audible in some environments. I'd want to see that plotted as group delay vs frequency. If it's relatively constant, I'd consider delaying the main channel by the same amount. (easy if the signal source is digital, not so easy if it's an analog AM or FM car radio).

Alternatively I'd start looking at linear phase filters - there's been a lot of work done on matching phase between LPF and HPF filters (such as Linkwitz-Riley for loudspeaker crossovers) which would seem to be applicable for your case. If you can use these up to say -15dB or -20dB attenuation you can safely add a filter that does anything you want (Cauer, etc) above that point.

EDIT2 : splitting the filters looks like a good idea. If you apply the 20Hz HPF filter to the entire audio band, and its group delay is constant at 15ms across the entire spectrum, that amounts to pressing "Play" 15ms later ... inaudible, and a very different situation from delaying part of the spectrum.

I recommend building it with the flexibility to try both configurations, and testing to see if you can hear the difference. You can do that with normal amplification if the Class D amp isn't ready yet.

\$\endgroup\$
9
  • \$\begingroup\$ How do you get out these numbers? When you say a 200kHz signal with 360°phase shift, the delay is 5ms. Shouldn't it be 1/200k = 5us? \$\endgroup\$
    – Golaž
    Commented Feb 18, 2015 at 12:19
  • \$\begingroup\$ 200kHz? Question said 200Hz. oops, fixed thanks! \$\endgroup\$
    – user16324
    Commented Feb 18, 2015 at 12:25
  • \$\begingroup\$ In your anwser you say: "for example a 360 degree phase shift on a 200kHz signal is 5 ms (1 full cycle)". \$\endgroup\$
    – Golaž
    Commented Feb 18, 2015 at 12:26
  • \$\begingroup\$ So, if all of the signal from 20Hz to 400Hz are above 10dB atttenuation and the group delay is more or less the same (maybe 1ms of difference) across the frequency range, there is no need to worry, since all of the signal will be delayed by the same amount? \$\endgroup\$
    – Golaž
    Commented Feb 18, 2015 at 12:34
  • \$\begingroup\$ I don't know. The fact is you have massive delays in your passband, not just beyond your -10dB point, amounting to about 2 full cycles at 60Hz. ... editing. \$\endgroup\$
    – user16324
    Commented Feb 18, 2015 at 12:43
0
\$\begingroup\$

One way to get phase to behave in an active 3 way audio filter is to feed the sound input into a high pass (for the tweeter amp) and also feed the original sound input into a low pass filter for the woofer amp. The midrange signal is then obtained by subtraction (in an op-amp) of both the HPF and LPF from the original sound input. This preserves the phase relations between the midrange and both the woofer and tweeter. The phase relation between tweeter and woofer is irrelevant since the two frequency bands are far apart.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.