I have always been a bit curious about our FFT implementation only dealing with audio streams and not buffers. I know there is Josh’s classic PV_BufRd, etc approach, which solves many of the issues inherent in the classic FFT implementation. I wanted to make an FFT implementation that acts of Buffers, essentially granularizing them for processing, allowing certain kinds of time stretching and granular effects that are not available in either the classic FFT or PV_BufRd library.
So, here is BufFFT:
The main innovations are:
much easier and efficient time stretching
the ability to process individual grains of audio with PV Units for granular spectral effects.
All PV processes should still be compatible, plus I added a PV_AccumPhase ugen for accumulating phase in PV time stretching.
The C++ code is largely coming from SC source, just modified to allow this new functionality. I’d be very open to any suggestions or bug reports.
In the BufFFT plugins, I added BufIFFT2, which looks at correlation between overlapping FFT frames and creates a custom crossfade window, which compensates for any dips in volume due to phase cancellation. This is useful if the frames are very different on the way out vs on the way in, like in a PaulStretch. PaulStretch with BufFFT and BufIFFT2 sounds very good and can be run in real-time.
The big addition is I added the NessStretch as an SC plugin, so now we are able to do a full NessStretch (and PaulStretch) inside SC without needing the pesky command line. An added fun of this plugin is that all the internal dsp code is written in Rust, and the C++ plugin is calling the Rust code through c bindings. These two are very much not real-time, though they “kind of” will work in real-time (with audible pops). But a 100x or 500x time stretch in NRT is very fast, and sounds identical to the command-line version.
A Mac Universal build is here (haven’t tested on x86, but it should work):
Full source is below. Building the Rust code is very easy, so don’t let that scare you from trying this out.
Let me know if anything is messed up. I triple checked everything, but this was a lot of i’s and t’s. I’d love to hear some NessStretches of your favorite tunes.
I wanted to test it, but I got always this error:
exception in GraphDef_Recv: UGen ‘BufFFTTrigger’ not installed.
I put the decompressed folder in Extensions and tried xattr -rc both on the main folder and ‘build’ folder.
I was using a Mac Mini Intel Core i5 with macOS Mojave
Usually this happens to me when a UGen isn’t allowed in System Preferences. And then after that, I’ve messed things up by not telling my machine to open that piece of software after allowing it. I have no idea how to undo that.
The other times that’s happened to me were when I’ve forgotten to load the plugin in the C++ source. That’s not the problem here. I just checked it.
It’s something happening in the build. Were you able to get the .scx files?
Which version of Mojave are you on and which build of SuperCollider?
I downloaded the “universal” build to my old intel mac and it works fine on Monterey. There is an issue where the “extreme” versions of the NessStretch don’t work, so I will add that to the help file as an issue. But otherwise it works.
Once you’ve recompiled the class library (this happens automatically when the interpreter boots, but you can CMD-SHIFT-L or Language → Recompile Class Library to do that manually)
If you get an error message in the post window, usually there’s something wrong in the .sc file, the .schelp file, or there’s already a class with the name of the object in the plugin (those things shouldn’t happen here unless you’ve modified any of those files).
I can’t remember if this happens on Interpreter boot or Server boot (I think it’s Server boot) but you should get a pop-up window that says something to the effect of “[some plugin file name] is from an unverified source and may be harmful.” You have the option to remove the file or ignore the warning. You should click “cancel” or “ignore” or whatever the option is. A new window may pop up afterward but don’t do anything with it.
Open your Security/Privacy Settings in System Preferences. You should see a message that says
“______” was blocked from opening because it is not from anidentified developer.
Click “Allow Anyway” and continue cancelling the pop up windows from SuperCollider and then Allow Anyway whatever comes up in your System Preferences until there are no more popups.
You’ll need to reboot the Server and then you should be prompted to either open the plugin file or not. It’s important that you choose the option to open it. I don’t know how to undo it if you don’t, though I’m sure there’s a way.