I've flummoxed myself. I'm trying out stuff with tones [1/32 loops] and riding the pitch but I want to cheat the bpm so no matter the pitch the bpm stays constant
This is kind of weird it works when using dirty tricks but doesn't playing it straight
So I have a button I press once on track load
set 'base' `get_bpm`
and I have a dial
pitch & set 'test' `get_pitch_value & param_1_x & param_multiply 100` & set 'change' `param_multiply "get_var 'test'" "get_var 'base'"`
and also a button [pad 4] I press after tweaking the dial
get_var 'change' & param_cast & set_bpm
Like that it works, like this it also works [dirty trick]
pitch & set 'test' `get_pitch_value & param_1_x & param_multiply 100` & set 'change' `param_multiply "get_var 'test'" "get_var 'base'"` & pad 4
But add then together properly, no es bueno.
pitch & set 'test' `get_pitch_value & param_1_x & param_multiply 100` & set 'change' `param_multiply "get_var 'test'" "get_var 'base'"` & get_var 'change' & param_cast & set_bpm
This is kind of weird it works when using dirty tricks but doesn't playing it straight
So I have a button I press once on track load
set 'base' `get_bpm`
and I have a dial
pitch & set 'test' `get_pitch_value & param_1_x & param_multiply 100` & set 'change' `param_multiply "get_var 'test'" "get_var 'base'"`
and also a button [pad 4] I press after tweaking the dial
get_var 'change' & param_cast & set_bpm
Like that it works, like this it also works [dirty trick]
pitch & set 'test' `get_pitch_value & param_1_x & param_multiply 100` & set 'change' `param_multiply "get_var 'test'" "get_var 'base'"` & pad 4
But add then together properly, no es bueno.
pitch & set 'test' `get_pitch_value & param_1_x & param_multiply 100` & set 'change' `param_multiply "get_var 'test'" "get_var 'base'"` & get_var 'change' & param_cast & set_bpm
Posted Mon 13 May 19 @ 9:58 am
You are right, one affect the dial when the other affects directly the file which need to scan for bpm again
one sets the pitch to 'change' the other one sets the bpm for the pitch of the file to match 'base' at this pitch
one sets the pitch to 'change' the other one sets the bpm for the pitch of the file to match 'base' at this pitch
Posted Mon 13 May 19 @ 9:26 pm
Another one,
I've a var that cycles up and I want to translate that to count up like binary [0,1,2,4,8 etc]
if ( baseVar > 1 )
{ resultVar = 2^( baseVar - 1 ) }
else
{ resultVar = baseVar }
This works but I think I should be able to write this without the if : else
I've a var that cycles up and I want to translate that to count up like binary [0,1,2,4,8 etc]
if ( baseVar > 1 )
{ resultVar = 2^( baseVar - 1 ) }
else
{ resultVar = baseVar }
This works but I think I should be able to write this without the if : else
Posted Tue 28 May 19 @ 7:40 pm
Nevermind I think I got it. Sometime I miss the obvious.
resultVar = 2^ (baseVar ) * 0.5,
edit nope, 2^0 == 1, might have to live with if :else for zero
resultVar = 2^ (baseVar ) * 0.5,
edit nope, 2^0 == 1, might have to live with if :else for zero
Posted Tue 28 May 19 @ 11:43 pm
with 0 you'll get resultVar = 0.5
if you are using integer it may be ok you can get 0 if result is truncated or may be wrong if result is rounded you'll get 1
resultVar = 2^ (baseVar ) * 0.5
resultVar = 2^ (baseVar ) / 2
the fastest equivalent is resultVar = 2^(baseVar -1) with the same possible issue depending on trunc or rounded result
because x*0.5 is the same as x/2
and x^-1 is 1/x
then (x^y)/x is x^(y-1 )
and thus (2^y)/2 is 2^(y-1 )
You may use logical shift on integer: resultVar = (1 shl baseVar) shr 1
which gives the true integer result you are looking for THIS IS RIGHT THE RESULT
because x*2 in binary is x*10b which is a shl : x << 1
and x/2 in binary is x 10b which is a shr : x >> 1
then 2^x is 1 << x
but not 1 shl (baseVar -1) because shift count have to be positive or null
if you are using integer it may be ok you can get 0 if result is truncated or may be wrong if result is rounded you'll get 1
resultVar = 2^ (baseVar ) * 0.5
resultVar = 2^ (baseVar ) / 2
the fastest equivalent is resultVar = 2^(baseVar -1) with the same possible issue depending on trunc or rounded result
because x*0.5 is the same as x/2
and x^-1 is 1/x
then (x^y)/x is x^(y-1 )
and thus (2^y)/2 is 2^(y-1 )
You may use logical shift on integer: resultVar = (1 shl baseVar) shr 1
which gives the true integer result you are looking for THIS IS RIGHT THE RESULT
because x*2 in binary is x*10b which is a shl : x << 1
and x/2 in binary is x 10b which is a shr : x >> 1
then 2^x is 1 << x
but not 1 shl (baseVar -1) because shift count have to be positive or null
Posted Wed 29 May 19 @ 12:51 am
Thanks, I forgot I could param_cast 'int_trunc'
Posted Wed 29 May 19 @ 1:10 am