sample accurate granular synthesis
Dear all,
I've been using poly~ to instantiate multiple overlapping grains. It works fine for asynchronous granular synthesis, but signal-rate periodic triggering of grains is a problem. The main issue is that, even with the sample-accurate triggering described here [https://cycling74.com/forums/how-to-trigger-poly-object-sample-accurately/], the time resolution seems to be dependent on the vector-size. For instance, with a vector size of 256, the smallest possible interval between the grains is 5.8 milliseconds, which is still quite low. I need to be able to trigger at least 1000 grains per second, accurately. I've tried making the poly~ vs very small, but the CPU load makes it unusable in real-time.
Am I misjudging this? Is there a solution for this in vanilla maxmsp without using externals? Is there, perhaps, a way of doing this in gen~? I don't see how, since there is no poly~ equivalent in gen...
Many Thanks
Hallo pieman
two patches that may be of use to you: one from leafcutter, which is a sample-accurate mutable phasor built in gen, and the other is my own gen-based granulator. Inside my "jj.pitchSize" abstraction, change the grain size ([sig~ 80]) to
Brendan
Am I misjudging this?
no you're not
Is there a solution for this in vanilla maxmsp without using externals?
I don't believe so
Is there, perhaps, a way of doing this in gen~? I don’t see how, since there is no poly~ equivalent in gen…
yes there is, you need to make a signal in gen which triggers the poly~ from outside, but that poly has as its synthesis engine a gen patch as well. It means that the poly is always using its maximum number of voices-- they're always on, even if they're not generating a grain at a particular instance. So it can be done but is very inefficient. You also have to build your own voice allocator, also in gen, outside of the poly~. It's very clumsy, but works. I can get interonset times down to a fraction of a ms using this method, but I'm not sure how many grains I can get, maybe 60 simultaneous... so if you want 1000 per second that's a maximum grain size of 60 ms at that density.
For all the sample-accurate techniques for MSP are highly useful, there are simply some MSP objects that only trigger or recalculate at the start of the signal vector.
The simplest way to work around this is to decrease the sample vector size to what you need. This will also decrease latency. The down side is that CPU usage will go up. That trade-off is simply the way MSP works.
You can, by the way, set the sample vector size to a single sample, but IMS you have to use a message to ;msp to pull this off, rather than simply using the popup in the Audio Status Inspector.
Hi Pieman,
your question is very pertinent and shows that you have spent some time investigating the subject of granular synthesis in Max/MSP.
If you want granular synthesis that combines sample accurate control with CPU efficiency, the only way to achieve it is by writing your own external in C.
- Luigi
Hello all,
Thanks so much for the replies. The other day I was hoping that with the lua~ external (http://www.mat.ucsb.edu/~wakefield/lua~/lua~.htm) one might be able to avoid C, but I couldn't get it to work with max6...
Many Thanks
Peiman
hi peiman.
the fantastic [lua~] object was max4 only. it basically became an object called [gen~] in max6 (similar under the hood, written by the same person/people).
in [gen~] you will be able to do most of what you want using gen-patching and the GenExpr language, in combination with msp elements such as [poly~]. alex harker's externals may also help.
still some workarounds needed, and not as simple as in C or LuaAV, or even Supercollider, but very doable, lots of fun, and can sound great.
Thanks for the reply. I'll keep playing around and see how far I can go.
Best,
Peiman