# Get Index of highest value slice

Hi All, its been a while since I’ve been on here, i have a last minute project which i need to get the pitch data from a fft spread and translate this to a hue value.

The idea I’ve had is to read the highest value slice from the fft spread read which index this slice is at. From here i can use the get slice from a linear to get a low to high value corresponding to which frequency is at peak within the spread. This all makes sense in my head but am struggling to find a way to get the index of a slice with the highest value in a spread. Its been a while since i looked at vvvv too.

Best

Andy
(Digipic)

You could try using the Sort node in combination with the CDR. Sort arranges the spread in ascending order and also outputs the former index - the slice position of each value. CDR outputs the spread and the last element…

Bounds (Spectral) finds the maximum - but sadly doesn’t return the slice it found it at. So we have to find it with Sift (Value)
This should (for more than just a few slices) be faster than sorting everything.

Try this:

maxSliceIndex.v4p (4.8 kB)

hey Andy,

Sort (Spreads) has a Former Index. connect an CDR (Spreads) here.

edit: ah, late…

Excellent, Thanks guys, Im stuck on a train without a PC (pain) ill try this when i get back. I have been working this out in excel, see attached pic, any thoughts, should work but may not be fast enough?

https://vvvv.org/sites/default/files/imagecache/large/images/FFT CORRECT_2.png
Oops!

Hi Kalle, nice to see its still so active here :-)

Hi there stranger :) There is always a Bounds (Spectral) node, to get min and max values. And it doesn’t hurt to check FFT (DShow9 4Channels), it is a module, so you can look inside how it is done. (I don’t know how to do it in Excel though ;) )

Hi Guys thanks for all the help, event went well:
http://www.flickr.com/photos/fellwalker1/5252445127/in/set-72157625453316915/ this was just a small part of a temporary winter park install we did. On the route kids would shout into a lone microphone and the building would light up and change the Hue with pitch.
I had 6 Robe CitySkape Xtreme, good but still not as nice as Phillips ColorReach :-).

Merry Xmas everyone!