Quick Sign In:  

Forum: General Discussion

Topic: Script School - Page: 38.25
locoDogPRO InfinityModeratorMember since 2013
The implicit, what is it? where is it used? why can it be annoying? how do you tame it?

The implicit is really useful, for simple basic script you don't even realise it's there because it's that intuitive.
Get a bit more involved with script and you end up fighting it, either by choice or it choosing you [that actually happens, it picks a fight with you]

So what actually is it? It's the value of a HW slider [0.0 to 1.0] or an encoder [-1 or +1, encoders can give other values but most spit out -1/+1]
Most case that's fine, a custom_button slider also has an implicit too.
Let's see it in action,
set b & loop 0 ? loop : loop_length

add this to a real HW slider or custom_button slider and move it about,
bring up, var_list click the refresh check box,
to watch that variable change,

so what's this script doing?
Imagine the value of the slider is 0.42 and imagine that value is inserted after every script verb, so our script will look like
set b 0.42 & loop 0 0.42 ? loop 0.42 : loop_length 0.42

set variable b simple enough, query loop 0 0.42 ? well loop 0 is like saying no loop active so the 0.42 is ignored because loop only accepts 1 param [length as beats, length as ms, or length modifier with %]
So is loop 0 ?
yes then turn loop 0.42 on :
no, loop is on so change it's size 0.42 beats

All very basic and boring, let's get interesting
set b & param_multiply 4 & loop 0 ? loop : loop_length & set d

so b will set between 0.0 - 1.0, but our loop length goes from 0.0 to 4.0
the param_multiply has changed the implicit, see the value of d it too receives the modified implicit.

set b & param_multiply 4 & loop 0 ? loop : get_var b & param_cast & set c & loop_length & set d

look at this, you expect the value of b to be cast to var c, but it doesn't happen, the implicit gets in there first,
now you have a fight.
once there's an implicit if you need to cast anywhere, you have to use the implicit to do it.

How do you work round it?, given this script again how do you cast the val of b to var c and still get the loop length behaviour we want?
set b & param_multiply 4 & loop 0 ? loop : get_var b & param_cast & set c & loop_length & set d

you mangle the implicit until it's the number you want and then turn it back.

set b & param_multiply 4 & loop 0 ? loop : param_multiply 0 & param_add 1 & param_multiply 'get_var b' & set c & param_multiply 4 & loop_length & set d
multiply by zero so our implicit is zero
add one so our implicit is 1
multiply by the value we want [var b]
set c then multiply by 4 to get our loop_length behaviour back


Mostly implicit is HW sliders & encoders so mostly no bother... until it picks a fight with you with some other input, it shouldn't happen but it can with scripting a certain way.
I can't explain exactly what that scripting is but if you seem to be getting odd results and suspect a implicit has turned on in your script, add this in your script to check
& set test &
if it sets to 1.000 you probably don't have an implicit issue, but any other value then you do.


Right those were the entrée, now for the main meal;
All very easy with example cases but real world you might need to cast text or a number or a percentage, so I'll show you this, my arranged fight with the implicit

firstly I only set 4 vars to a value directly
I set a var called clock, to the clocktime string with `get_clock`
I set a var called "2.5bt" to a string value of "OgI" [a stupid name for a var for a stupid trick later]
I set var othervar to 4.2
And I set initImplicitTime to 100

then I use a trick to create an implicit on a custom_button script that aren't supposed to have an implicit. [the trick is casting to a rsi time, I believe because the rsi is expecting "name" time repeatCount, and it doesn't get everything it expects the implicit happens... or it could just be gremlins]

After that, it's just me bashing about the implicit into all kind of forms, percent, time, bool, text, adding text, a blank text sting, clocktime, another blank text sting, back to numbers, and the last one is for my stupid trick.

you should look at var_list and read the script, you'll learn stuff.
param_invert to an int is like X*-1. but
param_invert to a float is like 1-X
blank a text implicit with, param_cast 'text' 0


remember & set test & from earlier? & set aTime & is my version here, I didn't directly pass a value to this var but it got a value other than 1.000

action_deck 1 ? set clock `get_clock` & set_var "2.5bt" "OgI" & set othervar 4.2 & set initImplicitTime 100 & get_var initImplicitTime & param_cast 'ms' & repeat_start_instant 'name' & repeat_stop 'name' & set aTime & nothing & param_multiply 0.5 & set anotherTimeMultiplied & param_cast 'integer' & set anInt & param_1_x & set recipFloat & nothing & param_multiply "get_var othervar" & set intMultiplied  & param_1_x  & set justApositiveFloat & param_cast 'boolean' & set FloatTobool & param_add -2.5 & set 'trueBoolminus2.5' & param_mod 1700 & nothing & set modWithNegNumbers & param_cast 'frac' & set_var aFrac & param_multiply 0 & param_add 1 & param_cast 'percentage' & set percent & param_multiply 0.75 & param_cast 'percentage' & set percentageMultiplied & param_cast 'integer' & set percentToInt & param_invert & set intInverted & param_invert & param_cast 'float' & set IntInvertedTurnToFloat & param_invert & set invertedfloat & param_cast 'text' & nothing & set_var text & param_add 'SSS' & set_var textAdded & param_cast 'boolean' & set bool & param_invert & set invertedbool & param_cast 'text' & nothing  & set_var boolToText & param_add "123" & set_var moreAddedText & param_cast 'text' 0 & set_var blanktext & param_add `get_var clock` & set clocktime & param_cast 'text' 0 & set_var antherblanktext & param_add "4" & set_var numberAsString & param_cast 'float' & set numberAgain & param_multiply 0.625 & set confirmedNumber & param_cast 'beats' & set readItAsBeats & param_cast 'text' & set setNewVarToValueOfAnotherByImplicitString



Is this the full story on the implicit? Nope

*edit minor update with `get_clock` example
 

Posted Sat 02 Sep 23 @ 6:02 pm
Baldy68PRO InfinityMember since 2019
Wow, at the same time as I am extremely grateful for your knowledge and time spent ....I don't know what to say or do, for the moment this is WAY over my head!

Now I just feel like giving up this project...but I don't want to, I love what I got working so far!

I will try to comprehend what you typed after the weekend I think, right now I get uncomfortable flashbacks from the math lessons at University many years ago, lol.
 

Posted Sat 02 Sep 23 @ 6:30 pm
locoDogPRO InfinityModeratorMember since 2013
Oh that wasn't directed at you,
This is just general.
I've had that super long script for ages I worked out a missing piece recently [how to blank a text implicit]

I've been on with my own project, and it had a super long script, but I then moved it to "multibutton" but some how what worked one place didn't in another, then I used it somewhere else but this had a different implicit issue and then on a pad.

so a really long script in 4 places all supposed to do the same thing of which 3 didn't work, so I had to battle the implicit in different ways in each place.

So I got it written down while the wound is fresh.
 

Posted Sat 02 Sep 23 @ 7:04 pm
locoDogPRO InfinityModeratorMember since 2013
@baldy try this instead
deck 1 effect_slider "Vocals" "echo" 1 & deck 2 effect_slider "Vocals" "echo" 1 & ( deck 1 effect_active "Vocals" "echo" ? : deck 1 effect_active "Vocals" "echo" on ) & deck 2 effect_active "Vocals" "echo" on ? : deck 2 effect_active "Vocals" "echo" on
 

Posted Sat 02 Sep 23 @ 11:55 pm
SAMPLER pads OUTPUT via SCRIPT

Has anyone tried to configure Sampler output via scripting?
Here's what I'm trying to achieve:



I'm trying to set the default to "trigger deck" and/or "deck 4" via PADS Editor Script




Note that when "deck 4" is selected (or any deck), the sampler output is sent to the trigger deck - whichever deck it was
 

Posted Mon 04 Sep 23 @ 9:01 pm
locoDogPRO InfinityModeratorMember since 2013
Both are in settings, search
"samplerO"

how to script a setting?
setting "SETTING_NAME" "VALUE"
 

Posted Mon 04 Sep 23 @ 9:25 pm
@LOCODOG, would you please add just a little more info

where do i search for `sampler0`? I searched in "Options & Tweaks" (the gear button up at the top), and nothing came up.

I know how to script a custom button, but where are the scriptable Sampler settings?
How do I launch the dialog window where the Sampler setting script can be entered?

If you could point me to a tutorial or something, I would appreciate that too.
Thank you
 

Posted Tue 05 Sep 23 @ 3:54 am
locoDogPRO InfinityModeratorMember since 2013
it's not a zero it's an "o"
 

Posted Tue 05 Sep 23 @ 10:23 am
oh got it, LOCO, thank you!

I was hoping I could improve the Sampler audio output configuration to make "trigger deck" do what it's supposed to do:

"If trigger deck is selected then it will route the Sample only to the deck where the sample was triggered from (either using deck specific shortcuts, or from a GUI or even a MIDI controller)"

right now, "trigger deck" just sends output to master just like "master" does.
 

Posted Tue 05 Sep 23 @ 5:57 pm
Baldy68PRO InfinityMember since 2019
locodog wrote :
@baldy try this instead
deck 1 effect_slider "Vocals" "echo" 1 & deck 2 effect_slider "Vocals" "echo" 1 & ( deck 1 effect_active "Vocals" "echo" ? : deck 1 effect_active "Vocals" "echo" on ) & deck 2 effect_active "Vocals" "echo" on ? : deck 2 effect_active "Vocals" "echo" on


Thank you locodog for not giving up on me!

This works the same as the other scripts though; if I go too wild with the knobs, one or another effect eventually gets stuck at max. It goes away when I reset all effects, but as soon as I touch any of the knobs with the effect that was stuck before, the effect goes to maximum and is stuck there again until I reset alla effects again, and this will not go away until I do a hardware reset on my midimix controller (pull the USB plug and reconnect)...

I never noticed this behavior before in either VDJ or midimix controller in other software. I start to think it has something to do with the fact I use several knobs controlling the same effect on different stems, which maybe means that VDJ need to allocate memory for separate effects for every stem sort of?

It is a bit confusing how the effects work for me, I use for example the "echo" effect on samples also, but it doesn't work anymore until I fiddle with the parameters. Are all instances in VDJ that use for example "echo" effect using the same instance of the effect so all stems and samples, master and anything refer to the same effect with the same parameters in the same allocated memory?

Sorry, this got way more complicated than I thought it would be...
 

Posted Wed 06 Sep 23 @ 5:07 pm
locoDogPRO InfinityModeratorMember since 2013
Baldy68 wrote :
I start to think it has something to do with the fact I use several knobs controlling the same effect on different stems, which maybe means that VDJ need to allocate memory for separate effects for every stem sort of?


It's not like that, think of effects on stems like it was another deck,
deck 1 has echo, deck 2 has echo they don't make any difference to each other.
[I say they don't make a difference, they do in the case of last touched fx sets the .ini for next session, but mostly they don't matter to each other]

Baldy68 wrote :

Are all instances in VDJ that use for example "echo" effect using the same instance of the effect so all stems and samples, master and anything refer to the same effect with the same parameters in the same allocated memory?


different memory but some cases they share an .ini file
I can't remember how many different fx slots create a separate .ini, there's a good few
master, decks, color, sampler, mic, release.

maybe instead of packing it into 2 decks, that could get confusing to work with, maybe record off stems as their own tracks and try think up a 10 deck skin.
Multiple decks is a mature idea, stems slots is still kind of new and maybe there's efficiencies to be found yet.
 

Posted Wed 06 Sep 23 @ 5:43 pm
Baldy68PRO InfinityMember since 2019
To learn to make my own skin I am afraid is too much work for me. And also, there already are stem splitters in every deck, so it feels like we tackle the problem backwards, making it more complicated than it needs to be. But I understand it is sadly too early to use the stems in this way in VDJ for the moment.

If there is nothing else to try (any coder input would be extremely appreciated) I guess my new revolutionary DJ-controller hardware is on hold. But at the same time, I wonder if the same issue would happen in an Arduino based DJ Midi controller...hmm, probably it would...
 

Posted Thu 07 Sep 23 @ 11:51 am
locoDogPRO InfinityModeratorMember since 2013
auto_bpm_transition


Introduced in BUILD 7651 auto_bpm_transition
***Edit New additions in Early Access BUILD 7682***

What is it? How does it work? How do you script it?

So what it does; It changes the pitch of the calling deck to match the bpm of the other deck over a number of beats duration.

You call it simply with auto_bpm_transition , at that point it's on and it's going to run for the duration.

So how to set the duration?
the duration is a remembered setting [in settings...] autoBpmTransitionLength you can set it there to any positive number, I tested bigger numbers like 512, it seems there's no upper limit.
Remembered is good but going into settings is annoying, but we're in luck, another script was added to go with this script

auto_bpm_transition_options
with this we can set things that happen during the transition as well as the length

auto_bpm_transition_options length 16
that sets the length, params accepted any positive number.

auto_bpm_transition_options master_tempo
this will decide if master_tempo is used during the transition,
params accepted on or off

auto_bpm_transition_options loop
this will decide if a loop is used during the transition, the loop length used is the default loop size [the number you see on the skin for regular loops]
params accepted on or off

And a collection of stems to use in the transition buttons
auto_bpm_transition_options stems vocal
auto_bpm_transition_options stems instru
auto_bpm_transition_options stems bass
auto_bpm_transition_options stems drums

params accepted on or off
on means use this stem, off means mute this stem

***Edit New in Early Access BUILD 7682
auto_bpm_transition_options autostart
params accepted on or off
this will start the other deck when you start the transition

auto_bpm_transition has extra optional parameter to select target bpm 'source_original', 'target_original' or 'target_current'
auto_bpm_transition 'target_current'
auto_bpm_transition 'target_original'
auto_bpm_transition 'source_original'
***


Ok so a real example, I want it all ready to go on one button, I want a 16 beat transition, with master_tempo off, with a loop of 4 beats long, with everything but the vocals muted, I want it to match the other deck's current bpm, I want the other deck to start with the transition and I want it to go instantly

Just list it all

auto_bpm_transition_options length 16 & auto_bpm_transition_options master_tempo off & auto_bpm_transition_options loop on & auto_bpm_transition_options stems vocal on & auto_bpm_transition_options stems instru off & auto_bpm_transition_options stems bass off & auto_bpm_transition_options stems drums off & loop_select 4 & auto_bpm_transition_options autostart on & auto_bpm_transition 'target_current'


A bit of a mouthful but sometimes that's how it is.

And because the development staff love you, they put it all in a pad_page so you only have to pay attention to me ... if ... you're ... into knowing this kind of fine detail.
A-BPM_TR Pad page


Next episode will be a round up of the little bits added to the script engine here and there [not related to this]
 

Posted Mon 18 Sep 23 @ 8:48 am
Baldy68PRO InfinityMember since 2019
Interesting, can this stuff be triggered from POI "Tempo Start" and POI "Tempo Exit", or any other cue points?
 

Posted Tue 19 Sep 23 @ 1:08 pm
locoDogPRO InfinityModeratorMember since 2013
Not those exact poi, because they don't hold actions. And you're going to lose the battle as automix will want to do its own thing with the pitch.
But outside of automix, action poi can call this script.
 

Posted Tue 19 Sep 23 @ 1:16 pm
Hi guys, is it possible to modify this script so that the filter runs on the negative Hz side?

locodog wrote :

Strap it all together, job done

repeat_start_instant 'filtOsc' ? repeat_stop 'filtOsc' : repeat_start_instant 'filtOsc' 30ms -1 & param_bigger `get_beat_bar 8` 0.5 ? get_beat_bar 8 & param_multiply 0.6 & param_add 0.5 & param_cast & filter : get_beat_bar 8 & param_multiply -1 & param_add 1 & param_multiply 0.6 & param_add 0.5 & param_cast & filter


 

Posted Tue 19 Sep 23 @ 2:02 pm
locoDogPRO InfinityModeratorMember since 2013
Negative Hz, there's a mind blowing concept, things that don't happen so many times a second.
I joke, I know what you mean, into the left side of the dial, the lowpass part of the filter.

Sure here you go.

repeat_start_instant 'filtOsc' ? repeat_stop 'filtOsc' : repeat_start_instant 'filtOsc' 30ms -1 & param_bigger `get_beat_bar 8` 0.5 ? get_beat_bar 8 & param_multiply -1 & param_multiply 0.6 & param_add 0.5 & param_cast & filter : get_beat_bar 8 & param_multiply 0.6 & param_add -0.1 & param_cast & filter


Wow that was a blast from the past, I might work with beat_bar more again, in some ways it can work out cleaner
 

Posted Tue 19 Sep 23 @ 2:26 pm
Thanks! I was thinking the code needed to be modified changing some of the parameters from +´s to -´s (which I tried)...hence -Hz hehe

BWT I´m new to DJing (7 months now) and decided to explore this world after an accident the left me quadriplegic (4 years ago), that means that scripts, which I discovered 3 days ago, are my new best friends as I cannot move my arms (or anything from the chest down).
 

Posted Tue 19 Sep 23 @ 8:55 pm
locoDogPRO InfinityModeratorMember since 2013
Sure I totally understand the accessibility angle, with script you can do a whole lot with a simple button press. I'll be here if you have questions.
 

Posted Tue 19 Sep 23 @ 10:36 pm
locodog wrote :
Sure I totally understand the accessibility angle, with script you can do a whole lot with a simple button press. I'll be here if you have questions.


Ok, let me abuse a little; I want to automate a PullUp.

That is: 1.PullUp Sampler + 2.Backspin effect + 3.Go to cue 1 and play.

I have tried this script in every combination and it never plays in this order: I want it so that when the sampler starts, lower gain (20%) in active deck, wait 1-2 secs, and then backspin, finish effect, and then play from cue 1.

acttive_deck & effect_active 'backspin' & goto_cue 1 & play sampler_volume_master 50% &
sampler_bank 1 & sampler_play_stop 1 &
sampler_volume_master 50%

 

Posted Wed 20 Sep 23 @ 9:33 pm
84%