FFT only in gen?


    Jun 07 2017 | 8:01 pm
    Is there a way to do FFT stuff only inside a gen object, without the need of external msp objects?
    If so, could someone give me a roadmap of sorts?
    Thanx much!

    • Jun 07 2017 | 8:30 pm
      No, there isn't. As the operators and examples suggest, the gen~ operators associated with FFTs are expected to be hosted inside of a pfft~ object.
    • Jun 07 2017 | 8:59 pm
      I guessed it, only with pfft~ onject... Oh, what a bummer. I wonder if a request for incorporation makes any sense...
      Thanx for the info, in any case.
    • Jun 07 2017 | 9:06 pm
      it doesn't make any sense really, because pfft~ will (approximately) take a vector of signal, with several values inside, and then perform a Fourier transform on that vector - which is an operation which result will depend on the number of samples you input ; and gen~ only works with one sample at a time.
    • Jun 07 2017 | 9:43 pm
      I was replying in terms of what was supported at this time, Mr. V. You and Mr. 'rope should feel completely free to start rolling your own. :-)
    • Jun 07 2017 | 10:51 pm
      @VICHUG i see no problem rolling a fixed sum of samples into a data object, if to perform a Fourier transform on that, no? Uhm, but maybe after that it gets tricky.
      @Max Who are those people? ;)
      Okay, i was just curious. In fact i am looking for a way to work with gen only to do pitch tracking. Happy to hear your thoughts on that, if it makes any sense.
    • Jun 07 2017 | 11:05 pm
      the problem would be that you would have no window overlapping management in that case, and more overhead ; there is a lot of sugar in pfft~ that makes it sound nice.... so indeed "after that it gets tricky" :)
      gen only for pitch tracking, mm, maaaybe something with fixed filters computing their... like in a vocoder... dunno
    • Jun 08 2017 | 4:36 pm
      @Vichug is absolutely correct.
      I can understand there might be a case for rolling your own fourier transform entirely within gen~, for the purposes of code export, or perhaps for exploring different FT approaches than what pfft~ provides. Almost certainly will need some codeboxing here & there, but I think all the resources required to do it exist. Could be a fun summer project!
      (Just bear in mind that it might not get the same kind of performance as pfft~, which might be using some extremely optimized code under the hood...)
      Graham
    • Jun 15 2017 | 11:39 pm
      If you figure this out, i'd be excited! i think it'd be pretty interesting to play with different window functions, perhaps dynamic / non-linear, or do stuff like process differently based on different characterics of the bins...
      ...but i wasn't able to figure out a way in Gen to organize the butterfly and especially putting it back together, bouncing all that data around.
      Ended up being more a AM or FM distortion via square wave sounding kinda thing...! In attempting to program it the operations needed seemed very tree/branching/nesting so that made it hard for me to trace what i was doing wrong along the way.
      Anyway, good luck! :)
      http://www.dspguide.com/ch12/2.htm
    • Jun 15 2017 | 11:50 pm
      Choose Kissfft, Ipp or fftw and forget "fft and gen code export "
    • Jun 16 2017 | 12:57 am
      gen would be fun for windowing algos, but dont forget that you can not just loop/insert the pfft stuff to one gen patcher, as the in and out of gen is of course also one msp vectorsize long.
    • Jun 16 2017 | 12:37 pm
      Yep, there's a few pfft-hosted gen~ patchers in the gen examples folder. And you could develop in pfft-hosted-gen and export the code, and wrap the exported code in a pfft-equivalent based on kissfft, or the other examples @arabrab mentions.
      BTW since the OP was asking about pitch tracking, there are also time-domain (i.e. non-Fourier) approaches to that, such as counting zero crossings. There's a couple in the gen examples folder too. They're *very very* twitchy, but that can be a good thing sometimes... gen~.zerox, gen~.waveset etc.
    • Jun 30 2017 | 11:54 am
      Thanx everybody for your suggestions and apologies fro my absence, there was an interlude in Kazakhstan :) Especially the external fft things, Kissfft et al, seem to be my summer project then. Salud.
    • Dec 07 2018 | 12:42 pm
      @Graham Wakefield: ...you could develop in pfft-hosted-gen and export the code, and wrap the exported code in a pfft-equivalent based on kissfft, or the other examples @arabrab mentions.
      Would this work for something like the Owl?
      @JAYROPE, have you had any luck with this?
    • Nov 23 2019 | 12:31 pm
      I was searching for a way to parcel out portions of the FFT process into multiple signal vectors and found this...
      Up until now, I thought that FFT implementations required a recursive operation. I found an example here which, in theory, could be translated into GEN. There's source code at the bottom of the page. If someone does the translation, let us know? I might take a stab at it at some point.
      https://web.archive.org/web/20060423170713/http://www.relisoft.com/science/Physics/fft.html
    • Feb 16 2021 | 4:00 pm
      Hi! I stumbled on this post while googling about a FFT implementation with Gen~, actually what I'm looking for is for a way to perform a offline/non-realtime FT in Max without relying so much on externals, with which I had some problems for a number of reasons. Anyways, regarding the initial topic of this post i found the following: https://twitter.com/szk_1992/status/1065174909679071232 https://github.com/suzukik1992/FFT-InverseFFT_Gen Hopefully you already have a solution after so much time, but I leave it here in case others like me stumble here.