How to process buffers?


#1

I’m wondering if I’m going about this the right way… I’m looking to process some buffers through filters etc. For example, I’d like to apply a LPF to a buffer as fast as the CPU can handle, not at audio rate.

  • Is it possible to utilize ugens somehow (ie, send a buffer to a ugen or series of ugens and then get it back)?
  • Or is the only approach to implement my own filters in sclang and iterate through the buffer on that side?

Just wanted to check before getting too far :smiley:


#2

Not sure what you mean… but maybe you want something like NRT Synthesis?


#3

You might try the OfflineProcess quark - you can install using:

Quarks.install("https://github.com/scztt/OfflineProcess")

It’s a little bit beta and the way it works is somewhat fiddly (it was designed for a very specific use-case, so it probably needs some cleanup), but the documentation should explain how to use. Basically, you can do things like:

(
~proc = OfflineProcess();
~proc.putAr(\compress, {
    |input|
    Compander.ar(input, input, 0.5, 1, 1/10);
});
~proc.outputPath = "~/Desktop/output".standardizePath;
fork {
    ~proc.process("/Users/fsc/Downloads/STE-039 a.wav");
    ~proc.wait();
    ~output = Buffer.read(s, ~proc.resultFile(\compress));
}

Any/all processes you add using putAr, putKr, or putTrig will be rendered all at once, in a background process (as fast as the CPU can) to output files on disk. These can be written like regular SynthDefs.


#4

Thanks for the pointers! NRT looks likely although the fact that it involves spinning up extra server instances makes me wonder if it’s the best for what I’m doing performance-wise. I’ll investigate further :smiley: