big FFT~, multicore processing?

TobyAM's icon

I've been trying to recreate some of Tim's (?) great FFT guides re: use of poly to handle the processing of discrete bins (e.g. https://youtu.be/gIZoyT380KQ) and I'm running into a CPU load wall. I realize this may be a case of expectations not matching capabilities, but I'm wondering a few things:

1) Is there or will there be multiprocessor support a la poly object? Polyphonic RNBO patchers obviously aren't, so while I can use a polyphonic RNBO subpatcher in a hacky way to process discreet small FFT bins, increasing the polyphony count to high numbers like 2048 just crushes my Ryzen 9 5090X, and I see it's all processed on a single core. In Reaper the plugin registers as taking 3c, or 3 cycles of a CPU core, which is unusable even at an audio buffer of 2048.

2) Any tips on effectively, and neatly, processing 2048 bins of an FFT discreetly in RNBO? Will there be any use-case examples of FFT processing in RNBO? Is this simply not a good use of RNBO? I'm unsure if splitting out the processing of 2048 bins out of a polyphonic subpatcher into 2048 individual subpatchers would yeild better results and be worth the insane-seeming effort and mess. Perhaps I need to learn codebox better, but if this is all being done on one CPU core I don't know if it will improve performance.

3) The windowing documentation is pretty sparse, but I think I figured it out. Is it correct that all that's needed is to split an input into multiple FFTstreams~, each successively being offset by the phase attribute, and corresponding IFFTstreams~ added successively back together? This seems to work on my end as expected, but to have a group of 4 windowed 2048 FFTstream~s the necessary phase offset seemed to be multiples of 512, which I figured out by trial and error. This seems odd, am I off base?


If anyone can help me achieve my Max-driven FFT plugin prototyping dreams I would be very grateful.
Thank you, RNBO is awesome!

TobyAM's icon

Any chance on anyone having any CodeBox~ fftstream @state examples? I can't figure out how to create this object properly.

👽'tW∆s ∆lienz👽's icon

Will there be any use-case examples of FFT processing in RNBO?

i read in the announcement thread, i think it was Josh Clayton, mentioned to someone asking about fft, that there will be some examps eventually(just need to be patient, i bet the rollout requires some care in working out immediate kinks here and there, first).


it’s difficult to give FFT advice without seeing the patch, and i don’t recommend sharing your RNBO commercial product here, either, but going by what i’m reading, it seems you might be reaching too hard:
-there’s rarely any need to process each bin discretely at all(if you have 2048 bins, that would be an intense amount of detail you’re trying to work over the spectrum going bin-by-bin(maybe you get an AI to do this instead, haha), plus with an FFT size of 2048, there’s 1024 bins(upper-half) that might be redundant for you depending on what you‘re doing)
-instead of going through this and running the risk of confusing you with the way i barely understand the semantics, i’d recommend you go through these tutorials if you haven’t yet:
PhaseVocoder-Part1
PhaseVocoder-Part2

-you’re not off base with that one part you mentioned(for an FFT-size of 2048, and a desired ‘overlap’ of 4, you need a ‘hop-size’ of 512), i’m just not sure how you’re doing it, there’s many ways(see the phasevocoder-part1 article i linked above), you don’t necessarily need multiple ‘ifft~’/‘ifftstream~’ objects, depending on how you’re processing the data you get from the input/analysis stage(again, see the part1 article linked above, notice they have multiple fft~, but only one fftout~… but also, for that article, you’ll need to remember it’s within a pfft~… there will be things that you’ll need to figure out on your own from there specific to fftstream~ in rnbo~, hopefully with help of incoming examps c74 might give us(?))

-for your codebox question, first off, codebox is not necessarily easier nor more-efficient(you don’t necessarily need it at all, but it’s good to learn to have more options/techniques)
with that in mind, your specific answer is one i’m wondering about myself: we don’t have a way to create visual objects in rnbo~ and then click to see the codebox equivalent(and that probably means they need to create better docs for rnbo~ codebox, otherwise, most of us will be flying in the dark as to what we can or can’t do - i don’t see how it registers ‘fftstream’ as an op at all, nor even just ‘fft’?)

but if you want to study codebox in general, try within gen~ first, try this: create a gen~ object(maybe outside of rnbo~ to start), then go into the gen~ object, create a [buffer wut what] op, and a [sample wut @interp cubic] op, then connect the [in 1] op to the input of the [sample] op and [out 1] to the output of the [sample] op, now with everything connected, click the ‘C’ icon in the right-hand toolbar, and you’ll see an equivalent code for codebox(this is how you can learn the more advanced/detailed parts of how to codebox, for example, how to codebox the “@interp cubic” part of the sample op and what order all the arguments go in, etc.).

that said, i don’t see how to get help for using ‘fftstream’ in a codebox within rnbo~-naked(my word for it), perhaps it just means codebox in rnbo~-naked will be different than in gen~(you’ll just need to use it for the specific uses documented only?)

anyways, that’s my 2cents, it’s Thanksgiving weekend, too, so if you’re still lost on your codebox question about fft in rnbo after you give some time for folks to come back from the holiday here, maybe bump this thread again(it‘s definitely an interesting/worthwhile question about using fftstream in codebox, i‘m curious too :) hope this helps.

TobyAM's icon

Thank you very much for the reply. I'll check out those tutorials for a refresher.

This plugin design rather specifically relies on state-based manipulation of individual bins. I've managed to accomplish this with using a fixed array within CodeBox~ and it seems to be working pretty well, though now I'm working on navigating the awkward mix of sample-stream and buffer processing in CodeBox~. At least I can say I've accomplished the main goal roughly.

Yeah, it's perhaps an excessive bin count in total, but it's ideal for the lower-frequency resolution. I might do an overlap with a lower-count FFT for higher frequencies to save some processing, but I'm not sure if that will be necessary.

While doing it all within CodeBox~ is likely excessive, it would be nice, but I'll avoid that for now.

I have tried looking at Gen~ code panel for objects, but in my experience so far it doesn't translate to Rnbo CodeBox~ operators in a helpful way.
On one hand the current Rnbo~ CodeBox documentation seems great and an improvement over past CodeBox documentation, for which I'm very thankful, but it still seems to be only a confusing glimpse into the potential that's leaving me a bit frustrated.
What would be rather ideal for them to include is at least one basic code example per operator, at least the stateful operators that seem to be more tricky.

👽'tW∆s ∆lienz👽's icon

excessive bin count in total

oh no, i didn't mean the bin count is excessive, just that attempting to have discrete-processing for each bin(as if each bin is processed in a very different way individually) is very specific, but these things are just hard to describe in text so i'm probably not really understanding what you're doing or what the words, 'discrete objects for each bin' means(2048 with overlap of 4(hopsize of 512) seems a good resolution for most things).

it sounds like you've made good headway(i have to read up on rnbo~ more, didn't even realize the difference between codebox and codebox~ til you wrote it here, haha... thank you for that!).