Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

General and best ways to cutoff frequencies?

DSP related issues, mathematics, processing and techniques

General and best ways to cutoff frequencies?

Postby tulamide » Sat Aug 10, 2019 11:51 pm

As the title says. If somebody is willing to offer a schematic, that would be awesome. But I also need a general description (without too much dsp-speek) on how to approach freq cutoff.

What I'm looking for is a stronger, harsher way to suppress specific frequencies, than the normal filtering. Here's are examples:

Say, I want to compress a kick drum. To get a nice strong transient and a full body, I would first completely remove all frequencies below ~30 Hz (the eq I'm using has a simple "cutoff below" button), as they are carrying a lot of energy and make it difficult to compress as strong as would be needed.

Say, I want to better fit vocals in the mix. The vocals are recorded with a rather high frequency spectrum, and unnecessary frequencies are below 500 Hz and above 4 kHz. No matter the band pass settings I use, there always will be frequencies left outside of the band. I'd rather want to completely remove them, to give more room to the other instruments (HH, SH or the like above, bass, low synths and the like below)


So, how to approach this? I assume it has something to do with converting from time to frequency domain and back, or using extremely harsh filters, but that's about all I can understand currently.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: General and best ways to cutoff frequencies?

Postby martinvicanek » Sun Aug 11, 2019 4:34 am

What you describe sounds like a filter with a high stopband suppression. Such filters do exist, however there are a few things to note:
1. Stopband rejection will never be complete, although it can be made sufficient for a given scenario.
2. There will always be a transition band where the filter response goes from unity at the passband edge to, say, -100 dB at the stopband edge.
3. A steep transition band causes ringing in the filtered signal at transients. Bad!

For example a biquad higpass has a 12 dB per octave falloff, so to achieve 100 dB suppression your transition band would be 8 octaves! You are probably looking for a much steeper filter.

Elliptic filters can be designed with a narrow transition band, however the ringing is terrible.

An option might be a FIR fillter, however these fiters are less flexible and tend to have more latency.

Sorry if this was too much dsp speak. Here are some IIR filters with varying steepness that I posted earlier.
Attachments
Bandpass.fsm
(53.43 KiB) Downloaded 1493 times
Highpass.fsm
(44.85 KiB) Downloaded 1447 times
Lowpass.fsm
(75.28 KiB) Downloaded 1450 times
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: General and best ways to cutoff frequencies?

Postby juha_tp » Sun Aug 11, 2019 6:03 am

Hmm... something like Rubberfilter from C.W.Budde? https://www.kvraudio.com/product/rubber ... tian_budde
juha_tp
 
Posts: 60
Joined: Fri Nov 09, 2018 10:37 pm

Re: General and best ways to cutoff frequencies?

Postby tulamide » Sun Aug 11, 2019 5:10 pm

juha_tp wrote:Hmm... something like Rubberfilter from C.W.Budde? https://www.kvraudio.com/product/rubber ... tian_budde

That is a beast! Yes, that's the direction I think. Thanks for the link!

martinvicanek wrote:3. A steep transition band causes ringing in the filtered signal at transients. Bad!

I think that's the crucial point.
I found a pdf from the Ohio State University, where the teacher lets students build an audio equalizer (analog with capacitors, resistors, and all that jazz). The pdf explains each step and starts at the very beginning of "what is a sound wave". I could follow these explanations quite good. On page 7 finally a low pass filter is explained:

Low frequencies are completely passed (fraction=1), but high frequencies are not passed. In the middle is a transition range. The transition may be slow or abrupt, depending on the filter design. Ideally the cutoff would be very sharp, but the sharper the curve the more electrical components are required to implement it.

(image of transfer function omitted)

The “cutoff” frequency is usually defined as the point at which the throughput is reduced to half of the maximum. The transfer function has the value 0.5, or expressed in decibels is 3 dB. The decibel number of a power signal is given bydB=10logPoweroutPowerin⎛⎝⎜⎞⎠⎟(1)That is, the output is down 3 dB when the power out is half of the power in. The “pass band” is the range of frequencies that pass through the filter, and frequencies that not passed are in the “stop band.”


This is making me curious. It says, the cutoff is only not as sharp because of the increasing amount of electrical components needed. I understand that people back in the days needed to find a compromise between practical usage and cost effective design.
But we are in the digital realm now. Electrical components don't play a role anymore. And so I thought it would be no issue to make the transition as sharp as, say, a square wave. But now there are accoustic phenomenons at very sharp transitions? Where do they come from? Why do they exist at all?

When I ask this, I always think of the opposite of such a cutoff filter, which is additive synthesis. I can easily add or remove frequencies at will. There are no downsides to it. So why doesn't it work the other way round as well?
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: General and best ways to cutoff frequencies?

Postby juha_tp » Sun Aug 11, 2019 5:56 pm

You could just cascade biquads to get steep enough filter (safe way). Four biquads for 48 dB/oct filter or eight for 96dB/oct filter, etc..

Here's a quote regarding Q calculation method (Butterworth case) from another DSP related forum:

use this in reference to the Audio EQ cookbook that presently (and forever, i hope) lives at:

http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt

for an Nth order Butterworth (N even or odd) you will have N/2 biquad
sections ((N-1)/2 for odd N or floor(N/2) for either even or odd N),
each will have the same resonant frequency w0 and will have Q:

Q = 1/( 2*sin((pi/N)*(n + 1/2)) )

where 0 <= n < (N-1)/2

then, use the cookbook LPF or HPF to get the coefs for each biquad section.

if it's an odd order Butterworth, you'll need an additional 1st order section:

H(z) = (b0 + b1*z^-1)/(a0 + a1*z^-1)


1st order LPF: H(s) = 1/(s+1)

b0 = sin(w0)
b1 = sin(w0)
a0 = cos(w0) + sin(w0) + 1
a1 = sin(w0) - cos(w0) - 1


1st order HPF: H(s) = s/(s+1)

b0 = cos(w0) + 1
b1 = -(cos(w0) + 1)
a0 = cos(w0) + sin(w0) + 1
a1 = sin(w0) - cos(w0) - 1


credits to Peter Schoffhauzer <scoofyGET_THE_SPAM_OUT@inf.elte.hu> for
catching and fixing errors.

r b-j

juha_tp
 
Posts: 60
Joined: Fri Nov 09, 2018 10:37 pm

Re: General and best ways to cutoff frequencies?

Postby trogluddite » Sun Aug 11, 2019 7:49 pm

tulamide wrote:But now there are accoustic phenomenons at very sharp transitions?

More than just "acoustic" phenomena, even. The same limitations are inherent in absolutely anything which can be described by waves oscillating across time and/or space.

Very (very!) roughly the problem is this: you can't know exactly what frequencies are present in a signal at a single moment in time - because the only way to know that a wave is repeating itself is by looking into its past (or it's future!) A series of samples represents how the wave's amplitude changes with time, and a filter is looking at how the amplitude changes with frequency (the Fourier transforms being a way to convert between the two.) However, it is impossible to switch from one to the other with perfect accuracy - the more accurately you know "when" a frequency occurred, the less well you can know "what" the frequency was, and vice-versa.

The thing that's hard to grasp, even if you know the maths really well (which I don't pretend to at all!), is that this is a fundamental property of all waves, not just a limitation of our mathematical knowledge or what technology you use (the same maths essentially applies to analogue filters too). It's not just that no-one's worked out how to do it yet, it has been proved to be fundamentally impossible to convert from time-domain to frequency-domain beyond a certain level of precision. And without that perfection, there will always be artefacts.

Most people only know it as a buzz-word of quantum physics, but this is basically the "uncertainty principle" that Prof. Heisenberg made famous - because quantum physics models "particles" as "wave functions". But the ringing of filters is down to the same thing - you can't isolate a particular frequency at a particular time, so it will always get "smeared out" in time to a certain extent when you change it in the frequency domain.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: General and best ways to cutoff frequencies?

Postby martinvicanek » Sun Aug 11, 2019 10:29 pm

tulamide wrote: always think of the opposite of such a cutoff filter, which is additive synthesis. I can easily add or remove frequencies at will. There are no downsides to it. So why doesn't it work the other way round as well?

That's an interesting consideration. In additive synthesis you do have ringing just as well: it is called Gibbs Phenomenon. However, one difference between filtering and additive synthesis is latency. While in synthesis you can decide to add or drop frequencies at any instant, for filtering you need to analyze a certain length of the stream before you even know what frequencies are present. The lower your frequencies of interest, the more latency you will have to accept.
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: General and best ways to cutoff frequencies?

Postby tulamide » Mon Aug 12, 2019 6:45 pm

@trogluddite
Thank you very much! This no-dsp-term explanation helped me understanding the issue. You're gifted in explaining difficult things with easy words!

@martinvicanek
What you said about additive synthesis and filtering was very informative! I've seen Gibb's Phenomenon so many times, but never knew that it is a natural thing nor that it is to avoid as much as possible. Thanks a lot!

@all
So, in conclusion, it is actually a curse that we have the digital domain now, because we reach the natural barriers of sound manipulation much quicker nowadays. Which also means, progress will be made in smaller steps, and at one point we may even reach the absolute limit of what is possible.

One last question: In Reason I often cascade simple two band parametric eqs, set to reduce a certain center frequency (let's say 30 Hz, which is an example I use often). These eq's could be a train of 4-6 in a row. Each one claims to add or subtract 18 dB. Does that also add to the ringing issue? And how would I detect it with my ears only?

(Ok, it's two last questions ;) )
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: General and best ways to cutoff frequencies?

Postby trogluddite » Mon Aug 12, 2019 11:01 pm

tulamide wrote:...we reach the natural barriers of sound manipulation much quicker nowadays

Yes, that's a good way of putting it - even a 32-bit float can manage a lot better precision than even the best analogue components, so we can't blame the artefacts on manufacturing tolerances etc. any more. I remember reading somewhere that, when scientists first discovered these effects, they refused to believe it at first - they spent ages pulling their equipment to bits thinking that there must be a dodgy component somewhere that was vibrating!

tulamide wrote:Does that also add to the ringing issue?

It will do, yes. You can think of the ringing as being a kind of resonance, in the same way that playing a sound down a length of pipe changes the frequency content, but also tends to resonate. If you chain filters which all have the same settings, then the ringing of the first one will be at exactly the right frequency to excite the resonances of the next one, and so on. For theoretically perfect filters, it doesn't matter whether you make the slope steep with one sharp filter, or by chaining many shallow ones, the end result is the same.

tulamide wrote:And how would I detect it with my ears only?

An impulse is always the best test for ringing. An instant step from one value to another, rather bizarrely, is equivalent to a wave packet having an infinite number of frequencies, so will provoke any resonance no matter what frequency it's at - and being only a single sample long, the original sound won't hide the ringing. Testing on good headphones will help a lot, too, as at the low frequencies you're interested in, the resonances of the room you're in or of large speaker cones can easily hide the effect (ported speakers are particularly prone to this.)
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: General and best ways to cutoff frequencies?

Postby Spogg » Fri Aug 16, 2019 2:30 pm

A thought came to me (not always a good thing). :lol:

If we take the discussion to offline processing, that is not in real time, do the same restrictions apply?

After all, when we have a complete recorded sound file, at any point in that file we know the present, past and future. Does that change things?

Cheers

Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Next

Return to DSP

Who is online

Users browsing this forum: No registered users and 47 guests