FFT~ Wavelet~ um.....

Beep's icon

Hi everyone, I want to perform frequency analysis on a limited audio frequency range in max/msp and would ideally like to specify what that range is on the fly. I have been using FFT up until now but if I only want to analyze 2000hz - 8000hz there's allot of wasted frequency bins and allot of analysis that is unwanted. Really I would like to concentrate the analysis window on that specific frequency range and give it a much higher resolution rather than wasting bins on unwanted frequency analysis. I heard wavelets could analyze specific frequency ranges, is this right? Can anyone recommend any other Max objects that might be able to help me out? I have looked at Wavelet~ but the help file is, ironically, not much help...

Beep's icon

bump

Beep's icon

any help would be really appreciated, even if its just to say that this can not be done! many thanks...

ztutz's icon

FFT is certainly not perfect, but I've watched from the sidelines as others have given wavelets a go for a number of years now. It looks to me as though they can be pretty cumbersome to work with and resource-intensive in a realtime context, and that in the end they also have their own set of tradeoffs with regard to the kind of signal that you are using, noise, and behavior of your numerical techniques. They have certainly been very successfully assimilated by some disciplines, however.

Perhaps you'll get more of a response if you outline what it is that you're trying to do musically/acoustically?

Beep's icon

Thanks for your reply ztutz. Basically i am trying to rewrite a little patch i made a few years ago which used vocal formants to control MIDI. If you were to make the following sound with your voice "oooooooooooeeeeeeeeeeee" and performed frequency analysis on it you would see a peak sliding up a limited frequency range as the vowel sound changed. It is this peak that I was measuring and then using to control various MIDI applications. The trouble was that the resolution was abit low and I did not want to make the sampling window longer because I would loose quick, percussive changes in the voice. I am looking for a way to focus purely on the frequency range that is excited by your vocal cavity, I don't need to be measuring most of the frequency spectrum data that the FFT is looking at. One idea I had would be to resample the audio coming in and repitch the particular frequency range I am looking at to span the whole FFT range. I have no idea how I would do this and think that this would itself create a fairly large latency problem! Any creative solutions, suggestions etc. would be gratefully received...

ztutz's icon

Would something as simple as few fixed frequency filters for formant-specific envelope following solve your problem? Since formants occur at specific pitch bands, couldn't you set up a special-purpose filterbank to extract the differential signals that you need. Also, if you were to be triggering the system with your own voice, this solution would allow you to train the system to your own head's formant structure with specificity.

Alexandre's icon

i have an idea :
let's suppose you need the analysis between 450 Hz and 3150 Hz :

1-use a very hard slope filter like, for example, the external [vb.cheby~], cut everything below 450 Hz and cut everything more high than 3150 Hz. (or using the "forbidden-planet.maxpat" filter)

2- ring modulate -400Hz using [freqshift~], your signal is now between 50 Hz and 2750 Hz.

3- now put your analysis in a poly~, and downsample this subpatch 8 times (from 44100Hz to 5512.5Hz)

Now notice that you will NOT HAVE MORE RESOLUTION, just same than before, because the FFT cannot do more than what is it made for. But, first, you will use 8 times less cpu : And second, you will be able to use this saved cpu time to do two kind of OVERLAP that will improve your analysis :

4- Time overlap 16 or more : second argument for [pfft~ 512 16] : this will improve your timing for your midi events when you select bigger fft window.

5- you can also do a bit of frequency overlap :
- ring modulate -2Hz -> "pfft~ B"
- ring modulate -4Hz -> "pfft~ C"
- ring modulate -6Hz -> "pfft~ D"
-> A + B + C + D = improved frequency resolution.

Also maybe you could even add the result of several FFTs made of different FFT sizes, 256+512+1024 and see if it helps in your case.
I'm actually wondering about these things on this topic :
https://cycling74.com/forums/extremely-precise-sonogram-2