fft Spectrum to float list


    Nov 24 2020 | 5:46 pm
    Hello everyone,
    I searched through multiple threads but I suppose my question seems not to be that trivial than I thought.
    So I have a given audio input and I'd like to breake down the signal via fft (let's assume 100 bands) and convert the spectrum into a list of (100) floats.
    An additional topping of the cake would be add some spectral smoothing via vectral~ or sth. similar to filter the behaviour a bit. But my most recent problem is to translate 100 fft band-powers into a floating list.
    Maybe it's because it is already evening time in my head. But I didn't find a solution how create such a list.
    Thanks in advance, Christian

    • Nov 24 2020 | 7:22 pm
      whatever you do, dont attempt to do it in realtime using snapshot. it should be fine to record it into a buffer, write it to disk, and when you open it again you can later read it out using peek.
    • Nov 25 2020 | 9:26 am
      thanks roman. Will keep that in mind.
      ๐Ÿ‘ฝRโˆ†Jโˆ† The Resident โˆ†lien๐Ÿ‘ฝ also answered my request but it seems it' hasn't been published in the thread here. (I don't know why). He recommended a few tutorials: https://docs.cycling74.com/max8/tutorials/14_analysischapter01 https://cycling74.com/tutorials/the-phase-vocoder-%E2%80%93-part-i
      But bottom line is, that it isn't that trivial at all and it seems that it'll take quite a lot of math to do it. It's quite weird. A friend of mine realised that in vvvv with just one node. sound -> fft in -> list of spectrum values out. Too baad I have to work on osx on that particular project.
      Thanks in advance to everyone, who might add a hint.
      Best, Christian
    • Nov 25 2020 | 10:44 am
      haha, i trashed my response after i saw Roman's because i liked his better.. short and sweet ๐Ÿ‘ (also was saying take a look at the helpfile for plot~ under the 'spectral' tab, you can hook up a 'capture~' object to fft~, and sample-and-hold(sah~) into capture~ according to the bin/index number you want for a list... but it might not be that helpful to view it that way... i dunno.. depends on what data regarding the spectrum you specifically need and how you'll use it eventually)
    • Nov 25 2020 | 12:13 pm
      in theory it IS that easy (vvv example), what is difficult is to transfer a signal into numbers in realtime. what speaks against implementing things all-signal in your case?
    • Nov 25 2020 | 12:49 pm
      the only honest reason why I didn't solve it on the msp layer is my lack of dsp knowledge and a deadline to solve. The list has to be sent via osc so it doesn't need to be as fast as msp.
      this morning I came to the conclusion to skip fft for now and use multiple band passes (fffb~).
      Here's my sloppy version with way too much wires... Emmanuel Jourdan's interpolation algorithm works quite ontop of the raw lists. I guess the patch isn't perfomative at all. But yeah. At least I have a list of numbers to work with...
      all the best c.
    • Nov 25 2020 | 5:51 pm
      there is that bin/sample counter object for pfft, that could be of help to perform calculations on them (unless you have to do sorting) - what was its name again? (you can also use index~)
    • Dec 04 2020 | 6:05 pm
      I do something similar for bark analysis. Look at the gen~.bark example for how to store values from a pfft~ into a buffer. Then use the 'output' message to jit.buffer~ into jit.spill and you've got the list.
    • Dec 04 2020 | 8:42 pm
      thanks! I'll have a look!