Spectrum/FFT to OSC, how to?

Learn about building and using Max for Live devices.
Post Reply
bird
Posts: 11
Joined: Fri Jan 22, 2010 6:34 pm

Spectrum/FFT to OSC, how to?

Post by bird » Sat Jan 23, 2010 2:57 am

Hello

(if you don't want to read the long post, just have a look at the bold questions and help if you can, thanks a lot)

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

bird
Posts: 11
Joined: Fri Jan 22, 2010 6:34 pm

Re: Spectrum/FFT to OSC, how to?

Post by bird » Sat Jan 23, 2010 4:36 pm

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

andrewbenson
Posts: 55
Joined: Tue Sep 01, 2009 4:42 pm

Re: Spectrum/FFT to OSC, how to?

Post by andrewbenson » Mon Jan 25, 2010 7:55 pm

The number~ object only captures a single signal value at a specific point in time. In this case you need a way to gather up all the amplitude values into a single list and send that along. There are several ways to do this, my favorite of which is to use some Jitter objects.

Andrew B.

<pre><code>
----------begin_max5_patcher----------
747.3oc2W9sbiBBEF+ZySAiWmzQv+jj8IXeG1oSGhRRoKBNB1ltcZd1W.0jz
cinapwNydQXhHBeme7cNhuMyyeiXOQ5C9F3G.Ou2l44Y6xzgWy0d9438oLrz
NLedU9FRo+75aUfUoOR46dnjjppmFTP3cAyAQll3.SKb0cAf6adBZlcZDadZ
Abc6zrUvUbbNwdquSXOSTzTb6c0KonRwHJqBPM8V2k50BR855S4J+4.+MX9N
+iKmYlkzeYGCDoUywojxamQnou2mMyzLefXHUjmSLKX88Tj81v2OiJKX3WAL
pT4.RggKMjY0ZaanSJEeMTJvc7WTRjZ4iUTAuKYEzzbTTeZnkWwTTIil4z.A
ShNIB3RKbhi6.NQsSjjnzpSub0SRsw6iheHlHiC5j6okbn3jasw4kRphHAR5
NNlAdFWouPI.XfYGOCjiUkz8sOEixIohJt8QCcYyrX.YowpXadIpCRFNc1LH
Lwpq.3swm0EiuDJuD0PVcEkbhZclbhlvjyyk0zAMstKpTRsSrmZZn.aFaxxA
TSCdCv1ml.bxKZw8W.3Ip5NYAkw5ulUhcuIxYrOtuz6i0qtUjQI1siQ5O9sA
dc0FTvkC+UWN.gtdq93Yx6XKNmnJE5SqzeDhrkChW4ZGN4Z1g6D.+6mmAMtd
+55kfEKVHK.PvVl.qBQl2I1OthpqdFm3hWwiZFgVxOzVheJxM5fbErpcT9AW
HBUe.m9OnbznBn5iXXfSy+9JMWEheRNbzaEzOtpOy.LHxEvBG0LvuL.khKUh
BAqeWzRadVhSWD5+SWz1spCfXHx9qeCTSEo.2mO4ZPU3fQ0H.M6CZ+Nf+3q2
sAto+ORRonpLsUPse7M3TvmQjJJ2djyyFjtBuNqrcLORyxH7yOIVNMqPneCc
iF.2ews0gJognHyG7c1ft0RJd.RZ8jpnUCbaa5TTx.TT7jpnngXjlTEYVMTO
JJbRS1PCfQgSNi5SQnIWQvAnnqcWSew6y9cGxi.d
-----------end_max5_patcher-----------
</code></pre>

bird
Posts: 11
Joined: Fri Jan 22, 2010 6:34 pm

Re: Spectrum/FFT to OSC, how to?

Post by bird » Tue Jan 26, 2010 12:28 am

Thanks a lot Andrew!
will test it asap and write my feedback here.

About getting the values either from a Spectrum Audio Effect (in Live) or from a spectroscope~ (in max), do you know if that's even possible?

Many thanks for the help.

best

Pedro

Machinate
Posts: 11648
Joined: Thu Jun 24, 2004 2:15 pm
Location: Denmark

Re: Spectrum/FFT to OSC, how to?

Post by Machinate » Tue Jan 26, 2010 12:42 pm

so, are you looking to do like FULL fft analysis, or "just" something like 20 different filter bands?

I prefer using something like (shit I forget what it's called) fffb~ (?)for these things.
mbp 2.66, osx 10.6.8, 8GB ram.

bird
Posts: 11
Joined: Fri Jan 22, 2010 6:34 pm

Re: Spectrum/FFT to OSC, how to?

Post by bird » Tue Jan 26, 2010 2:56 pm

i am looking for full analysis, cause i use the values to control many objects in realtime..
have a look at my vimeo if you want to get an idea of my visual work

http://www.vimeo.com/defetto

pedro

Machinate
Posts: 11648
Joined: Thu Jun 24, 2004 2:15 pm
Location: Denmark

Re: Spectrum/FFT to OSC, how to?

Post by Machinate » Tue Jan 26, 2010 3:17 pm

ah, I know you!

Anyway, I would still recommend having a look at fffb~ in the mean time.

I do remember having seen the fft data used to generate a jitter openGL visualisation - in an example done by Cycling74 employees. It's a freaky one where you can freeze the sound going through it, I'll see if I can dig it out.

Andreas (who's only done a little bit of vvvv visualisation; http://vimeo.com/1088506 and so on)
mbp 2.66, osx 10.6.8, 8GB ram.

bird
Posts: 11
Joined: Fri Jan 22, 2010 6:34 pm

Re: Spectrum/FFT to OSC, how to?

Post by bird » Tue Jan 26, 2010 6:51 pm

ah yeah i heard your name before too, nice to see you here :)

i'll look at the fffb~, if you find that example it would be great, thanks a lot!

andrewbenson
Posts: 55
Joined: Tue Sep 01, 2009 4:42 pm

Re: Spectrum/FFT to OSC, how to?

Post by andrewbenson » Wed Jan 27, 2010 10:59 pm

In general, I'd agree with Andreas here, that fffb~ is most likely to give you useful information, as you can tune in specific frequency bands to watch for. I'd also have a look at analyzer~ or the zsa.descriptors objects for other types of audio analysis info - specifically things like the Bark scale, which reduces the analysis to 20 perceptually important bands. FFTs are a good starting point, but there are many other options. It might also be useful to have a look at the Jitter Recipes on Cycling74.com for ideas about audio/video interactions.

Andrew B.

bird
Posts: 11
Joined: Fri Jan 22, 2010 6:34 pm

Re: Spectrum/FFT to OSC, how to?

Post by bird » Wed Jan 27, 2010 11:49 pm

Hi Andrew

i know but for some of the visual work i do i prefer to have full fft, as you get all the little variations, using 20 bands would "flat" those details down, if you know what i mean.. of course it depends on the use, i am just trying to build a little device (like the spectrum) that i can put on many live tracks and get the fft analysis in vvvv.
The metod you suggested actually worked (thanks a lot), but i would prefer to get the values from the spectroscope~, as i could easily activate/deactivate the log function which is somthing i need.

i still couldnt find a way to get the values from the spectroscope~ or the Spectrum, does anyone know if it is possible?

pedro

bird
Posts: 11
Joined: Fri Jan 22, 2010 6:34 pm

Re: Spectrum/FFT to OSC, how to?

Post by bird » Thu Jan 28, 2010 3:00 am

Andrew

actually those zsa.descriptors are amazing! they really opened me some new doors, thanks a lot for pointing me there! very cool stuff.

best,

pedro

Post Reply