Forums > MaxMSP

fftin~ amplitude values

January 28, 2010 | 6:51 pm

Hi all,

I was just wondering if anyone could explain what the range of amplitude values are that come out of the cartopol~ object when linked to fftin~ object. I have tried linking up a number~ box but the range seems fairly arbitrary. I assumed it would be between 0 and 1 as with the time domain signal but I guess I’ve missed something in my thinking. I’m guessing it’s completely different amplitude scale in the frequency domain? I have read the help files but these don’t seem to explain the output in detail.

Any help would be gratefully appreciated,

Thank you.


January 28, 2010 | 7:52 pm

FFT’s are a sum of N/2 vectors so, in general, scale by N/2. EG: for a 512-point FFT, max amplitude would be 256. A 1024-point, 512, etc.

Testing using peakamp~, the above appears to be the case for the fft~ object. Strangely, fftin~ seems to give a maximum amplitude of N/4 (??). I wish I knew why.

Anybody know?


January 29, 2010 | 12:59 pm

N/2 is only true for a square window (i.e. no windowing), as the
window function used has a direct impact on the range of the magnitude values.

iirc you can calculate it from the sum of the points (sample values) in the window.
so as the default window for fftin~ is "hanning", this sounds all fine.
a 1024-point hann window has a total sum of 512.
so replacing "N" by "sum of the points in the window" should give you the correct max. magnitude.

of course you only reach this value if a full scale component of the input signal exactly matches the frequency of an fft bin.

chris, how are you measuring the magnitude, inside or outside pfft~?
fftout~ does some intelligent automatic scaling behind the scenes, depending on overlap and window function, in order to keep things simple for the end user, but obscuring some details at the same time.
i would look at the max magnitude inside the pfft~, as this is where the processing of the data takes place.

by the way, as this topic has come up before with references to the cycling docs, especially "tutorial 26: frequency processing…": there are some mistakes in this article. the formula for calculating the max. magnitude doesn’t seem to be correct, and i can’t see how the example results given, comply to this formula. (maybe it’s just me…)
and stating that phase values are between -1 and 1 is obviously an oversight.

volker.


January 29, 2010 | 1:50 pm

I used a peakamp~ to read magnitude inside pfft~ just to confirm what I was expecting. I’d forgotten that fftin~ windows by default. Thanks for clearing that up.


March 12, 2010 | 2:26 am

Thank you all for your help with this. Very interesting stuff.


Viewing 5 posts - 1 through 5 (of 5 total)