Hi,
A while back, a dance dj for ballroom competitions posted a request for help with a script that would look at the Genre tag of a song loaded on a deck, and automatically adjust the bpm of the song. He had a table of various ballroom dances and the desired bpm.
here is the code that one of your members put together.
var "$bpmSet" 0 ? set "$bpmSet" 1 & repeat_start_instant "rsiStartrsi" 33ms 4 & cycle "$1to4" +4 & var "$1to4" 1 ? repeat_start_instant "rsiD1pulseCatch" 33ms & deck 1 load_pulse ? nothing : param_equal "`deck 1 get_genre`" "Tango" ? deck 1 pitch 128 bpm : (copy last query for all genres in list, last one ending " : (false reply) pitch 0% : " ) var "$1to4" 2 ? "rsiD2pulseCatch" 33ms & deck 2 load_pulse ? nothing : param_equal "`deck 2 get_genre`" "Tango" ? deck 2 pitch 128 bpm : (as above) (continue with var "$1to4" 3 ? for deck 3, set up the rsi, query genre to string, set pitch to bpm, continue with deck 4 (var "$1to4" 0 ?) as above, ending like above " pitch 0% : nothing : "
(then the reply for var "$bpmSet" 0 ? (Not true) ) set "$bpmSet" 0 & repeat_stop "rsiD1pulseCatch" & (stop other rsi's for other decks)
The code works good, however it would be helpful to a nested comparison where it would adjust the bpm down only if its above a certain value (such as 120 bpm), (or outside of a range of bpm such as 105 - 125
The tutorial shows how to do nested commands, but Im not getting the syvantax right or possibly the application of a command
Are variables and parameters the same thing ?
I tried using get_bpm, and then parameter_bigger to do the comparison but that doesnt work.
Also I dont know why in the code above that works, why there is an apostrophe next to quotation marks sometimes
Any ideas would be appreciated
Thanks
I was trying to use
A while back, a dance dj for ballroom competitions posted a request for help with a script that would look at the Genre tag of a song loaded on a deck, and automatically adjust the bpm of the song. He had a table of various ballroom dances and the desired bpm.
here is the code that one of your members put together.
var "$bpmSet" 0 ? set "$bpmSet" 1 & repeat_start_instant "rsiStartrsi" 33ms 4 & cycle "$1to4" +4 & var "$1to4" 1 ? repeat_start_instant "rsiD1pulseCatch" 33ms & deck 1 load_pulse ? nothing : param_equal "`deck 1 get_genre`" "Tango" ? deck 1 pitch 128 bpm : (copy last query for all genres in list, last one ending " : (false reply) pitch 0% : " ) var "$1to4" 2 ? "rsiD2pulseCatch" 33ms & deck 2 load_pulse ? nothing : param_equal "`deck 2 get_genre`" "Tango" ? deck 2 pitch 128 bpm : (as above) (continue with var "$1to4" 3 ? for deck 3, set up the rsi, query genre to string, set pitch to bpm, continue with deck 4 (var "$1to4" 0 ?) as above, ending like above " pitch 0% : nothing : "
(then the reply for var "$bpmSet" 0 ? (Not true) ) set "$bpmSet" 0 & repeat_stop "rsiD1pulseCatch" & (stop other rsi's for other decks)
The code works good, however it would be helpful to a nested comparison where it would adjust the bpm down only if its above a certain value (such as 120 bpm), (or outside of a range of bpm such as 105 - 125
The tutorial shows how to do nested commands, but Im not getting the syvantax right or possibly the application of a command
Are variables and parameters the same thing ?
I tried using get_bpm, and then parameter_bigger to do the comparison but that doesnt work.
Also I dont know why in the code above that works, why there is an apostrophe next to quotation marks sometimes
Any ideas would be appreciated
Thanks
I was trying to use
Posted Fri 27 Aug 21 @ 12:13 am
a variable can save a param, a param can set a variable, but they're slightly different, variable is stored a param is grabbed live.
param_bigger
[not parameter_bigger]
it's a backtick next to the quote mark, back ticks are used to tell a script that what is inside the backticks ` ` read the script, and parse the returned info.
looks like one of my scripts, but it was a good few years back.
so this bit
param_equal "`deck 1 get_genre`" "Tango" ? deck 1 pitch 128 bpm : .....
needs to be changed to something like this
param_equal "`deck 1 get_genre`" "Tango" ? param_equal "`param_smaller get_bpm 126`" "`param_bigger get_bpm 130`" ? (within range) nothing : deck 1 pitch 128 bpm : QUERY FOR NEXT GENRE
explained
genre is equal to string TANGO ? (yes) Are these next 2 queries equal/do they both return true ( is 126 smaller than bpm) ( is 130 bigger than bpm) ? within range : out of range set bpm : (no, genre not equal String) next genre/string query
param_bigger
[not parameter_bigger]
it's a backtick next to the quote mark, back ticks are used to tell a script that what is inside the backticks ` ` read the script, and parse the returned info.
looks like one of my scripts, but it was a good few years back.
so this bit
param_equal "`deck 1 get_genre`" "Tango" ? deck 1 pitch 128 bpm : .....
needs to be changed to something like this
param_equal "`deck 1 get_genre`" "Tango" ? param_equal "`param_smaller get_bpm 126`" "`param_bigger get_bpm 130`" ? (within range) nothing : deck 1 pitch 128 bpm : QUERY FOR NEXT GENRE
explained
genre is equal to string TANGO ? (yes) Are these next 2 queries equal/do they both return true ( is 126 smaller than bpm) ( is 130 bigger than bpm) ? within range : out of range set bpm : (no, genre not equal String) next genre/string query
Posted Fri 27 Aug 21 @ 1:16 am
other point of view as Locodog is always responding faster ;)
for things like that, it may be interesting to create sub-routine in another button/pad
and call it instead of nested and repeated code
prepend test with "deck n" makes it default and prevent repeating it everywhere
custom_button 1:
... deck 1 param_contains 'Tango' `get_genre` ? custom_button 2 : ...
with custom_button 2:
get bpm & param_bigger 105.0 ? param_smaller 125.0 ? action inrange : action pitchhigh : action pitchlow
fsulik wrote :
deck 1 load_pulse ? nothing : param_equal "`deck 1 get_genre`" "Tango" ? deck 1 pitch 128 bpm : (copy last query for all genres in list, last one ending "
...
however it would be helpful to a nested comparison where it would adjust the bpm down only if its above a certain value (such as 120 bpm), (or outside of a range of bpm such as 105 - 125
...
however it would be helpful to a nested comparison where it would adjust the bpm down only if its above a certain value (such as 120 bpm), (or outside of a range of bpm such as 105 - 125
for things like that, it may be interesting to create sub-routine in another button/pad
and call it instead of nested and repeated code
prepend test with "deck n" makes it default and prevent repeating it everywhere
custom_button 1:
... deck 1 param_contains 'Tango' `get_genre` ? custom_button 2 : ...
with custom_button 2:
get bpm & param_bigger 105.0 ? param_smaller 125.0 ? action inrange : action pitchhigh : action pitchlow
Posted Fri 27 Aug 21 @ 1:22 am
Can be slimmed down considerably now we have onsongload
Custom_button [mode on/off]
toggle '$dcPitch'
ONSONGLOAD
var '$dcPitch' 1 ? param_equal "`get_genre`" "Tango" ? param_equal "`param_smaller get_bpm 126`" "`param_bigger get_bpm 130`" ? nothing : pitch 128 bpm : QUERY FOR NEXT GENRE
Custom_button [mode on/off]
toggle '$dcPitch'
ONSONGLOAD
var '$dcPitch' 1 ? param_equal "`get_genre`" "Tango" ? param_equal "`param_smaller get_bpm 126`" "`param_bigger get_bpm 130`" ? nothing : pitch 128 bpm : QUERY FOR NEXT GENRE
Posted Fri 27 Aug 21 @ 1:56 am
Thankyou all for the generous responses. I will have to chew on the code while and try and digest it
Posted Sun 29 Aug 21 @ 5:40 pm