getting the peak frequency from a buffer
There must be some easy way to do this that I’m overlooking: I want to scan the audio in a buffer and get the peak frequency. I know how to use myriad of spectral analysis software and the spectroscope object, but I don’t see an obvious way to display the frequency with the greatest amplitude in Max. Seems like a trivial task. I must be going about this the wrong way.
I’m an experienced Max user for several, but new to the forum, and am more familiar with the Max side than the MSP side. Any help would be greatly appreciated. I’ve been scouring through the forum for a while now.
couldn’t you just get it with ‘peek~’ and a ‘peak’ also? and maybe a ‘trough’ for fun. or maybe i misunderstand…
I believe peak~ just outputs an amplitude value. I need a frequency value with the highest amplitude.
The sonograph example patch (in fft-fun) seems like a close start, but there doesn’t seem to be an easy way to parse the data from spectroscope~ which is essentially what I want to do. I don’t need the GUI part of spectroscope, just the frequency with the highest amplitude.
have you considered doing your own fft analysis? have a loop at pfft~. you will need a way to store and order the data. I would recommend ircam’s ftm for that (coll probably won’t cut it). I would use [fmat] to store and order your amplitude and frequency data for each bin and probably a second [fmat] to keep track of the loudest frequency in each frame. this should do the trick (or at least get you started).
Come the weekend I might have time to whip together a crude example if need be…
Thanks MIB–that gives me a lot to think about. I tried pairing the amplitude values with frequency values that I got from analyzer~ into a coll, but I soon realized that coll was not the way to go.
An example patch would be VERY much appreciated as I have not used the IRCAM externals you mentioned.
thanks! I definitely will!
I believe my patch now does what I originally wanted it to do. I don’t want to impose, but would someone mind taking a look and verifying that the data I’m getting is what I think I’m getting?
The zip file above is contains my main patch and two files from Emmanuel Jordan’s zsa.descriptors.
To reiterate, this patch performs an FFT on incoming data and outputs the frequency of the peak amplitudes for the first four peaks of the signal.
Continued thanks to everyone!!
Hey! I want to do exactly what you did. However, your patch isn’t online anymore. Can you re-upload?