Hello everyone,
i finally finished my SmoothKnobs script.
You know, having step encoder knobs on my Mixtrack Quad always was a little problem for me, because when controlling effects it you could always hear the steps (e.g. when using the manual Sweep audio effect). The effect knobs are like a browser knob (infinite) if you don't know what i mean.
Ofcourse i just could've decreased the amount of value it changes by using param_multiply X but then i'd need to spin that thing at least 3 times to bring one effect knob from 0% to 100% and that won't sound smooth or any better at all.
So what i needed was a smoothing script and thats what i created.
But since that it was more 150 lines in the editor including some interpolating math, i knew if i created this for all other knobs by hand it would have taken me a long time...
So because i think it can be also useful for you guys, i developed a PHP script to makes this a little easier.
This is what the syntax of the function (what you use) will look like:
id - An deck-unique id for that knob, like 'fx1' for the first effect knob.
Must only occur once for all knobs and sliders assigned to one deck.
slider - the action the knob should perform, like 'effect_slider 1' or 'filter' or 'eq_mid'
steps - how much the knob can accellerate in steps.
minvalue - the smallest value that the knob will change when you move it one step, like '0.1'(%).
Note: don't enter the percent sign, because the script can't calculate with that, percent chars are added automaticly.
maxvalue - the highest value of 'velocity' that the knob will move.
readable - if the output should be in readable form (for editing) with paragraphs (is that the right word?)
You can enter TRUE or FALSE here. FALSE will give you a one-line output that you can copy'n'paste right into VDJ.
Coming soon:
duration and samples - how long the loops inside the script will move the knob, fixed to 20x every 5ms at the moment.
duration will make it smooth longer and samples will make it smooth better or less, but an action every 5ms seems to be good for now.
How to use
Copy this PHP code:
Now put this code on any webserver (XAMPP for local computer) that you want.
If you don't have one or don't know what i'm talking about, go to http://phpfiddle.org/ and replace the code window with your clipboard.
Scroll down to where the function is executed (almost last line) and change the values to your needs ( '' are needed for the first and second value).
Note: the values (step value, minvalue, maxvalue) must not use a comma.
Then you can load the website (for webservers) or hit 'run' on phpfiddle.
i finally finished my SmoothKnobs script.
You know, having step encoder knobs on my Mixtrack Quad always was a little problem for me, because when controlling effects it you could always hear the steps (e.g. when using the manual Sweep audio effect). The effect knobs are like a browser knob (infinite) if you don't know what i mean.
Ofcourse i just could've decreased the amount of value it changes by using param_multiply X but then i'd need to spin that thing at least 3 times to bring one effect knob from 0% to 100% and that won't sound smooth or any better at all.
So what i needed was a smoothing script and thats what i created.
But since that it was more 150 lines in the editor including some interpolating math, i knew if i created this for all other knobs by hand it would have taken me a long time...
So because i think it can be also useful for you guys, i developed a PHP script to makes this a little easier.
This is what the syntax of the function (what you use) will look like:
SmoothKnobs(id, slider, steps, minvalue, maxvalue, readable);
id - An deck-unique id for that knob, like 'fx1' for the first effect knob.
Must only occur once for all knobs and sliders assigned to one deck.
slider - the action the knob should perform, like 'effect_slider 1' or 'filter' or 'eq_mid'
steps - how much the knob can accellerate in steps.
minvalue - the smallest value that the knob will change when you move it one step, like '0.1'(%).
Note: don't enter the percent sign, because the script can't calculate with that, percent chars are added automaticly.
maxvalue - the highest value of 'velocity' that the knob will move.
readable - if the output should be in readable form (for editing) with paragraphs (is that the right word?)
You can enter TRUE or FALSE here. FALSE will give you a one-line output that you can copy'n'paste right into VDJ.
Coming soon:
duration and samples - how long the loops inside the script will move the knob, fixed to 20x every 5ms at the moment.
duration will make it smooth longer and samples will make it smooth better or less, but an action every 5ms seems to be good for now.
Copy this PHP code:
<?php
function SmoothKnobs($id, $slider, $steps, $minvalue, $maxvalue, $r) {
function nl($read) { //should the entire thing be readable or not? not (any value that is not false) will make it copy-pastable into vdj
if ($read == TRUE) {
echo ("<br/>");
} else {
echo (" ");
}
}
echo ("param_bigger 0 ?"); nl($r); //is the knob moving forward or not?
for ($i=0; $i <= $steps; $i++) { //if forward, stop all backwards repeats and reset their vars
if ($i != 0) {
echo ("& repeat_stop '".$id."br".$i."'");
} else {
echo ("repeat_stop '".$id."br".$i."'");
} nl($r);
echo ("& set '".$id."bc".$i."' 0"); nl($r);
}
for ($i=0; $i <= $steps; $i++) { //check which forward vars are active
if ($i != 0) {
echo ("var_greater '".$id."fc".$i."' 0 ?");
} else {
echo ("& var_greater '".$id."fc".$i."' 0 ?");
} nl($r);
}
echo ("nothing"); nl($r); //last instance does nothing
for ($i=$steps; $i >= 0; $i--) { //depending on the instance, do your thing
echo (": set '".$id."fc".$i."' 1"); nl($r);
echo ("& repeat_start_instant '".$id."fr".$i."' 5ms 10"); nl($r);
echo ("& cycle '".$id."fc".$i."' 11"); nl($r);
$value = ($i/$steps)*($maxvalue-$minvalue)+$minvalue;
echo ("& ".$slider." +".$value."%"); nl($r); //VALUE MISSING
}
for ($i=0; $i <= $steps; $i++) { //(backwards) stop all forward repeats and reset their vars
if ($i != 0) {
echo ("& repeat_stop '".$id."fr".$i."'");
} else {
echo (": repeat_stop '".$id."fr".$i."'"); //the ":" indicates that we are now in the backwards section
} nl($r);
echo ("& set '".$id."fc".$i."' 0"); nl($r);
}
for ($i=0; $i <= $steps; $i++) { //check the vars on which instance is running or which isnt
if ($i != 0) {
echo ("var_greater '".$id."bc".$i."' 0 ?");
} else {
echo ("& var_greater '".$id."bc".$i."' 0 ?");
} nl($r);
}
echo ("nothing"); nl($r); //last instance does nothing again
for ($i=$steps; $i >= 0; $i--) { //and actions
echo (": set '".$id."bc".$i."' 1"); nl($r);
echo ("& repeat_start_instant '".$id."br".$i."' 5ms 10"); nl($r);
echo ("& cycle '".$id."bc".$i."' 11"); nl($r);
$value = ($i/$steps)*($maxvalue-$minvalue)+$minvalue;
echo ("& ".$slider." -".$value."%"); nl($r); //VALUE MISSING
}
}
SmoothKnobs('fx1', 'effect_slider 1', 9, 0.1, 1, TRUE);
?>
Now put this code on any webserver (XAMPP for local computer) that you want.
If you don't have one or don't know what i'm talking about, go to http://phpfiddle.org/ and replace the code window with your clipboard.
Scroll down to where the function is executed (almost last line) and change the values to your needs ( '' are needed for the first and second value).
Note: the values (step value, minvalue, maxvalue) must not use a comma.
Then you can load the website (for webservers) or hit 'run' on phpfiddle.
Posté Tue 22 Sep 15 @ 11:45 am
Why didn't you use JavaScript or a vb Script that will execute local?
Even a Batch file is able to do what your script does.
Sorry no offense, but the “ordinary“ user will not set up an apache or other php server.
Even a Batch file is able to do what your script does.
Sorry no offense, but the “ordinary“ user will not set up an apache or other php server.
Posté Tue 22 Sep 15 @ 1:24 pm
I know it's not perfect but i already know PHP and wanted to make it work first before porting it to a more convenient language.
In case of JavaScript that might not take very long but i need some time to set it all up to work correctly with a small HTML interface and so on.
Also i know that not many people want to create an apache webserver, thats why i included the link to phpfiddle which i also used to test it (next to XAMPP).
When i am done with porting to JavaScript, i only need to find a place where i can permanently host this script without hosting it myself and without the need
to monitor it like i would with most free-webspace hosters.
This is far from finished and is more a 'proof-of-concept' (?) as i would really like to create more of these little helpers and maybe even a small VDJscript toolkit to create complex scripts more easily.
Thanks for the feedback PachN, i really wished that i could create Blogs for these things x)
Regards,
Daniel
In case of JavaScript that might not take very long but i need some time to set it all up to work correctly with a small HTML interface and so on.
Also i know that not many people want to create an apache webserver, thats why i included the link to phpfiddle which i also used to test it (next to XAMPP).
When i am done with porting to JavaScript, i only need to find a place where i can permanently host this script without hosting it myself and without the need
to monitor it like i would with most free-webspace hosters.
This is far from finished and is more a 'proof-of-concept' (?) as i would really like to create more of these little helpers and maybe even a small VDJscript toolkit to create complex scripts more easily.
Thanks for the feedback PachN, i really wished that i could create Blogs for these things x)
Regards,
Daniel
Posté Tue 22 Sep 15 @ 1:32 pm
Update:
Demo Video:
https://www.youtube.com/watch?v=q_42t8NytV0
Demo Video:
https://www.youtube.com/watch?v=q_42t8NytV0
Posté Tue 22 Sep 15 @ 1:41 pm
Versuche nochmal das Video hier einzubinden:
Posté Thu 24 Sep 15 @ 6:00 am