[Spectral Process with pfft~] basic filters

axers fall's icon

In this tutorial,I will show you how to make basic types of filters by defining a certain band range with pfft~ object.

Please check out my youtube channel for more Max/MSP ambient sound design videos!!!!!! Like,Share and Subscribe : https://youtube.com/@axersfall369?si=O84jQK6eTGOsH1T5

Sébastien Gay's icon

Hi AXERS FALL. Thank you for this very interesting step-by-step tutorial.

May I take this opportunity to ask more general questions about pfft~ and filtering ?

It seems that pfft~ acts as an extremely efficient filter (it purely eliminates unwanted frequencies, preserves phases ... ). But can it advantageously be used in lieu of all the other filter objects available in MAX ? Are there instances where it makes more sense to keep using them ?

Do some standard MAX filter objects contain some "hidden" pfft~ code, or are they all sample-based algorithms ?

I learned from previous experiences that converting frequencies into bin# can be challenging (1 frequency can spread over several bin#), but is there any other inconveniences in using pfft~ as a filter ?

Thanks again for your work.

axers fall's icon

I'm not good at English,but I kinda get what are you asking......
pfft~ object can insert some effects(like delay,distortion ETC.) to specific frequency bands like band20(? frequency --- ? frequency)only band 20 apply the effects you insert.(you can do band20 is delay effect and in the meantime,band 32 and band 55 is distortion effect),this is the application for fft~ process I usually used.
filters I think just filters,maybe use other algorithms......but I prefer build-in objects like reson~,onepole~,I use them a lot......(because I know nothing about the filter algorithmsLOL)

Roman Thilenius's icon

none of the vanilla filter externals have anything to do with FFT... though one could argue that buffir~´s process is based on a releated theory, which you also often use with FFTs.

axers fall's icon

never use buffir~ object before...but I think they are different objects and process......sorry,I'm still learning fft~ objects,maybe there's more application method around this object......maybe you can check out more fft~ patch in file browser.

Jean-Francois Charles's icon

Sebastien Gay : using pfft~ does not allow you to "purely eliminate frequencies, preserve phases". There are lots of cases where you might prefer other kinds of filters. Experiment. Listen to the artifacts. Make you choice based on the specific application. I would even ask the question the other way around: are there cases where it might be advantageous to use pfft~ rather than another kind of filter? There are, indeed.
Anyway, anybody interested in the content of the video should study the Forbidden planet example, as well as the FFT-related tutorials, both included with Max.

Roman Thilenius's icon

classic misunderstandment that FFT would offer a flat phase spectrum or an infinite steep transition band.

its strength lies elsewhere and not in technical properties. for example it is great for vocoding with free re-routing of bands to other bands. or for learning a noise profile.

Sébastien Gay's icon

How people look surprised by my naive beginner questions, sometimes surprises me ;-)
I am fully aware that these audio-signal-processing things are probably far too complicated in comparison to what I will ever be able to understand. But I have, over the past few months, spent more time than a basic MAX explorer like me should do, on different pfft~ trials, in order to improve. When I said "purely eliminates unwanted frequencies" (as opposed to other types of filters), for instance, I was referring to this type of images :

The only real limitation, as far as I can figure out, is the fact that there is not simple direct relationship between a given frequency value and a specific bin#. A frequency can be "present" in a range of consecutive bin#, making it difficult to "target" precisely which bin# to select or eliminate ?

@ Roman : I think I understand what you mean about PFFT's strength, though !

A pure musical consideration, lastly : I love how pfft~-filtered noise sounds ! ;-)

Roman Thilenius's icon

it is true that with FFT is it computationally cheaper and easier to realize -∞db within a few semitones. (or a few semitones more in the sub 100Hz range)

but what is a good brickwallfilter worth when you can not set the frequency parameter as you wish and when it comes with 8000 samples latency? :)

the relationship of bins vs hertz is simple; it is linear. in a pfft 4096 you work with bands of 10.7 Hz each, from zero to nyquist.

Jean-Francois Charles's icon

Also, if you are interested in the fact that what the FFT does is equivalent to what 512 (or more) bandbass filters do, read Mark Dolson's article "The Phase Vocoder: a Tutorial". Computer Music Journal, 1986, a reference.

François Kolaczek's icon

How can we retrieve a number indicating the spectral density? In other words, the energy? Thank you

Roman Thilenius's icon

in electronics, the spectral density is the power of one frequency range in relation to the overall power, either for a short moment or for longer.
if you are looking for the same in audio DSP it should be simply (integrated magnitude of all bands / integrated magnitude this band) - you can possibly use [average~] for short a term history, but please in rms mode.

there are probably other definitions of "spectral density", such as "total number of bands exceeding -60db"