Logarithm, exponential generator

dannyflint's icon
Max Patch
Copy patch and select New From Clipboard in Max.

So are there any George Boole's out there? (or at least someone who's more learned in the dark art of mathematics than me).
I'm making a roll generating part of a bigger Max patch.
Let's say (for the sake of ease) that all I want to do is generate a roll on the last 8th of the bar.
To get the length of that 8th in ms would be BPM -> [!/ 60000] -> [*0.5] = 1/8th.
Say I want the number of beats in the roll to be 5.
At 120BPM the 1/8th notes would equal 250ms so evenly distributed, each beat of the roll would be 50ms. But I don't want even distribution.
I want to achieve a less robotic/metronomic roll, that is either logarithmic or exponential.
I could probably do this in a really convoluted fashion with loads of different objects. Using the above example;
1/8th = 250 -> [ /5 ] {amount of beats in roll} = 50.
a-20% b-40% c=50 d+40 e+20% = 40 45 50 55 60
I just haven't got a clue how to express this as there are many variables.
I would like to be able to alter the amount of beats in the roll from say 2 - 8.
Then I would like to randomise the exponential or logarithmic curves.
If someone can give me a basic grasp of the equations and how I may achieve it with [expr] or something then I'd be extremely grateful & of course owe you a pint. I am actually nearly there I think.

Roman Thilenius's icon

scaling a linear range to a logarithmic distorted or similar ranges is easy, it is just a a bit tricky sometimes to keep stuff in range.
"log" and "exp" is part of my old collection: https://cycling74.com/forums/re-mapping-a-range-of-numbers-add-your-tricks-here/

dannyflint's icon

Thanks for replying :) I'll have a look at the link and see if it helps

Cheers

Danny