Sign in

Not a member? | Forgot your Password?

Search compdsp

Search tips

Find us on Facebook!





Free PDF Downloads

A Quadrature Signals Tutorial: Complex, But Not Complicated

Understanding the 'Phasing Method' of Single Sideband Demodulation

Complex Digital Signal Processing in Telecommunications

Introduction to Sound Processing

C++ Tutorial

Introduction of C Programming for DSP Applications

Fixed-Point Arithmetic: An Introduction

Cascaded Integrator-Comb (CIC) Filter Introduction

Discussion Groups

FIR Filter Design Software

Free Online Books

See Also

Embedded SystemsFPGA

Discussion Groups | Comp.DSP | Low delay software-based bandpass filters (for dummies [me = dummy]).


There are 11 messages in this thread.

You are currently looking at messages 1 to .


Is this discussion worth a thumbs up?

0

Low delay software-based bandpass filters (for dummies [me = dummy]). - 2007-04-03 16:01:00

I want to design a real time, multiband gate for audio signals, all in
software (as a VST module). I thought it would be relatively simple
but both the problem itself and the results of my experiments (through
my headphones) are making my ears bleed. So I have a number of
questions.

My initial thought was to use an FFT to split up the audio, apply the
gate effects, and take the inverse. FFTs are the only real filter
types I'm familiar with enough to use. Obviously this has some
problems, the biggest of which is the incredible output latency when I
use a block size large enough to get the frequency resolution I want.
So, consider a software multiband compressor (Waves C4, for example).
I watch these compressors work, and the latency is near 0. When
specifying bands for one of these effects, typically you just specify
passband start and stop frequencies for each band and a magic Q value
that determines how much each band overlaps (higher Q means the
frequency response approaches a square, sort of like increasing the
order of a FIR/IIR filter).

Additionally, one thing that boggles my mind, is that the multiband
compressors can separate the signal into multiple frequency bands, and
then when you mix the bands all back together, everything is correct
(for example, there are no "peaks" in frequency response in the
overlap between bands caused by the frequency response for the two
bands at that point adding up to something > 1, if that makes any
sense).

I've been digging into FIR and IIR filters not too long now (reading
stuff on the internet for the last couple of days), but I'm not having
much luck with the implementation of them... although I think one of
these seems like the way to go... and I've been leaning towards
Butterworth filters just because the frequency response graphs look
pretty.

So, questions, about this stuff in general (these aren't exclusively
related to the gate effect I'm trying to design):

1) What type of filters are these effects using that gives them both
very low latency, and the ability to recombine separated bands without
distorting the frequency response?

2) I've never noticed any obvious phase distortions when going through
these types of effects (not just multiband compressors, but even
realtime simple low/band/high pass filters). I have a VST lowpass
filter, for example, that if I set the cutoff frequency as high as it
will go (i.e. the output should be identity) and run a square wave
through it, the output is still a square wave, no ripples. Again, what
kind of filter can do this?

3) Why does anybody care if a filter has linear phase response? It
seems to me that any non-constant phase response will distort the
output wave shape in some undesirable way, so I don't understand why
linear phase response is considered better than non-linear phase
response -- all non-constant phase response curves seem equally "bad"
in general to me.

4) I'm having a ton of trouble finding tips/hints/examples/
explanations for the implementation of non-hardware IIR filters, and
my translations from descriptions of hardware based ones to software
seem to be failing (not going for blinding speed just yet; just trying
to get something working to prove to myself that I know what's going
on). Inevitably, all my output signals quickly degenerate into
earsplitting Nyquist frequency tones. The impulse response of my
filters is always immediate Nyquist noise, converging to 0 after a
number of samples equal to the order of the filter (for my IIR filters
I'm just using some web applet to design them). Not asking what
specifically I'm doing wrong, since it could be anything, but just
saying, I have no idea what I'm doing... and it's frustrating because
the concept of applying an IIR filter to a signal -seems- simple.

Now from what I've been reading, in my case a big advantage of FIR
filters seems to be better phase response, while a big advantage of
IIR filters seems to be that they can accomplish the same thing with a
lower order, and therefore a lower output latency. But I don't know.

Any advice would be appreciated. If I happened to use correct
terminology for anything above, I assure you it was purely by
coincidence and by no means implies that I understand what I'm saying.

Thanks,
Jason


Re: Low delay software-based bandpass filters (for dummies [me = dummy]). - jason.cipriani@gmail.com - 2007-04-03 16:07:00

Oh, and another example of an audio effect that seems magic to me is a
realtime, software, parametric EQ. I have an EQ here that can have up
to 16 filters in it, and you can make them all any combination of low,
high, band, or notch pass filters. It runs with virtually 0 latency
and no phase distortions. I can't comprehend how this is possible;
it's the same deal as with the multiband compressors and simple
filters that I see. What are they doing here?

-Jason


Re: Low delay software-based bandpass filters (for dummies [me = dummy]). - Rune Allnor - 2007-04-03 17:37:00

On 3 Apr, 22:01, jason.cipri...@gmail.com wrote:
> I want to design a real time, multiband gate for audio signals, all in
> software (as a VST module). I thought it would be relatively simple
> but both the problem itself and the results of my experiments (through
> my headphones) are making my ears bleed. So I have a number of
> questions.
>
> My initial thought was to use an FFT to split up the audio, apply the
> gate effects, and take the inverse. FFTs are the only real filter
> types I'm familiar with enough to use. Obviously this has some
> problems, the biggest of which is the incredible output latency when I
> use a block size large enough to get the frequency resolution I want.

What "frequency resolution" would his be? A well-designed filter
will work on continuous bands, not isolated frequency components.

> Additionally, one thing that boggles my mind, is that the multiband
> compressors can separate the signal into multiple frequency bands, and
> then when you mix the bands all back together, everything is correct
> (for example, there are no "peaks" in frequency response in the
> overlap between bands caused by the frequency response for the two
> bands at that point adding up to something > 1, if that makes any
> sense).

These are most probably filters that have been carefully
designed for this sort of perfect reconstruction.

> I've been digging into FIR and IIR filters not too long now (reading
> stuff on the internet for the last couple of days), but I'm not having
> much luck with the implementation of them...

Get Rick Lyons' book.

> 1) What type of filters are these effects using that gives them both
> very low latency, and the ability to recombine separated bands without
> distorting the frequency response?

The term "perfect reconstruction filter banks" comes to mind.

> 2) I've never noticed any obvious phase distortions when going through
> these types of effects (not just multiband compressors, but even
> realtime simple low/band/high pass filters). I have a VST lowpass
> filter, for example, that if I set the cutoff frequency as high as it
> will go (i.e. the output should be identity) and run a square wave
> through it, the output is still a square wave, no ripples. Again, what
> kind of filter can do this?

None. There is always some ripple in the frequency domain
or overshoot in time domain.

> 3) Why does anybody care if a filter has linear phase response? It
> seems to me that any non-constant phase response will distort the
> output wave shape in some undesirable way, so I don't understand why
> linear phase response is considered better than non-linear phase
> response -- all non-constant phase response curves seem equally "bad"
> in general to me.

Nope. Linear phase means all signal components are delayed
an equal amount through the filter. If a 1 Hz sine is delayed
by 1 s through a system, the phase delay corresponds to 360
degrees. If a 2 Hz sine is delayed by 1 second, this corresponds
to a phase delay of 720 degrees.

> 4) I'm having a ton of trouble finding tips/hints/examples/
> explanations for the implementation of non-hardware IIR filters, and
> my translations from descriptions of hardware based ones to software
> seem to be failing (not going for blinding speed just yet; just trying
> to get something working to prove to myself that I know what's going
> on).

Get Rick Lyons' book.

> Inevitably, all my output signals quickly degenerate into
> earsplitting Nyquist frequency tones. The impulse response of my
> filters is always immediate Nyquist noise, converging to 0 after a
> number of samples equal to the order of the filter (for my IIR filters
> I'm just using some web applet to design them). Not asking what
> specifically I'm doing wrong, since it could be anything, but just
> saying, I have no idea what I'm doing... and it's frustrating because
> the concept of applying an IIR filter to a signal -seems- simple.

Get Rick Lyons' book.

> Now from what I've been reading, in my case a big advantage of FIR
> filters seems to be better phase response, while a big advantage of
> IIR filters seems to be that they can accomplish the same thing with a
> lower order, and therefore a lower output latency. But I don't know.

Nope, not lower latency, lower computational load.
Meaning you can get the same job done with simpler/cheaper/
less power-hungry chips.

> Any advice would be appreciated. If I happened to use correct
> terminology for anything above, I assure you it was purely by
> coincidence and by no means implies that I understand what I'm saying.

Get Rick Lyons' book.

Rune


Re: Low delay software-based bandpass filters (for dummies [me = dummy]). - maury - 2007-04-03 17:49:00

On Apr 3, 2:07 pm, "jason.cipri...@gmail.com"
<jason.cipri...@gmail.com> wrote:
> Oh, and another example of an audio effect that seems magic to me is a
> realtime, software, parametric EQ. I have an EQ here that can have up
> to 16 filters in it, and you can make them all any combination of low,
> high, band, or notch pass filters. It runs with virtually 0 latency
> and no phase distortions. I can't comprehend how this is possible;
> it's the same deal as with the multiband compressors and simple
> filters that I see. What are they doing here?
>
> -Jason

Jason,
Look up frequency sampling filters.  I use them for sub-band
decomposition.  The delay through the filter is one sample.


Maurice Givens


Re: Low delay software-based bandpass filters (for dummies [me = dummy]). - jason.cipriani@gmail.com - 2007-04-03 19:14:00

> Look up frequency sampling filters.  I use them for sub-band
> decomposition.  The delay through the filter is one sample.
>
> Maurice Givens

Thanks Maury. It seems I've opened up a new can of worms here, so
while I'm waiting on this Rick Lyons book looks like I'll be messing
around with this. I've got 5 PDFs printed right next to me so wish me
luck; this looks like exactly what I was looking for and also seems to
go hand in hand with perfect reconstruction filter banks as well.

Jason


Re: Low delay software-based bandpass filters (for dummies [me = dummy]). - jason.cipriani@gmail.com - 2007-04-03 19:30:00

Thanks to you Rune, I will have a new book soon, had a nice head-
slapping epiphany moment (wrt linear phase), and used a good half an
ink cartridge printing PDFs from the internet. :)

Before I order this book, just to make sure, you are referring to
"Understanding Digital Signal Processing" (I'm assuming you don't mean
"Making Miniature Furniture" by Richard -A- Lyons)? Is the 2nd edition
the most current? Also, does this book cover perfect reconstruction
filters and frequency sampling filter design?

Oh, and:

> What "frequency resolution" would his be? A well-designed filter
> will work on continuous bands, not isolated frequency components.

I want to be able to set crossover frequencies between the bands as
arbitrarily as possible, and I also want to minimize latency and have
the overlap between the bands be reasonably small as well. By
"minimize latency" I mean no more than a few tenths of a millisecond.
So let's say at a 44.1kHZ sampling rate, I use an FFT of size 16.
That's about 0.4 ms, which is acceptable, but then since the FFT is
size 16, that means that what, I can only measure frequencies down
to... something like 2.8kHZ? (Period is 16/44100 seconds so frequency
is 44100/16). I don't know exactly but that isn't low enough, and so
there's not much I can do about low frequency components being sucked
up into the constant term. Also it's important that the response is
fast for the purposes of the gate: let's say you have an FFT that's, I
dunno, 100ms long as an extreme example. If you have a short sound
that's < 100ms long, to be able to clip the end of it, it seems like
you'd have to do a lot of windowing just to find where the power goes
below a threshold with acceptable accuracy, and then some more magic
to make sure that an entire 100ms block following that point isn't
affected (because really the gate my be dropping much less than 100ms
of audio... with a 100ms FFT block size I can't imagine how you would
accurately gate two, say, 25ms sounds that both occur within 100ms of
eachother).

The frequency sampling FIR design, while I haven't dug into it yet,
seems like it will let me pick a fairly arbitrary frequency response
curve and design a filter to that specification. Whereas with an FFT,
if the block size is small enough to give me the latency I want, then
the band width is too large, and coming up with a nice arbitrary curve
becomes harder, especially if the subbands have vastly different
widths. I think.

So I guess I'll be getting Rick Lyons book and seeing how far I get
with this other stuff in the mean time.

Thanks a lot!
Jason


Re: Low delay software-based bandpass filters (for dummies [me = dummy]). - jason.cipriani@gmail.com - 2007-04-04 00:57:00

> Also it's important that the response is
> fast for the purposes of the gate...

Ignore what I said here. For some reason I had it in my head that I'd
operate on frequency domain output. If I were to use FFTs I'd use them
just as bandpass filters then invert to get time domain subbands, and
do the gating on those, then combine them all at the end. In any case,
though, I don't think I can balance block length vs. useful frequency
resolution. Also CPU time starts to become an issue, I think, more
than it would with IR filters... I'd have to do the FFT once, and then
one inverse for each band, so for, say, 8 bands, that's 9 FFTs, and
with windowing and overlap on top of that, it would start to push the
limit of my machine. Plus there's lots of other stuff going on at the
same time, so I can't afford to end up dedicating an entire CPU core
to this one silly effect.


Re: Low delay software-based bandpass filters (for dummies [me = dummy]). - Rune Allnor - 2007-04-04 04:27:00

On 4 Apr, 01:30, "jason.cipri...@gmail.com" <jason.cipri...@gmail.com>
wrote:
> Thanks to you Rune, I will have a new book soon, had a nice head-
> slapping epiphany moment (wrt linear phase), and used a good half an
> ink cartridge printing PDFs from the internet. :)
>
> Before I order this book, just to make sure, you are referring to
> "Understanding Digital Signal Processing" (I'm assuming you don't mean
> "Making Miniature Furniture" by Richard -A- Lyons)?

Eh...

> Is the 2nd edition
> the most current?

Yes.

> Also, does this book cover perfect reconstruction
> filters and frequency sampling filter design?

It does cover frequency sampling; I doubt it covers the
filter banks, as these are more advanced stuff, but
I might be wrong.

Rune


Re: Low delay software-based bandpass filters (for dummies [me = dummy]). - Marc Brooker - 2007-04-04 04:39:00

j...@gmail.com wrote:

> Thanks Maury. It seems I've opened up a new can of worms here, so
> while I'm waiting on this Rick Lyons book looks like I'll be messing
> around with this. I've got 5 PDFs printed right next to me so wish me
> luck; this looks like exactly what I was looking for and also seems to
> go hand in hand with perfect reconstruction filter banks as well.
> 
> Jason
> 

While you are waiting for Lyon's book (which is certainly worth waiting 
for), you might want to have a look at http://www.dspguide.com/. It's a 
whole book on DSP (aimed at the beginner) and can be viewed for free. If 
you like it, then buy a copy.

Other books worth owning for the DSP beginner are "Oppenheim, Schafer 
and Buck" and "Proakis and Manolakis", depending on your budget.

Cheers

Marc


Re: Low delay software-based bandpass filters (for dummies [me = dummy]). - Rick Lyons - 2007-04-04 10:36:00

On 3 Apr 2007 16:30:57 -0700, "j...@gmail.com"
<j...@gmail.com> wrote:

  (snipped)
>
>So I guess I'll be getting Rick Lyons book and seeing how far I get
>with this other stuff in the mean time.
>
>Thanks a lot!
>Jason

Hi Jason,
  I sure hope you benefit from the book.

Just thought I'd mention a thoughts about the 
phrase "frequency sampling filter".

Some people use the phrase "frequency sampling filter"
to mean a filter designed by way of:

   * define your desired filter's freq-domain
     response samples
   * take the inverse DFT of those freq-domain
     samples
   * use the time-domain inverse DFT samples 
     as the coefficients in a tapped-delay 
     line, nonrecursive, FIR filter structure.

However!  The original meaning of the phrase 
"frequency sampling filter" meant a filter designed 
by way of:

   * define your desired filter's freq-domain
     response samples
   * use those freq-domain response samples as 
     coefficients in a parallel-bank of simple
     2nd-order recursive filters.

Even though recursive structures are used, the 
overall filter is both FIR and linear phase.
 
I cover this second design method in a fair amount 
of detail in my book.  I did so because not only 
is that topic educational from a DSP standpoint,  
in some filter applications an FIR filter 
designed using the 2nd "frequency sampling filter" 
definition will be more computationally efficient 
than FIR filters designed using the currently 
more popular Parks-McClellan FIR filter design method.

Best of Luck Jason,
[-Rick-]
When your copy of the book arrives, send me an 
E-mail and I'll send the errata to you.


| 1 | |