how do you patch a precision fft filter to isolate a band of freqs?

elanhickler's icon

Hello,

I am new, but have been reading forums and looking at example tutorials and it seems like there's a handful of ways to accomplish the same thing, but only one of those ways is the best way.

What is the best way to create a Max/MSP patch to isolate a band of frequencies? I need as high-quality and cpu-hungry as possible :) Well, it doesn't HAVE to be CPU-hungry.

I would like to have an FFT filter where I can input a frequency number such as 100hz, and another number representing bandwidth such as 20hz, and so then it isolates frequencies from 90hz to 110hz.

Thanks!

elanhickler's icon

I tried tutorial 26 p crossover, esentially doubled the patch to remove frequencies twice to get a band of frequencies, but the result had distortions/sidebands, as if it was simply a low quality FFT filter. How do I raise the quality?

Floating Point's icon

there is some salient guidance in this thread,
https://cycling74.com/forums/creating-ideal-filters/
esp the posts by volker. it should become apparent that it is not a trivial task

elanhickler's icon

Not sure why it has to be NOT trivial. What I'm asking for has been done many times by many different software companies and individuals.

HIGH-QUALITY FFT:
-iZotope (RX) SOFTWARE
-iZotope (Ozone) VST
-Adobe (Audition) SOFTWARE
-REAPER (ReaFIR) VST

NOT-SURE (Haven't tested it enough)
-Sony (SpectraLayers) SOFTWARE
-Tapestrea SOFTWARE
-klingbeil (SPEAR) SOFTWARE

LOW-QUALITY FFT:
-Schwa (Spectro) VST
-FabFilter (Pro-Q) VST
-Darrell Barrell (Dtblkfx) VST

So I figured it out for Max/MSP:
#1. Max/MSP's sample conversion sucks. USE ORIGINAL SAMPLE RATE WHEN PROCESSING RECORDED AUDIO, if you need higher sample rate, convert it first using a good sample rate converter, like SoX, Adobe Audition, iZotope RX.
#2. Noise I was getting was due to using 16-bit. Must've been the dithering. Use 24 or 32 bit when recording from Max/MSP. This is not Max/MSP's fault, it's just the nature of 16-bit.
#3. Use 16384 window size, use 32 overlap.

This seems to match the quality I am getting out of Adobe Audition.

Roman Thilenius's icon

some of the examples you mentioned have nothing to do with "fft filter".

the general approach to raise the quality for filters, is to raise the bit depth and sampling frequency, so if you dont do already, use 64-bit max and upsample using poly~.
if that helps for FFT, not so sure^^ – but a biquad will sound notifyable better.

last but not least; isolating a "frequency band" of audio with infinite precision is something which already does not work in theory. you always have to decide between ftt-ish methods, where the frequency is fixed but you can go as steep as 150 db/A difference, or a dynamic filter, which adds the more phase smear the more cascades you add.

elanhickler's icon

The examples I listed are very specifically tools that can accomplish what I'm trying to accomplish in one way or another (isolating tiny bands of frequencies), whether it's FFT or not, it doesn't matter. So yes, SPEAR can definitely accomplish that, and so can Ozone's EQ. But indeed they are not the right tools for the job.

The only thing I should probably explore before putting all my eggs into FFT is: bandstop filters. So I'll try biquad.

I'll check out poly.

elanhickler's icon

Just tested Biquad, it is not precise enough. I can hear audio content that "shouldn't be there." Can you suggest how to get the most extreme bandstop possible? (I used the help file for biquad and set Q to 25, used bandstop mode) I have a feeling though that FIR can't do it.

Roman Thilenius's icon

set the Q to 0.25 and put 8 in series to get a -96 db/A per octave lowpass.

yeah, it is not perfect, but so is FFT. it is just very different from FFT and one should compare what tastes better. :)

i have the feeling that you are looking for a realtime process, so using "standard" filters would be the better option compared to recreating some extravagant resynthesis app. :)

btw, in case you need this for a more or less musical context, you could also get rid of (some) of the unwanted frequencies by using a noise gate or expander on the output of the biquad filtered signal.

at least in these moments where there is _only "wrong" output from a 300-320 Hz bandpass filter, a noise gate will eradicate most of that now.

elanhickler's icon

huh...... wow....umm, Roman Thilenius... biquad might be the best solution. I am getting REALLY high quality filtering using this setup: 8 biquads one after another / set to bandpass / Q 25. Now, I don't need this for realtime application, but I do need frequency modulation of the filter during rendering, and I'm assuming FFT filters don't modulate so well. fuk, let's try 16 biquads... wow even better! With more biquads I can set the Q to 3 and get something that looks similar to FFT brickwall filter. At Q 25, that's too precise. Thanks to you now I have an FFT filter AND a biquad filter to experiment with. I will surely test both to see which one comes out on top.

Roman Thilenius, why did you suggest .25 Q? That does almost nothing. Also, what unwanted frequencies are you talking about? I'm not having any noise issues with biquad.

Roman Thilenius's icon

1.) oh is it 0 - 100? i was sure it is 0-1. probably because my abstractions are 0-1.

2.) well. if you have a biquad with 24 db/A per octave set to 440 Hz and input a frequency which is three notes higher, it will still be passed with about half the original volume. you can try that out when you use cycle~ to play cosine waves through the filter.

elanhickler's icon

0 to 25

according to a notable source, biquad is IIR, not FIR...???

oh but good idea about playing a sine wave through the filter to measure the volume loss!