Silversleak3, too many changes needed to work out as a tut, I'll give you the basics.
发表时间 Fri 06 Jul 18 @ 11:19 am
I assumed that the execution of a non-query keyword would return false. That was expected, but in the following, set 'var1' 1 is not executed which was not expected. set 'var3' 3 is executed though.
set 'var1' 1 ? set 'var2' 2 : set 'var3' 3
In order to get set 'var1' 1 to execute you need to do:
set 'var1' 1 & false ? set 'var2' 2 : set 'var3' 3
...or
set 'var1' 1 & true ? set 'var2' 2 : set 'var3' 3
...or
set 'var1' 1
I thought that was strange. In the above posts, I was implying that it is important to know what verbs are queries and what ones are not. Probably fairly easy to make a mistake with that and then you have some odd behavior to boot. The documentation tells you above some queries, but not for others so it leaves you guessing.
As a side note, I was playing with the script engine from C++ and was tracing thru it some and noticed that newlines are ok when sent from C++. But when newlines are used in the script text on a skin, they do not appear to work so I assume that when the text sent from the skin, the text is truncated at the newline. It is still there for display though.
set 'var1' 1 ? set 'var2' 2 : set 'var3' 3
In order to get set 'var1' 1 to execute you need to do:
set 'var1' 1 & false ? set 'var2' 2 : set 'var3' 3
...or
set 'var1' 1 & true ? set 'var2' 2 : set 'var3' 3
...or
set 'var1' 1
I thought that was strange. In the above posts, I was implying that it is important to know what verbs are queries and what ones are not. Probably fairly easy to make a mistake with that and then you have some odd behavior to boot. The documentation tells you above some queries, but not for others so it leaves you guessing.
As a side note, I was playing with the script engine from C++ and was tracing thru it some and noticed that newlines are ok when sent from C++. But when newlines are used in the script text on a skin, they do not appear to work so I assume that when the text sent from the skin, the text is truncated at the newline. It is still there for display though.
Adion wrote :
In the first one, you are querying set instead of executing it. In that case it's similar to checking the value of 'var1' and comparing it to 1.
In the second and third one, it should be read as
set 'var1' 1 & (false ? set 'var2' 2 : set 'var3' 3)
Which you could more simply just write as
set 'var1' 1 & set 'var3' 3
(Regardless, if you would expect the first one to set var1, I'm not sure what you would expect the question mark to do in that case, since the var would always be set to what you asked it to be set to)
Edit: The reason why set also works as a query is so that it would also work on buttons for example without having to write a separate query for lighting up the button.
In the second and third one, it should be read as
set 'var1' 1 & (false ? set 'var2' 2 : set 'var3' 3)
Which you could more simply just write as
set 'var1' 1 & set 'var3' 3
(Regardless, if you would expect the first one to set var1, I'm not sure what you would expect the question mark to do in that case, since the var would always be set to what you asked it to be set to)
Edit: The reason why set also works as a query is so that it would also work on buttons for example without having to write a separate query for lighting up the button.
Don Moir wrote :
Ok that explains that then but then you can see the confusion of it I think. So is it such that everything can be treated as a query?
in C++, I might do something like:
int var1;
int var2 = 2;
if (var1 = var2) // assignment and test
....do something;
in C++, I might do something like:
int var1;
int var2 = 2;
if (var1 = var2) // assignment and test
....do something;
locodog wrote :
New lines and indents are fine in pad/mappers editor. Have been for at least 6 months probably longer.
Don Moir wrote :
Well I put a newline into Phatoms collapse script on one of the custom pad buttons and it no longer worked. The same script with the newlines did work when sent from C++ so go figure. Extraneous spaces have always worked I believe.
edit: Ah I see, it depends on where you put the newline. If before a ? then it appears not to work. If after the ? then it works. So inconsistency?
So I double checked, and the script that did not work with just one newline from the skin, does work when sent form C++. Originally I sent the complex script with a newline before every ? and : and that also worked when sent from C++.. But that script also does not work when put on a skin button.
edit: Ah I see, it depends on where you put the newline. If before a ? then it appears not to work. If after the ? then it works. So inconsistency?
So I double checked, and the script that did not work with just one newline from the skin, does work when sent form C++. Originally I sent the complex script with a newline before every ? and : and that also worked when sent from C++.. But that script also does not work when put on a skin button.
Don Moir wrote :
When I was first testing this, I was using effect_string instead of set. Since it was my effect_string declare, I expected it to fire my code but it does not. No telling what the query value of it is except false.
edit: Some of these things just come up when I am testing for doing other things. When I tested newlines in script long ago, it did not work. But when I am tracing thru the SendCommand last night, I see that newlines are handled. So I try that in C++ and it worked. Thought to try it from a skin button and ran into problems. Same sort of thing with queries but in that case also a user needs consistency. For my goal it is something different, but still, I or we need to know :)
Adion wrote :
Edit: The reason why set also works as a query is so that it would also work on buttons for example without having to write a separate query for lighting up the button.
When I was first testing this, I was using effect_string instead of set. Since it was my effect_string declare, I expected it to fire my code but it does not. No telling what the query value of it is except false.
edit: Some of these things just come up when I am testing for doing other things. When I tested newlines in script long ago, it did not work. But when I am tracing thru the SendCommand last night, I see that newlines are handled. So I try that in C++ and it worked. Thought to try it from a skin button and ran into problems. Same sort of thing with queries but in that case also a user needs consistency. For my goal it is something different, but still, I or we need to know :)
Adion wrote :
When queried, 'effect_string 1 "test"' should be true if the string is equal to "test"
Don Moir wrote :
Ok... since the declares don't have an option to handle queries, I guess that makes sense. In the doc it says:
Commands can be used either as actions or as queries, depending on the context.
Some commands can return a boolean (true or false) or a value, depending on the parameters:
- "crossfader" will return the value (between 0.0 and 1.0) if used in a query. Will also return true if its value is greater than 0.5 and false if smaller.
- "crossfader 42%" will return true if the crossfader is at 42%, and false otherwise.
Some other commands can return a string or a number, depending on the verb. (usually verbs starting with get_ )
- "get_time_ms" will return the time of the loaded track in ms as an integer
- "get_artist" will return the Artist of the loaded track as text
...and some other commands do something else I guess.
That seems to say every keyword can be a query or an action and it just depends on the keyword as to what the query result (and parameter) actually is. Maybe every keyword should be documented as to what the query of it means. I am not sure what the query value of get_ms would be for example but from your explanation it might be get_ms '1000' and then be true if equal to '1000'. Useless test I know but just for clarification.
If I use something starting with get_ it may not mean get and it might mean just test the value of whatever.
Commands can be used either as actions or as queries, depending on the context.
Some commands can return a boolean (true or false) or a value, depending on the parameters:
- "crossfader" will return the value (between 0.0 and 1.0) if used in a query. Will also return true if its value is greater than 0.5 and false if smaller.
- "crossfader 42%" will return true if the crossfader is at 42%, and false otherwise.
Some other commands can return a string or a number, depending on the verb. (usually verbs starting with get_ )
- "get_time_ms" will return the time of the loaded track in ms as an integer
- "get_artist" will return the Artist of the loaded track as text
...and some other commands do something else I guess.
That seems to say every keyword can be a query or an action and it just depends on the keyword as to what the query result (and parameter) actually is. Maybe every keyword should be documented as to what the query of it means. I am not sure what the query value of get_ms would be for example but from your explanation it might be get_ms '1000' and then be true if equal to '1000'. Useless test I know but just for clarification.
If I use something starting with get_ it may not mean get and it might mean just test the value of whatever.
Adion wrote :
typically the boolean query 'action value' is only implemented if that is also a valid action for setting something to that value, for the reason mentioned above.
get_time_ms can not be used as an action to set the time, so it only returns the time as advertised.
For queries involving these, you can of course use param_equal etc... to compare them and use them in boolean queries.
get_time_ms can not be used as an action to set the time, so it only returns the time as advertised.
For queries involving these, you can of course use param_equal etc... to compare them and use them in boolean queries.
Don Moir wrote :
Thanks. so get_effect_string when used as query does not get the effect string... gotcha :) and is actually implemented as test_effect_string
Adion wrote :
Typically, you use get_effect_string to get the actual string value, which it will of course do, and not to check if it has a specific value.
effect_string on the other hand would be used to set the string to a specific value "effect_string value", and can therefore also be used in a query to check for this specific value.
In this specific case, get_effect_string is just a synonym for effect_string, so both will actually work. get_ for many actions is only there because of compatibility with v7.
For new actions that make sense both as get_ and set_ just a single one will usually be added to do both query and set.
effect_string on the other hand would be used to set the string to a specific value "effect_string value", and can therefore also be used in a query to check for this specific value.
In this specific case, get_effect_string is just a synonym for effect_string, so both will actually work. get_ for many actions is only there because of compatibility with v7.
For new actions that make sense both as get_ and set_ just a single one will usually be added to do both query and set.
Don Moir wrote :
Yeah I saw that get_effect_string is just a synonym for effect_string and realizing now why you are probably wanting to get rid of the get. You know that in normal programming things tend not to be seen as ambiguous and in general considered to be bad. Meaning in most languages, if you call a function, no matter how it is used in a statement, the function is called.
I realize you are trying to keep script simple, but simple only works to a point before the simple becomes complex. I have been thru this before with much discussion in another world. Feeling like we are getting off subject in loco's thread to a degree now though. Thanks for the info guys.
I realize you are trying to keep script simple, but simple only works to a point before the simple becomes complex. I have been thru this before with much discussion in another world. Feeling like we are getting off subject in loco's thread to a degree now though. Thanks for the info guys.
发表时间 Sun 15 Jul 18 @ 5:18 pm
Param_cast, param_add, param_multipy, lots of param stuff.
Now as of EA4490 as far as I can see, basic arithmetic is possible in script so....
Guess what we're going to do? We're going to build a calculator (...sort of) with a pad page.
So what use is it for performance? None (I suppose you could work out if you've been ripped off at the bar......I'll save you the effort, you have.), BUT if you have it as a padpage you can reference it when you need to.
just have it there make it an hidden padpage so it stays out of your way (like sticking a textbook in the loft/attic, there when you need it)
That and pad pages are just so useful, as a test ground of scripts, to show you info, (might do a whole lesson on this... maybe rsi)
Start off a couple of scripts to save a second or two many times for years to come
deck 1 pad_edit
deck 2 pad_edit
stick these on a couple of keyboard buttons, it really saves time in the future.
Here we start, press deck 1 pad_edit button, up pops the editor (hello padpage!) click new pad page and call it calculator.
on pad 1 put this script
set 'var1' 8 && set 'var2' 2
name this button "Set"
we're just setting var1 to 8 and var2 to 2, (the && is so the pad only lights if both are set, not important)
on pad 2 put this script
get_var 'var1' & param_bigger "get_var 'var2'" ? on : off press enter, add a space on the new line and add this memory aid in quotes
"is the first thing bigger than the second ? yes lights on"
could use && here to avoid ? on : off , but didn't
(at the end of scripts you can put stuff in quotes AFTER A SPACE and vdj ignores it)
Name this button "compare 1"
ok close the editor and press button 1, button 5 lights up, var1 is indeed bigger than var2
back into you editor
on pad 3 put this script
param_bigger "get_var 'var1'" "get_var 'var2'" ? on : off (and enter newline space, your memory aid)
"is the 2nd thing bigger than the first? if yes lights on"
call this "compare 2"
wait this looks backwards.... yeah it does, remember the lesson back when I said the implicit is stuck on the end of a script? (you don't?! have a reread of lesson 6 how vdj gets values) well this is what vdj sees when you press button 2
(atomix made it this way so the; value, compare, value order (like button 2) looks right to our monkey brains. If button 3 was the way we'd expect, then button 2 would be backwards, no ways around it)
Now finally for compare button 4, here's the script
get_var 'var1' & param_equal "get_var 'var2'
call this "equal"
There is another way this can be written (param_equal "`get_var 'var1'`" "`get_var 'var2'`") this way you need backticks more on that later, I think this is because param_equal can be used to compare an action to a string (string being a collection of letters,numbers,chars) so vdj needs to know, is it a script or is it a string.
ok back to pad 1 and change the values for the vars, no matter what you put, when you click button 1 one of pads 2,3 or 4 will light up, it has to be v1 bigger than v2, v2 bigger than v1, or v1&2 equal
compares done now some arithmetic
but first let's display what's going on, open the editor, go to param 1 script box, press space (a bit of weirdness explain later) for the param 1 name put
var1 = `get_var 'var1'` var2 = `get_var 'var2'`
UH ok what's going on here, remember this is a textbox not a script box, so it will display
var1 =
then the backticks ( ` this little fella,) tells the textbox "this next bit is script, read it as a script" the second back tick says we're back on letters now, and so on.
so close the editor again as param 1 you'll see
var1 = # var2 = # (I put # as I've no idea what values you've given to the vars by now)
Now the second bit of the display the total
back into the editor, param 2 a quick space in the script box (param1&2 labels don't show unless there's something, anything in the script box)
and put this as param 2's name
var3 = `get_var 'var3'`
like above, but var3 will be our answer.
ok maths (it has a s on the end, it's plural, live with it)
button 5 call this one "add", here's the script.
param_add "get_var 'var1'" "get_var 'var2'" & param_cast & set 'var3'
Ok what's happening here, param_add easy enough, why the quotes round get_var 'var1' .....? well param_add expects a number or a script but if the script contains a space it confuses the verb so wrapping in quotes tells it "inside here is one script action", same again for get_var 'var2', ok so it's done the maths we save the value by, casting, (param_cast) this tells vdj to take the last value it had and stick it on the end on the next script, (like the implicit)
and here we cast to the end of " set 'var3' "
close the editor and have a try.
button 6 call this one multiply
param_multiply "get_var 'var1'" "get_var 'var2'" & param_cast & set 'var3'
straight forward, like before
ok things get a bit mathematical now as vdj doesn't have a param_divide or a param_subtract
button 7 call this one subtract
get_var 'var1' & param_invert & param_cast & set '1-var1' & param_add "get_var '1-var1'" -1 & param_cast & set '-var1' & param_add "get_var '-var1'" "get_var 'var2'" & param_cast & set 'var3'
memory aid
"((1 - var1 = 1-var1) -1 = -var1) + var2 = var3" "var2 - var1"
so we get var1 and invert it (vdj's invert is made for sliders so it uses 1-X, real inversion would be X - (2X), Lets say var1 = 7, so the inversion 1 - 7 = -6, we cast that to a new var '1-var1' & then param_add '1-var1' to -1 now we cast that to another new var '-var1' and it's a true inversion of var1, fantastic now we add -var1 to var2 and cast that to var 3 for our result.
finally button 8 call this one divide
get_var 'var1' & param_1_x & set "1/var1" & param_multiply "get_var '1/var1'" "get_var 'var2'" & param_cast & set 'var3'
memory aid
"(1/var1) * var2" "=" "var2 / var1"
ok no divide script but 8/4 is the same as 8 * (1 / 4) and vdj does have a 1/x script, so we use it, we've broken from form here, we haven't cast to the set '1/var1'
this is just a quirk of the 1_x script it expects to be cast and adding cast just after it makes vdj confused, (found that out the hard way...) the rest is just a multiply & set.
I'll level with you here, there's a few places in all these button scripts where param_cast is not needed, but I wanted the lesson to be consistent and they do no harm,
but the 1/x script it does harm and (there goes my consistency) has to be omitted.
ok that's that, have a quick play to make sure it works and then make the padpage hidden.
Next we'll try something useful with these concepts.
(some of this stuff above is really new, the verbs have been around for time but being able to do this type of thing has only just become possible)
I recommend you have a poke around at making a padpage there's a bit more to a finished padpage than described here... but not much more.
But in true Blue Peter style, here's one I made earlier (new text file, copy and paste) save as "mathsRef.xml" and pop it in your pads folder.
http://www.virtualdj.com/user/locodog/blogs/5715/mathsRef_xml.html
And for no reason I put some more stuff on shiftpads (NaN fans try shiftpad 6 for Sqrt of -1)
Now as of EA4490 as far as I can see, basic arithmetic is possible in script so....
Guess what we're going to do? We're going to build a calculator (...sort of) with a pad page.
So what use is it for performance? None (I suppose you could work out if you've been ripped off at the bar......I'll save you the effort, you have.), BUT if you have it as a padpage you can reference it when you need to.
just have it there make it an hidden padpage so it stays out of your way (like sticking a textbook in the loft/attic, there when you need it)
That and pad pages are just so useful, as a test ground of scripts, to show you info, (might do a whole lesson on this... maybe rsi)
Start off a couple of scripts to save a second or two many times for years to come
deck 1 pad_edit
deck 2 pad_edit
stick these on a couple of keyboard buttons, it really saves time in the future.
Here we start, press deck 1 pad_edit button, up pops the editor (hello padpage!) click new pad page and call it calculator.
on pad 1 put this script
set 'var1' 8 && set 'var2' 2
name this button "Set"
we're just setting var1 to 8 and var2 to 2, (the && is so the pad only lights if both are set, not important)
on pad 2 put this script
get_var 'var1' & param_bigger "get_var 'var2'" ? on : off press enter, add a space on the new line and add this memory aid in quotes
"is the first thing bigger than the second ? yes lights on"
could use && here to avoid ? on : off , but didn't
(at the end of scripts you can put stuff in quotes AFTER A SPACE and vdj ignores it)
Name this button "compare 1"
ok close the editor and press button 1, button 5 lights up, var1 is indeed bigger than var2
back into you editor
on pad 3 put this script
param_bigger "get_var 'var1'" "get_var 'var2'" ? on : off (and enter newline space, your memory aid)
"is the 2nd thing bigger than the first? if yes lights on"
call this "compare 2"
wait this looks backwards.... yeah it does, remember the lesson back when I said the implicit is stuck on the end of a script? (you don't?! have a reread of lesson 6 how vdj gets values) well this is what vdj sees when you press button 2
(atomix made it this way so the; value, compare, value order (like button 2) looks right to our monkey brains. If button 3 was the way we'd expect, then button 2 would be backwards, no ways around it)
Now finally for compare button 4, here's the script
get_var 'var1' & param_equal "get_var 'var2'
call this "equal"
There is another way this can be written (param_equal "`get_var 'var1'`" "`get_var 'var2'`") this way you need backticks more on that later, I think this is because param_equal can be used to compare an action to a string (string being a collection of letters,numbers,chars) so vdj needs to know, is it a script or is it a string.
ok back to pad 1 and change the values for the vars, no matter what you put, when you click button 1 one of pads 2,3 or 4 will light up, it has to be v1 bigger than v2, v2 bigger than v1, or v1&2 equal
compares done now some arithmetic
but first let's display what's going on, open the editor, go to param 1 script box, press space (a bit of weirdness explain later) for the param 1 name put
var1 = `get_var 'var1'` var2 = `get_var 'var2'`
UH ok what's going on here, remember this is a textbox not a script box, so it will display
var1 =
then the backticks ( ` this little fella,) tells the textbox "this next bit is script, read it as a script" the second back tick says we're back on letters now, and so on.
so close the editor again as param 1 you'll see
var1 = # var2 = # (I put # as I've no idea what values you've given to the vars by now)
Now the second bit of the display the total
back into the editor, param 2 a quick space in the script box (param1&2 labels don't show unless there's something, anything in the script box)
and put this as param 2's name
var3 = `get_var 'var3'`
like above, but var3 will be our answer.
ok maths (it has a s on the end, it's plural, live with it)
button 5 call this one "add", here's the script.
param_add "get_var 'var1'" "get_var 'var2'" & param_cast & set 'var3'
Ok what's happening here, param_add easy enough, why the quotes round get_var 'var1' .....? well param_add expects a number or a script but if the script contains a space it confuses the verb so wrapping in quotes tells it "inside here is one script action", same again for get_var 'var2', ok so it's done the maths we save the value by, casting, (param_cast) this tells vdj to take the last value it had and stick it on the end on the next script, (like the implicit)
and here we cast to the end of " set 'var3' "
close the editor and have a try.
button 6 call this one multiply
param_multiply "get_var 'var1'" "get_var 'var2'" & param_cast & set 'var3'
straight forward, like before
ok things get a bit mathematical now as vdj doesn't have a param_divide or a param_subtract
button 7 call this one subtract
get_var 'var1' & param_invert & param_cast & set '1-var1' & param_add "get_var '1-var1'" -1 & param_cast & set '-var1' & param_add "get_var '-var1'" "get_var 'var2'" & param_cast & set 'var3'
memory aid
"((1 - var1 = 1-var1) -1 = -var1) + var2 = var3" "var2 - var1"
so we get var1 and invert it (vdj's invert is made for sliders so it uses 1-X, real inversion would be X - (2X), Lets say var1 = 7, so the inversion 1 - 7 = -6, we cast that to a new var '1-var1' & then param_add '1-var1' to -1 now we cast that to another new var '-var1' and it's a true inversion of var1, fantastic now we add -var1 to var2 and cast that to var 3 for our result.
finally button 8 call this one divide
get_var 'var1' & param_1_x & set "1/var1" & param_multiply "get_var '1/var1'" "get_var 'var2'" & param_cast & set 'var3'
memory aid
"(1/var1) * var2" "=" "var2 / var1"
ok no divide script but 8/4 is the same as 8 * (1 / 4) and vdj does have a 1/x script, so we use it, we've broken from form here, we haven't cast to the set '1/var1'
this is just a quirk of the 1_x script it expects to be cast and adding cast just after it makes vdj confused, (found that out the hard way...) the rest is just a multiply & set.
I'll level with you here, there's a few places in all these button scripts where param_cast is not needed, but I wanted the lesson to be consistent and they do no harm,
but the 1/x script it does harm and (there goes my consistency) has to be omitted.
ok that's that, have a quick play to make sure it works and then make the padpage hidden.
Next we'll try something useful with these concepts.
(some of this stuff above is really new, the verbs have been around for time but being able to do this type of thing has only just become possible)
I recommend you have a poke around at making a padpage there's a bit more to a finished padpage than described here... but not much more.
But in true Blue Peter style, here's one I made earlier (new text file, copy and paste) save as "mathsRef.xml" and pop it in your pads folder.
http://www.virtualdj.com/user/locodog/blogs/5715/mathsRef_xml.html
And for no reason I put some more stuff on shiftpads (NaN fans try shiftpad 6 for Sqrt of -1)
发表时间 Tue 17 Jul 18 @ 3:03 pm
Everyone hates edits populating their what's new feed, I've just updated the last post with a link to the calculator in xml ready text.
发表时间 Tue 17 Jul 18 @ 8:10 pm
Just want to say BIG Thanks mate ;o)
发表时间 Tue 17 Jul 18 @ 8:21 pm
No worries, a proper way to do maths, how could I not share it?
发表时间 Tue 17 Jul 18 @ 8:27 pm
So I've not got round to another topic yet but here's one I just helped a guy with over on FB
Wedding entrances, a right old pain, you've a mic and notes and you've got a list of short tracks to play and you don't have time to drag the next one to deck.
You want the automagical powers of the rsi (repeat_start_instant) script, I want to go quite a way with rsi scripts but this is a nice start
Set your playlist in the side list
put this on a custom button
deck 1 var 'autoloadsys' 1 ? on & deck 1 set 'autoloadsys' 0 & repeat_stop 'RSIautoload' & set 'played' 0 : off & deck 1 set 'autoloadsys' 1 & browser_window 'sidelist' & browser_scroll 'top' & sidelist_load_and_remove & deck 1 repeat_start_instant 'RSIautoload' 50ms & deck 1 play ? set 'played' 1 : var 'played' ? deck 1 unload & sidelist_load_and_remove & set 'played' 0 : nothing
press the custom
it will jump the browser scroll to the top of the side list and load to deck then remove the track from the list.
it then waits for you to press play, when you press play it sets a var 'played' to 1, it then waits and watches for the deck till it's not playing (either by ending or you pressing pause) when not playing it unloads the deck, sets 'played' back to zero and then sidelist_load_and_remove the next in the sidelist.
here's the breakdown
deck 1 var 'autoloadsys' 1 ? on & deck 1 set 'autoloadsys' 0 & repeat_stop 'RSIautoload' & set 'played' 0 :
var autoloadsys is true when this thing is running, is the var = 1 ? yes, on is for the button light, so we're running turn the var to zero and stop the rsi script (that I called RSIautoload) also set the var 'played' to zero (good housekeeping)
off & deck 1 set 'autoloadsys' 1 & browser_window 'sidelist' & browser_scroll 'top' & sidelist_load_and_remove &
var autoloadsys if false, we're not running : off is for the light, set the autoloadsys var to 1, jump to the sidelist, jump to the top load track to deck and remove from list
deck 1 repeat_start_instant 'RSIautoload' 50ms & deck 1 play ? set 'played' 1 : var 'played' ? deck 1 unload & sidelist_load_and_remove & set 'played' 0 : nothing
here's the magic, I set up the rsi I give it a name "RSIautoload", I give it a repeat time 50ms, I Then give it a command to repeat.
Is deck 1 playing ? yes set 'played' to 1 : no not playing, is var 'played' true ? yes unload, load track, remove from playlist, reset the var 'played' to zero : not playing and var played is false, then we're waiting for the next track to be played, do nothing
To be proper pro about it, you'd have a mic stand and a foot switch to act as a play button
Wedding entrances, a right old pain, you've a mic and notes and you've got a list of short tracks to play and you don't have time to drag the next one to deck.
You want the automagical powers of the rsi (repeat_start_instant) script, I want to go quite a way with rsi scripts but this is a nice start
Set your playlist in the side list
put this on a custom button
deck 1 var 'autoloadsys' 1 ? on & deck 1 set 'autoloadsys' 0 & repeat_stop 'RSIautoload' & set 'played' 0 : off & deck 1 set 'autoloadsys' 1 & browser_window 'sidelist' & browser_scroll 'top' & sidelist_load_and_remove & deck 1 repeat_start_instant 'RSIautoload' 50ms & deck 1 play ? set 'played' 1 : var 'played' ? deck 1 unload & sidelist_load_and_remove & set 'played' 0 : nothing
press the custom
it will jump the browser scroll to the top of the side list and load to deck then remove the track from the list.
it then waits for you to press play, when you press play it sets a var 'played' to 1, it then waits and watches for the deck till it's not playing (either by ending or you pressing pause) when not playing it unloads the deck, sets 'played' back to zero and then sidelist_load_and_remove the next in the sidelist.
here's the breakdown
deck 1 var 'autoloadsys' 1 ? on & deck 1 set 'autoloadsys' 0 & repeat_stop 'RSIautoload' & set 'played' 0 :
var autoloadsys is true when this thing is running, is the var = 1 ? yes, on is for the button light, so we're running turn the var to zero and stop the rsi script (that I called RSIautoload) also set the var 'played' to zero (good housekeeping)
off & deck 1 set 'autoloadsys' 1 & browser_window 'sidelist' & browser_scroll 'top' & sidelist_load_and_remove &
var autoloadsys if false, we're not running : off is for the light, set the autoloadsys var to 1, jump to the sidelist, jump to the top load track to deck and remove from list
deck 1 repeat_start_instant 'RSIautoload' 50ms & deck 1 play ? set 'played' 1 : var 'played' ? deck 1 unload & sidelist_load_and_remove & set 'played' 0 : nothing
here's the magic, I set up the rsi I give it a name "RSIautoload", I give it a repeat time 50ms, I Then give it a command to repeat.
Is deck 1 playing ? yes set 'played' to 1 : no not playing, is var 'played' true ? yes unload, load track, remove from playlist, reset the var 'played' to zero : not playing and var played is false, then we're waiting for the next track to be played, do nothing
To be proper pro about it, you'd have a mic stand and a foot switch to act as a play button
deck 1 var 'autoloadsys' 1
..? on & deck 1 set 'autoloadsys' 0 & repeat_stop 'RSIautoload' & set 'played' 0
..: off & deck 1 set 'autoloadsys' 1 & browser_window 'sidelist' & browser_scroll 'top' & sidelist_load_and_remove & deck 1 repeat_start_instant 'RSIautoload' 50ms & deck 1 play
....? set 'played' 1
....: var 'played'
......? deck 1 unload & sidelist_load_and_remove & set 'played' 0
......: nothing
发表时间 Sun 29 Jul 18 @ 7:07 am
A quick question I got on FB
"How do I change the LED color based on the camelot key"
I thought it would be something like:
param_equal '`get_harmonic`' '01A' ? <change the led color>
- but that doesn't seem to work
Then if param_equel accepts an action by default it could be as simple as:
param_equal get_harmonic '01A' ? <change the led color>
- but that doesn't seem to work either
What am I missing?
"How do I change the LED color based on the camelot key"
I thought it would be something like:
param_equal '`get_harmonic`' '01A' ? <change the led color>
- but that doesn't seem to work
Then if param_equel accepts an action by default it could be as simple as:
param_equal get_harmonic '01A' ? <change the led color>
- but that doesn't seem to work either
What am I missing?
发表时间 Thu 13 Sep 18 @ 2:29 pm
param_equal '`get_harmonic`' '08A'
seems to work fine for me, it's true when the key is 08A, and false otherwise.
seems to work fine for me, it's true when the key is 08A, and false otherwise.
发表时间 Thu 13 Sep 18 @ 3:16 pm
Adion wrote :
param_equal '`get_harmonic`' '08A'
seems to work fine for me, it's true when the key is 08A, and false otherwise.
seems to work fine for me, it's true when the key is 08A, and false otherwise.
Then I messed up the easy part somehow :-D
Sorry - my bad
发表时间 Thu 13 Sep 18 @ 5:09 pm
Hey Loco, Thanks for taking the time to reply to my post earlier this year. i apologize for taking so long to get back in here, but wedding season ran me ragged this fall. So my initial question was a little convoluted, let me just tell you my goal and show you what I have and go from there.
I have a pad scripted to assist with scratching, Ii specifically use it to time the cuts, while I manually manipulate the turntable. Here is an example of one of the pad buttons:
"pad_param2 & down ? get_var '$trans4' & param_cast 'ms' & repeat_start 'transrep' & level 100% ? level 1% : level 100% : repeat_stop 'transrep' & level 100% & masterdeck_auto on"
And this is stored in the param2 slot of the pad in question to get the relevant BPM info, do the math, and set the variables.
"masterdeck_auto off & deck 1 masterdeck ? deck 1 get_bpm & param_1_x & set '$trans1' & get_var '$trans1' & param_multiply 10000 & set '$transtrip' & get_var '$trans1' & param_multiply 15000 & set '$trans2' & get_var '$trans1' & param_multiply 7500 & set '$trans4' & get_var '$trans1' & param_multiply 3750 & set '$trans8' : deck 2 masterdeck ? deck 2 get_bpm & param_1_x & set '$trans1' & get_var '$trans1' & param_multiply 10000 & set '$transtrip' & get_var '$trans1' & param_multiply 15000 & set '$trans2' & get_var '$trans1' & param_multiply 7500 & set '$trans4' & get_var '$trans1' & param_multiply 3750 & set '$trans8' : deck 3 masterdeck ? deck 3 get_bpm & param_1_x & set '$trans1' & get_var '$trans1' & param_multiply 10000 & set '$transtrip' & get_var '$trans1' & param_multiply 15000 & set '$trans2' & get_var '$trans1' & param_multiply 7500 & set '$trans4' & get_var '$trans1' & param_multiply 3750 & set '$trans8' : deck 4 masterdeck ? deck 4 get_bpm & param_1_x & set '$trans1' & get_var '$trans1' & param_multiply 10000 & set '$transtrip' & get_var '$trans1' & param_multiply 15000 & set '$trans2' & get_var '$trans1' & param_multiply 7500 & set '$trans4' & get_var '$trans1' & param_multiply 3750 & set '$trans8'"
So the script stored in the param slot determines which deck is master, queries its BPM, converts that BPM into so many milliseconds, and sets numerous variables. Then the pad buttons do a one time activation of the param script, then use one of the variables it set to alternate the actiondeck level between 0 and 100 at the desired interval.
It works well for the first 8 beats or so, but then the cuts begin to drift. I'm guessing some fluctuation in the speed the script is being processed may be to blame. So I had the idea of scripting a sort of "gate" in the code to watch the beatgrid of the masterdeck, and restart the cuts every 4 or 8 beats precisely when the masterdeck grid passes the needle marker. I have been working on this in my limited free time for the past year with little success.
Do you see any way to make this work? Here are the musts: the masterdeck and actiondeck must not be required to be bpm synced, or pitch/beatlocked, It must be done by alternating either the actiondeck level, gain, or crossfader position, the level cuts must only affect the actiondeck, Cuts need to be on 8th beat, quarter beat, and half beat(chosen by which pad button is pressed) And those cuts must stay on sync with the masterdeck beatgrid. I wiil post a short video in a sec to show you the drift I am talking about.
I have a pad scripted to assist with scratching, Ii specifically use it to time the cuts, while I manually manipulate the turntable. Here is an example of one of the pad buttons:
"pad_param2 & down ? get_var '$trans4' & param_cast 'ms' & repeat_start 'transrep' & level 100% ? level 1% : level 100% : repeat_stop 'transrep' & level 100% & masterdeck_auto on"
And this is stored in the param2 slot of the pad in question to get the relevant BPM info, do the math, and set the variables.
"masterdeck_auto off & deck 1 masterdeck ? deck 1 get_bpm & param_1_x & set '$trans1' & get_var '$trans1' & param_multiply 10000 & set '$transtrip' & get_var '$trans1' & param_multiply 15000 & set '$trans2' & get_var '$trans1' & param_multiply 7500 & set '$trans4' & get_var '$trans1' & param_multiply 3750 & set '$trans8' : deck 2 masterdeck ? deck 2 get_bpm & param_1_x & set '$trans1' & get_var '$trans1' & param_multiply 10000 & set '$transtrip' & get_var '$trans1' & param_multiply 15000 & set '$trans2' & get_var '$trans1' & param_multiply 7500 & set '$trans4' & get_var '$trans1' & param_multiply 3750 & set '$trans8' : deck 3 masterdeck ? deck 3 get_bpm & param_1_x & set '$trans1' & get_var '$trans1' & param_multiply 10000 & set '$transtrip' & get_var '$trans1' & param_multiply 15000 & set '$trans2' & get_var '$trans1' & param_multiply 7500 & set '$trans4' & get_var '$trans1' & param_multiply 3750 & set '$trans8' : deck 4 masterdeck ? deck 4 get_bpm & param_1_x & set '$trans1' & get_var '$trans1' & param_multiply 10000 & set '$transtrip' & get_var '$trans1' & param_multiply 15000 & set '$trans2' & get_var '$trans1' & param_multiply 7500 & set '$trans4' & get_var '$trans1' & param_multiply 3750 & set '$trans8'"
So the script stored in the param slot determines which deck is master, queries its BPM, converts that BPM into so many milliseconds, and sets numerous variables. Then the pad buttons do a one time activation of the param script, then use one of the variables it set to alternate the actiondeck level between 0 and 100 at the desired interval.
It works well for the first 8 beats or so, but then the cuts begin to drift. I'm guessing some fluctuation in the speed the script is being processed may be to blame. So I had the idea of scripting a sort of "gate" in the code to watch the beatgrid of the masterdeck, and restart the cuts every 4 or 8 beats precisely when the masterdeck grid passes the needle marker. I have been working on this in my limited free time for the past year with little success.
Do you see any way to make this work? Here are the musts: the masterdeck and actiondeck must not be required to be bpm synced, or pitch/beatlocked, It must be done by alternating either the actiondeck level, gain, or crossfader position, the level cuts must only affect the actiondeck, Cuts need to be on 8th beat, quarter beat, and half beat(chosen by which pad button is pressed) And those cuts must stay on sync with the masterdeck beatgrid. I wiil post a short video in a sec to show you the drift I am talking about.
发表时间 Sat 29 Dec 18 @ 10:31 pm
*edit* eugh typed out and then lost the text.
I'd say there's a rounding error, I'd perhaps take a different approach and use something like this
repeat_start_instant "name" 33ms & get_beat & param_greater X% ? level 0% : level 100%
I'd say there's a rounding error, I'd perhaps take a different approach and use something like this
repeat_start_instant "name" 33ms & get_beat & param_greater X% ? level 0% : level 100%
发表时间 Mon 07 Jan 19 @ 9:50 pm
locodog wrote :
repeat_start_instant "name" 33ms & get_beat & param_greater X% ? level 0% : level 100%
repeat_start_instant "name" 33ms & get_beat & param_greater X% ? level 0% : level 100%
Since I need to sync the fader cuts to the on air deck, but act on the opposite deck, can the repeat look at one side and act on the other? That was where I ran into trouble before using a similar method. So for example:
repeat_start_instant "name" 33ms & deck right get_beat & param_greater X% ? Deck left level 0% : deck left level 100%
Also it looks like this would only cut one time per beat, any way to get it to cut in when the beat value is at 1% 25% 50% and 75%, and out at 12.5% 37.5% 62.5% and 87.5% for a quarter beat transform?
Thanks for the reply loco. I have used a lot of your advice and tips to up my game.
发表时间 Wed 09 Jan 19 @ 8:34 am
Sure it's possible.
You can also adress a fixed deck by using "deck 1" instead of deck left/ right. If you are using more than two decks deck left/right is the currently active deck on each side.
You can also adress a fixed deck by using "deck 1" instead of deck left/ right. If you are using more than two decks deck left/right is the currently active deck on each side.
发表时间 Wed 09 Jan 19 @ 8:40 am
Thanks PachN.
Yeah just specify what deck you want it to read/act upon
deck 1 get_whatever & deck 2 do_something
You're right (one cut per beat), I kept the explanation simple, take a second to think what you want the script to do
Above this but below that ? Yes,drop volume : No, above that but below another value ? Yes, raise volume : No above the other... below a 4th value ?
So it will look something like this
repeat_start_instant "name" 33ms & deck right get_beat & param_greater 0% ? param_smaller 12.5% ? Deck left level 0% : param_smaller 25% ? deck left level 100% : param_smaller 37.5% ? deck left level 0% : etc etc
If really needs be I could make a plugin to monitor masterdeck to cut another deck but even plugins have a scan limit of ∼15ms
Yeah just specify what deck you want it to read/act upon
deck 1 get_whatever & deck 2 do_something
ZeroZuluBrav0 wrote :
Also it looks like this would only cut one time per beat, any way to get it to cut in when the beat value is at 1% 25% 50% and 75%, and out at 12.5% 37.5% 62.5% and 87.5% for a quarter beat transform?
Also it looks like this would only cut one time per beat, any way to get it to cut in when the beat value is at 1% 25% 50% and 75%, and out at 12.5% 37.5% 62.5% and 87.5% for a quarter beat transform?
You're right (one cut per beat), I kept the explanation simple, take a second to think what you want the script to do
Above this but below that ? Yes,drop volume : No, above that but below another value ? Yes, raise volume : No above the other... below a 4th value ?
So it will look something like this
repeat_start_instant "name" 33ms & deck right get_beat & param_greater 0% ? param_smaller 12.5% ? Deck left level 0% : param_smaller 25% ? deck left level 100% : param_smaller 37.5% ? deck left level 0% : etc etc
If really needs be I could make a plugin to monitor masterdeck to cut another deck but even plugins have a scan limit of ∼15ms
发表时间 Wed 09 Jan 19 @ 10:25 am
Edit...fixed
发表时间 Thu 10 Jan 19 @ 6:10 pm
You may have already explained this, but I can't find it, so here goes
You do you do a general AND after a CONDITION (?) block
So like
(A ? B : C) & D
I relialize that you can just put D in the front
D & A ? B : C
but the D part may also hold a condition
You can also do
A ? B & D : C & D
But again D may be complex in itself
So is there a general way to handle for instance :
(A ? B : C)
&
(D ? E : F)
&
(G ? H : I)
&
(J ? K : L)
You do you do a general AND after a CONDITION (?) block
So like
(A ? B : C) & D
I relialize that you can just put D in the front
D & A ? B : C
but the D part may also hold a condition
You can also do
A ? B & D : C & D
But again D may be complex in itself
So is there a general way to handle for instance :
(A ? B : C)
&
(D ? E : F)
&
(G ? H : I)
&
(J ? K : L)
发表时间 Thu 24 Jan 19 @ 2:52 pm
Not with straight script, I've put in requests to execute a "second script" with some sort of symbol after the end of the false reply (something like A ? B : C * D ? E: F) but it's either low in the todo pile or it's in the not happening pile.
However, you can do what you want by another way,
Lets say you want to run all 4 queries from one button press, without making it multibranch
(avoid D query in the reply B and C, and G query in the reply E and F etc)
Use a pad page :-), simply put each single query on a single pad then your calling button performs the script
pad 1 & pad 2 & pad 3 & pad 4
To work properly there needs to be a new verb to store and call pad pages, I'll add it in wishes.
However, you can do what you want by another way,
Lets say you want to run all 4 queries from one button press, without making it multibranch
(avoid D query in the reply B and C, and G query in the reply E and F etc)
Use a pad page :-), simply put each single query on a single pad then your calling button performs the script
pad 1 & pad 2 & pad 3 & pad 4
To work properly there needs to be a new verb to store and call pad pages, I'll add it in wishes.
发表时间 Thu 24 Jan 19 @ 7:43 pm
locodog wrote :
Use a pad page :-), simply put each single query on a single pad then your calling button performs the script
pad 1 & pad 2 & pad 3 & pad 4
pad 1 & pad 2 & pad 3 & pad 4
Nice idea!
Let me try that :)
发表时间 Thu 24 Jan 19 @ 8:27 pm
Shader stuff
How do, has been awhile but this I think shader scripts need to be written down.
klausMogenson, I has a video on this subject, his focus is his workflow (shaders as audioonlyvisualisation)
How do, has been awhile but this I think shader scripts need to be written down.
klausMogenson, I has a video on this subject, his focus is his workflow (shaders as audioonlyvisualisation)
That's his workflow, below is mine (shaders on decks)
Selecting specific shaders
effect_string "shader" 1 "shaderName"
So we want to set a string on a effect
the effect we want to set the string on is the "shader" fx
the string number (some fx have several effect_stings) is number 1
the string we want to send is "shaderName"
Now "shaderName" can be either the shader's name as given by it's creator or it can be the address the shader can be found at the shadertoy site something like
"GdAFMK" (best guess is some sort of base64 filing system that means very little to us humans)
To display the current shader name (and I'll assume you want the given name because you're not a computer) use
get_effect_string "shader" 2
string 2 because while the machine is smart enough to set the shader by either given or indexed name on string 1, if you get string 1 it always returns the indexed name, (must be under the hood stuff) string 2 is the "pretty name"
Ok a specific shader at a specific time, great, what else can we do?
Well how about the next or previous (in the list) shader, do that like this..
effect_string "shader" 1 +1
effect_string "shader" 1 -1
What about shader folders, yep we got that covered, with effect_string 3
effect_string "shader" 3 "B&W"
(I have a folder called "B&W" for black & white shaders)
okey cokey, how about the buttons "auto-change" & "beatMove"
They're just fx buttons and are toggled like so
effect_button "shader" 2 (change)
effect_button "shader" 3 (move)
I've covered buttons earlier, what with fxslots, no slot, on, off , toggle so I'll avoid repeating myself.
effect_button "shader" 1 opens the shader position box if you were wondering. (well done for wondering)
Ok just a few sliders to cover
effect_slider "shader" 1
this one picks the shader, but I'm honestly not sure how useful it is (difficult to use with precision), I suppose time will tell.
I suppose it might be better if it obeyed the folder, but currently it just picks from the "all" folder.
effect_slider "shader" 2
this one does transparency.
I think that's it for shader scripts to date.
Any topics you'd like covered just ask.
I might cover the setting action next as it's one that users need quite often.
*post script*
This post lead to quite a bit of head scratching, partly my fault for focusing on my personal work flow (this instance a shader on a deck)
So some clarification
In instances of audioOnlyVisualisation or videoOverlay
* For the video source for audio tracks:
effect_string "audioonlyvisualisation" 1 +1
Since the slot is specified, you don't specify the effect as well, so it depends on shader already selected as audio only visualisation.
* For video effect overlay
deck master effect_string "video" 1 +1
If shader is selected in the video slot
or
deck master effect_string "shader" 1 +1
Independent of which slot it is currently selected in (or none at all)
发表时间 Wed 27 Mar 19 @ 10:36 am