scale pitch ratio to grain size [solved]
Hi everyone
I recently solved the above problem, in my Granary project. Problem is, I'm not on Max atm, and I need to solve the issue again. In my granulation engine I have a single phasor driving play~. Grain freq and size is fixed at 12.5Hz, 80ms. I now wish to vary pitch, and the simplest way is to multiply the [sig~ 12.5] into [phasor~] by a scalar - this will vary pitch but it also varies grain rate, which I wish to avoid. The solution IS easy ('cos I solved it once!), I seem to recall scaling the [phasor~] output somehow too.
Any idea how to answer this please? How to vary phasor rate, then re-scale it so duration is fixed and static.
tyvm, as the kids are saying, apparently
Brendan
To double the pitch, multiply the output of phasor~ by 2 so you're reading through twice as much material in the same amount of time. You can calculate these multipliers at control rate with transratio or you can use sig~ 0 (your transposition value here) ----> +~ 69 ---> mtof~ ---> /~ 440.
Excellent Peter, many thanks
Sorry, I can't actually use this trick: I need the phasor ramp to remain at 0 - 1, as I am also using it to drive a Hanning window. All I can remember is that I scaled the 'static' grain size (phasor input) by a pitch amount, but also used that value to compensate (effectively resize the ramp, so it remained 'unchanged'), at the phasor output.
Could you do me a favour Peter? Download and unzip my Granary project, and look inside an abstraction called something like 'jj.pitchNsize'. The answer lies in there.
Brendan
Many thanks Rick. I don't think I would have got there on my own
cheers mate
There's some cancellation that's happening there. If you write out the *~, !/~, and *~ you get: pitch * 1000 / pitch * size, so pitch isn't being factored into the speed of the phasor~.
One other thing that I see that could be a problem is that the randomized pitch can be combined with the pitch factor in such a way that you end up with a frequency of 0 or very near zero, which could be a problem because the phasor~ is directly driving the grains.
One other strategy that I like to use in granular implementations is to use a phase accumulator (e.g., +=~ with clip~) per grain for indexing rather than a phasor~. It makes it much easier to separate the rate of the playback from the rate of triggering. HTH.
All grist to the mill Peter, thanks for your insights and tips. I will admit that my solution is a little hacky, but what I am doing effectively is changing the 'size' scalar (that lives inside the Gen engine, lower right outlet above), without altering the phasor freq .
The 'pitch ratio = 0' bug reared its head about a year ago, and it was solved ;)
Brendan
. . . . it is beyond cancellation; that part is actually redundant!
This works equally well