Spectrum/FFT to OSC, how to? + pfft question

defetto's icon

Hello

i'm getting into maxforlive little by little and i'm loving it.

As i use vvvv for the visual side of my work, i really care about the integration and communication of these two tools.

Today i was able for the first time to send a list of values (dynamically changing with a perlin noise) from vvvv to max, via OSC, and control (just as a test) a spectrum filter.

So far so good, i loved that.

Now i'm trying to do something i've always dreamed of, send an FFT analysis in realtime from max to vvvv.

vvvv has an FFT node, problem is i never trusted it for many reasons, but i'm sure that in max it works like a charm.

Actually i thought of using max to take the data from the Spectrum audio effect in Live and send that via OSC, but i'm not sure if max is able to communicate with Live native devices this way.

So my first question is, can i get max to communicate with the Spectrum device and retrieve its values as a list?

I didn't find a way, but i'm a beginner, so maybe there is one (i hope so).

---

So i tried to perform the spectrum analysis in a max patcher and get a list of values, but so far i couldn't :(

First of all, i guess the only way to do a spectrum analysis in max is FFT, right? i believe that the Spectrum device in Live basically use FFT.

I followed the msp tutorial about FFT, i understood most of it, but unfortunately it doesn't explain what i need, so i ask here.

What i did so far is basically:

plugin~ > fft~ > cartopol~ > number~

I used cartopol~ because what i need is the amplitude of the frequencies, the phase is useless if i'm not doing resynthesis, right?

Now in theory the right outlet of the number~ should give me the list of all the amplitude values, but if i print that, there's only one value coming out :(

Why is that happening?

I tried to search for an answer in the number~'s inspector, but in vain.

---

About the pfft~ , i'm a bit confused; as far as i understand, it'a better/easier/cleaner way to do FFT (it does the windowing and overlapping), right?

The problem is that it's not possible to unlock the pfft~ patcher, therefore i don't understand how it's possible to edit it, add inlets and outlets, etc.

So even if i find a way to get the list of values from a simple fft~, i wouldn't be able to do the same using the pfft~ (which i believe is better cause i probably will need windowing etc to clean the values) because i cannot work into its patcher! Please help me :)

That's it, sorry for the long post, but my problem should be quite clear.

Thanks in advance to everyone who will help and share his knowledge.

Greetings,

Pedro

defetto's icon

Hi raja

thanks for the reply

about the pfft, that's strange, i mean it should be possible to just double click the pfft and edit it and eventually save it with another name..

anyway i didn't find any pfft example showing how to do what i need, therefore i would have to patch it anyway, so for now it doesn't make a difference if a use pfft or a standard fft.. first i have to find a way to retrieve the values.

Today i found the spectroscope~ , really cool object, it does exactly the kind on analysis i would need (you can apply the log function too), but it seems like it's only a user interface object, and it doesn't output the values i need to send to vvvv.

Basically i need to find a way to get those values, either from the Spectrum device in Live or the spectroscope~ in Max.

Anyone?

I hope someone will help, thanks in advance.

Greetings,

Pedro

Jean-Francois Charles's icon

Well, when you double-click, you can see the patcher, but not edit the original patch, that is another file. to open the original file, you can Option-click on the title of the window - you'll the the name of the patch appear in a menu. Choose it, the file will be opened - that you can unlock, etc. Save it under another name, then you'll need to change the name in the pfft~ arguments, of course (and check both patches are in the same folder, or other path related things...)
Jean-François.

defetto's icon

Hi Jean-Francois

thanks for the reply

your method didn't work for me, when i click the name of the patch it just takes me again to the locked patcher. Maybe i did something wrong.

The other method raja suggested works tho, Modify Read-Only let me edit the patch.

Anyway this doesn't solve my initial problem, cause i didn't find any pfft patcher that retrieve a list of numeric values from an fft, and since i don't know how to patch it myself, pfft is quite useless at this stage.

So once again the best for me would be just get the numeric values from the Spectrum Live device or the spectroscope~ Max object.

Is this possible at all? I hope so..

Greetings,

Pedro

mzed's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I might do it as below. However, it's going to generate quite a bit of data and probably be pretty unwiedy.

defetto's icon

thanks a lot mzed, seems its working this way, do you think it would be unwieldy if i use this on several audio tracks in live? i will try..

still the best would be to get the values from the spectroscope or the spectrum live device (because of the logarithmic mode and the built in damping), anybody knows a way, or can confirm if this is even possible to do?

tnx

pedro

mzed's icon

A straight fft is going to produce a lot of data; that's the part I think is unwieldy.

You might have better luck with tristan jehan's analyzer~ object. It will give you energy in 25 bark bands, which are both more perceptually relevant an easier to work with.

mz

Venetian's icon

Hi,

I actually did what you suggested - send the direct FFT data via OSC. In my case I sent it to openFrameworks not vvvv, but both is possible. I've just uploaded files on my website for you to use the object. It's under the MaxMSP section at:

You just need to put the object - specDiffOnset3~ - in the Max search path and open the maxhelp file for it. I can get you code too, but I doubt you'd want that initially. It sends out the first 256 values of the fft as a list:
0 fft[0] 1 fft[1] 2 fft[2] ... 255 fft[255]

I've also inlcuded the openFrameworks project which takes in this data and prints it out to the screen - as green/yel;low/red on black background. Maybe have a go at an example openFrameworks project first, but should be easy to set up.

Let me know if you get a chance to check it out. If you need any help with this or the MaxForLive part, send me an email andrewrobertson77 at googlemail.com

Andrew

defetto's icon

Hi Andrew

thanks a lot! will check it asap and send you feedback on your email, thank you!

best

Pedro

newfuturenow's icon

Hi
I am trying to achieve similar results to defetto. My wish is to be able to send FFT data from out of Live and into my visual tool of choice VVVV. Andrews example is sadly offline if anybody has found a way, old or new i hope so . . please share with a new and very much excited maxmsp user.

regards
Jaygo

Venetian's icon

Hi,

Just to follow up, my site is at:

www.eecs.qmul.ac.uk/~andrewr

and the software section has code for this. I think it's the BasicFFT for Live bundle, that this work is at. You of course need the external to be in the Max search path (under file preferences, add in your preferred places to put these)

Andrew

Ivan Lucas's icon

Broken link.

Anyone would share how to send FFT information through OSC?

Thank you so much.