Quick Sign In:  

Forum: General Discussion

Topic: Script School - Page: 46.25
Thank you locodog. I just did a quick mod to make it stay on screen a little longer, and we're away!
 

geposted Sun 21 Apr 24 @ 1:11 pm
locoDogPRO InfinityModeratorMember since 2013
Another user wish, the concept is interesting as instruction to how to scale a dial.

User wanted a fine detailed key change on a dial.
So key_smooth is the script, but key_smooth goes from -6.0 key to +6.0 key so we need to reduce the range a bit.

As is from centre [key natural] key_smooth goes -6.0 to +6.0 so 12 divisions. We only want a range of -1.0 key to +1.0 key so 1/6th of the full range. Then we want to ignore the first 5/12ths of the range.
A dial usually goes from 0.0 to 1.0, so
( dial val * 0.166666 [a 6th] ) + 0.416666 [5/12ths] = val =>0.416666 & <=0.583333

That as script you'd use on a dial
param_multiply 0.166666 & param_add 0.416666 & key_smooth

That would be ±100 cents across a whole dial

param_multiply 0.016666 & param_add 0.491666 & key_smooth

This would be ±10 cents across a whole dial
 

geposted Thu 02 May 24 @ 11:26 am
locoDogPRO InfinityModeratorMember since 2013
Another interesting user request that involves implicit manipulation.

User wanted a more increment kind of pitch slider, to some it might not make sense but I get it, instead of having infinity values between 2 contiguous integers you have just 10, so from 120 to 121 bpm you just have 121.0, 121.1, 121.2 ... etc

part of it is showing off, part of it is cheating, part of it is how digital sliders work when you look closely at X num of bit precision.
The dancefloor doesn't really care as long as you don't trainwreck.

A rare use case but an interesting script to learn from

So the dial implicit is 0.0 - 1.0
we need to turn implicit into ±1.0

so multiply by 2, now our implicit is 0.0 - 2.0
so add -1, now our implicit is -1.0 to +1.0

multiply implicit by pitch range, pitch range returns a value between 0.01 to 1.00 [1% pitch range to 100% pitch range]
so implicit == -pitch range to +pitch range

add 1 so our implicit is (1 - pitch range) to (1 + pitch range)

multiply implicit by bpm absolute
param_cast '0.0' to limit digits to one decimal place
param_cast as beats because we're passing a beat value to the pitch verb

pitch

param_multiply 2 & param_add -1 & param_multiply pitch_range & param_add 1 & param_multiply 'get_bpm absolute' & param_cast '0.0' & param_cast beats & pitch
 

geposted Thu 02 May 24 @ 12:30 pm
locoDogPRO InfinityModeratorMember since 2013
Script and the deck it acts on.
deck specified

Should have done this earlier as it's basic, but I'm doing it now and have a thing to add that is a little more advanced.

So think about this script play_pause,
now think about where you could write this script and the results you get from writing in different places.
You could write; to a custom_button, to a pad, actually into a skin, to an action poi, to a controller mapping, to a keyboard mapping.

The thing is, it knows what deck to act on, how does it know?
The first 3 are all part of a skin and in the skin you can specify the deck to act upon.
apoi are called from a track on a deck so it inherits the assigned deck there.

Controller mapping is usually deck specified in the definition file; a device may have a left play_pause & a right play_pause, those buttons do send different midi messages those different messages are assigned to different decks. You might just map 1 entry to play_pause but in the definition it's actually several buttons assigned to different decks.

Not all controllers are like this though, like a launchpad or similar auxiliary device, they don't have a deck specified in the definition. A play_pause there will act on the selected deck, also known as deck default.
A keyboard mapping, similar to an auxiliary device, has no deck assigned to so defaults to... the default deck, also known as the selected deck.

So most of the time we don't need to worry about specifying the deck,
but what if we want to get fancy?
What if we're doing stuff across several decks?
How do we check our calling deck number?
How do we specify a deck with script?
A few different scripts here.

Query against
device_side %PARAM ? 

params that can be used are left right [ or integer number for 4 deck devices]
This is just for devices,

action_deck %NUM ?

This works for all cases

deck %PARAM masterdeck ?

this query is, is this deck the active/masterdeck

Info query to get a number
get_deck - returns integer
get_defaultdeck - returns integer
get_leftdeck - returns integer
get_rightdeck - returns integer
get_decks - returns integer number of decks
get_activedeck - returns integer of masterdeck

Normal way of specifying a deck to a known value
deck %PARAM SOME_VERB
params that can be used are deck number, left, right, master, active, default

How to make a deck the default deck [presuming there's a deck specified to where this script is written.]
select
If you want to specify the deck
deck %PARAM select
params could be NUM, left, right, master, active


Specifying a deck with dynamic script.
set_deck `ACTION`

This is the newer interesting specifier, this accepts action script as a parameter meaning you can get smart with it.

Let's do an example case, we'll make our own automix/timeline with action poi.
so you'd have a couple of action poi like this

if we're on deck 1 load deck 2, if we're on deck 2 load deck 1
action_deck 1 ? deck 2 load "C://FILEPATH.mp3" : action_deck 2 ? deck 1 load "C://FILEPATH.mp3" :

similar story press play on the other deck
action_deck 1 ? deck 2 play_sync : action_deck 2 ? deck 1 play_sync :

So far so boring, how do we use set_deck with this?
We could do something like this, but it's not really much smarter
set_deck `action_deck 1 ? get_constant 2 : action_deck 2 ? get_constant 1 : ` & load C://FILEPATH.mp3"

What would be smart would be the remainder of our deck number divided by our number of decks, then add 1
We're on deck 1, we have 2 decks,
1%2 = 1
then add 1 to get 2.
other case
2%2 = 0
add 1 to get 1

As it happens we have a script that does this kind of remainder division, param_mod, [modulo operation if you haven't heard of it]

set_deck `param_mod get_decks get_deck & param_add 1` & load "C://FILEPATH.mp3"


If you have lots of "act on the other deck" type of scripts, I'd use a variable, set variables like this
set $callingDeck `get_deck` & set $otherDeck `param_mod get_decks get_deck & param_add 1`
then use the variables something like this
set_deck `get_var $otherDeck` & level +10%


After setting the variables you could do something like this that will act on both decks with different actions, [be careful using DECK ALL, see deck all lesson as to why]

deck all param_equal `get_var $callingDeck` `get_deck` ? DO THING TO CALLING DECK : DO THING TO OTHER DECK


Pretty basic, set_deck has its uses.
 

geposted Sun 05 May 24 @ 4:52 pm
locoDogPRO InfinityModeratorMember since 2013
Parse Values Anywhere in Script

A cross over episode with virtualfx. Since virtualfx is available on all platforms I consider it unofficially official.
If it didn't exist I'd be pestering the devs that script should do this.

Now anybody who has got into scripting has got to the point of "I want to parse script values into other scripts because... awesome idea"
and a lot of times you can cast a value to a param with a bit of work, but it's not the easiest.

So let's make it easy with an example that would be very difficult otherwise.
First grab yourself a copy of virtualfx
next outside of vdj rename the .dll or .bundle to "parser"

So let's do something with padfx to control echo out [I keep meaning to cover padfx but it's a 'busy' verb with a lot to it]
now let's set some variables to recall later. Just examples

set $fxParam1 `effect_slider echo 1` & set $fxParam2 0.75 & set $fxParam3 `filter` & set_var $fxStemState 'stemfx:Vocal'


so a mixed bag here, we saved from effect_sliders, we saved a fixed value, we saved from the filter position, and we saved a fixed string variable.

So now the magic, we build a string with literal text and parsed values, send it to parser fx as an effect_string and then have that string called as a script [that's what virtualfx does, effect_strings called as script]
make this a button
get_text "padfx 'echo out' `get_var $fxParam1` `get_var $fxParam2` `get_var $fxParam3` `effect_slider 'echo out' 4` `get_var $fxStemState`" & param_cast & effect_string parser 7 & effect_button parser 1 -1


first 3 params we get from saved variables, 4th param we grab from the fx itself at run time, and the stem state we get from a saved string variable.

Either you're intrigued and you want to test, or you don't get it.
Short and sweet, but crazy powerful.
 

geposted Tue 07 May 24 @ 1:20 pm
Awesome stuff Locodog..

Always wanted to wrap my head around your plugin, virtualfx, and always stuck at knowing what virtualfx expects.. or what is under its hood.

For example.. what is reason for the items (parameters) you passed to virtualfx (parcer) and how did you know which, and order to pass them?
(seems some additional info is required)

And then, there is question .. the virtualfx, button,
what is it doing and what does the button's parameters mean 1 -1... ?

Without an understanding of the above it is a black box that may be difficult to interact with, though powerful as it is..

Yes, intrigued, and would love to learn more.



PS
In the spirit of learning here at school:
when initially setting variables, you used set, set, set, & set_var
is there a reason for not using set for the 4th variable also?

 

geposted Tue 07 May 24 @ 7:10 pm
locoDogPRO InfinityModeratorMember since 2013
The order of params is how padfx works, you pass params in the order they're found on the plugin you're calling.

It really is just a list in order
I want to call "some fx" on, and I want to pass these values I list to that fx.

Try play with the padfx script, it should become clear

[example demo, should be instructive]
effect_show_gui echo on & wait 1000ms & effect_slider echo 1 100% & effect_slider echo 2 100% & effect_slider echo 3 100% & effect_slider echo 4 100% & effect_button echo 1 on & effect_button echo 2 on & wait 1000ms & padfx echo 0.1 0.3 0.9 0.7 "mute source:off" "trailing stop:off" & wait 1000ms & effect_active echo


the button names at the end can be either case what is returned from
get_effect_button_name "FXNAME" BUTTON_NUM
or
get_effect_button_shortname "FXNAME" BUTTON_NUM

As to
effect_button parser 1 -1, the -1 is button state, -1 being toggle [1|0|-1] same as [on|off|toggle]
It's needed here as my string of text becomes the implicit so what is called without the -1 would be
effect_button parser 1 "my load of text"
it's expecting on|off|toggle or 1|0|-1, so it wouldn't know what to do with my load of text. Using -1 tells the script engine what we want to do and it bumps the implicit text to param 4 [and there is no param 4 for a button script so our text is safely ignored]

And last bit. I use set_var as we are saving a string variable, if we did this
set $fxStemState 'stemfx:Vocal'
we wouldn't be saving the literal text, we would be saving whatever the variable named 'stemfx:Vocal' was holding [we've not set a variable named that so it would be holding Zero]
Read up on set verb for that one.

I could have done this instead to avoid the error
set $fxStemState `get_text 'stemfx:Vocal'`

There's a little more to padfx, slider params have to be in order they're found on the plugin, you don't have to include all params, once you miss a param that's the end of slider param setting, buttons you can call by name so order isn't as important but they can still screw up slider setting so best follow the order as found on the plugin.

Yeah, padfx is a busy verb.
 

geposted Tue 07 May 24 @ 8:11 pm
locoDogPRO InfinityModeratorMember since 2013
more indexing sorry for the false alarm.
 

geposted Sun 09 Jun 24 @ 5:19 am
I'm looking for help with a script I've used for many years that stopped working after version 2023-i b7607

For Left Deck:
Deck 1 loop_adjust 'move'

For Right deck:
Deck 2 loop_adjust 'move'

This script simply stops the platter in the Rane 12 and lets me use the platter to move (scrub) the set loop. I've used this script for many years with many different controllers, but for the last 5 years with the Rane 12s. Its very important to my workflow and video sets.

I appreciate any help to resolve this.


 

geposted Sat 22 Jun 24 @ 2:26 pm
locoDogPRO InfinityModeratorMember since 2013
if it did work and now it doesn't report it on the technical forum.
 

geposted Thu 27 Jun 24 @ 12:53 pm
locoDog wrote :
if it did work and now it doesn't report it on the technical forum.


I was told by support to post it in here and a tech would respond. I did post it in the Technical Support Thread. One person suggested removing the deck x command but this breaks the working version and has zero effect on the current version. Its broken and I can say for sure its a BUG.
 

geposted Sun 07 Jul 24 @ 6:07 pm
locoDogPRO InfinityModeratorMember since 2013
Scroller [doing things in batch]



A scroller is a name I've given to scripts that do stuff in batches,
If you search the forum for "scroller" you'll find lots of examples, all doing different things but in the same kind of way.
I call them scrollers because it actually scrolls thru the browser.

The basis would be a repeat_start script [a.k.a. rsi, repeat_start_instant]
Some cases you might want to scroll over the entire database, some cases it might be a specific list/folder/filter so use your brain which bits you need for your thing.
I'll be making an example to do an entire database

search "*" & wait 2000ms & browser_window songs & browser_scroll top & 


By using *, I'm search for everything, give it a second or two to get the results, put the browser focus onto the song list, and go to the top of the list, this is easy stuff.

& repeat_start_instant scroller 25ms -1 & 


a repeat script called "scroller" that repeats every 25ms & has no numbered limit [-1 means it will run until it is told to stop]

next you do what you need to do, some times you might need to load the track, like if you need to do cue stuff
load & do stuff with cues & 

or sometimes you don't need to load like maybe write a tag
& browsed_song comment "EXAMPLE" & 

or read a tag and do something about it
& ( get_browsed_bpm & param_bigger 155 ? color 'red' : color 'green' ) &


ok that's one case of doing the thing you need, how do we get it scrolling?

& browser_scroll 'bottom' ? repeat_stop scroller : browser_scroll +1 


not a lot to it at all, we end our script with a query have we hit the bottom because if we have we can stop the repeating script, and if we haven't we can browser_scroll down and let the repeat script run again.

whole custom_button script, harmless example counts if a track is > 100 bpm or not, also has button logic so a press while it is running will make the repeating stop

repeat_start_instant scroller ? blink 250ms & repeat_stop scroller & var_list : off & set $counterOver100 0 & set $counterNotOver100 0 & search "*" & wait 2000ms & browser_window songs & browser_scroll top & repeat_start_instant scroller 25ms -1 & ( get_browsed_bpm & param_bigger 100 ? set $counterOver100 +1 : set $counterNotOver100 +1 ) & browser_scroll 'bottom' ? repeat_stop scroller & var_list : browser_scroll +1 


rsi speeds, it will take a little while to do a database, it processes about 1800 tracks a minute, it can be made considerably quicker depending on how simple the thing you are doing is.
 

geposted Thu 12 Sep 24 @ 12:03 pm
djkrysrPRO InfinityMember since 2010
I use samples a lot so I have created a floating window I can fix on a second touchscreen monitor with 64 sample buttons on it for quick access.
For each sample button I have added an icon to indicate if the sample loops but I would also like to be able to add an icon to indicate if the sample is video or not.

I have tried is_video, but this understandably doesn't seem work with samples so I thought maybe I could make sure all video samples were in groups that had the text 'Video' in it and query that, however it appears the verb 'sampler_group_name' returns a list of the groups, not the group a selected sample is in, i.e. 'sampler_group_name 2' will return the name of the second group on that particular sample bank, not the group name of the second sample in the bank, so that's a bust.

At the moment, due to the way my controller is configured I always have a video sample loaded on sample slot 5 so I am using
"param_equal `sampler_color [BUTTON]` `sampler_color 5` ? true : false"
to see if the colors match regardless of what color the video group is on a particular bank, but that is a bit of a fudge.

Is there a way to query if a sample is video, or a way to get a specific samples group name, or failing that, a better fudge I haven't thought of that could give me the result I want.

Any help or pointers would be greatly appreciated.
 

geposted Sun 15 Sep 24 @ 1:48 pm
locoDogPRO InfinityModeratorMember since 2013
I can't think of anything yet other than making the first char of the sample name something you could query, like using a "+" or something.
 

geposted Sun 15 Sep 24 @ 9:20 pm
djkrysrPRO InfinityMember since 2010
I did consider a special character in the sample name but since the name is displayed on the button anyway it seemed a bit redundant, altho I might revisit that thought.

Thanks for your consideration anyway, if you can't think of a better way to do it at least I know it can't be done and to stop trying.

 

geposted Mon 16 Sep 24 @ 12:22 pm
Dear colleagues,
I ask for your help in writing a script to control the flashing of the button. I have studied the Freestyler program and am now assigning controls to buttons in Launchpad. I ran into a problem: I can't make the button blink dimly when the function is not active, and brightly when the function is on. I would appreciate any help or advice on this issue.

the function on the button is written as follows:
var_equal '$FS_RCV_$FS_SND_OVER_01' 0 ? off & set '$FS_SND_OVER_01' 1 while_pressed : on & set '$FS_SND_OVER_01' 1 while_pressed

I wrote it like this: var_equal '$FS_RCV_$FS_SND_OVER_01' 0 ? blink 500ms ? color 'white' : off : color 'dark white

In this case, the button always blinks dimly, when I press and release the button, the function turns on, the button blinks dimly, I press it again - the function turns off, the button blinks dimly, but if you press and hold the button, it blinks brightly.

 

geposted Mon 16 Sep 24 @ 5:34 pm
ChaksiPRO InfinityMember since 2011
What is wrong with this Script? It does what i want it to do, i.e toggle the loopchop effect on and off and give me LED Feedback but the only problem is that the LED is on by default and the effect is activated when the LED is off and the opposite when its on. Almost like i have to push the button to arm it before pressing again to get the desired feature. Any Help will be much appreciated,Thanks

var 'voiceThing' 0 ?
on & toggle 'voiceThing' & set 'VoxFXcount' `var 'VoxFXcount' ? get_var "VoxFXcount" & param_add 1 : get_text '1' & param_cast val` & set 'voxLoopCycle' 0 & effect_stems 'vocal' on & repeat_stop 'voxRoller2' & quantize_loop on & padfx 'loop roll' 0.9 0.75 & wait 1bt 1 & repeat_start 'voxRoller' 1bt & effect_slider 'loop roll' 2 -20% & cycle 'voxLoopCounter' 2 & var 'voxLoopCounter' 0 ? repeat_stop 'voxRoller' & repeat_start 'voxRoller2' 1bt & effect_slider 'loop roll' 1 -15% & cycle 'voxLoopCycle' 6 & var 'voxLoopCycle' 0 ? repeat_stop 'voxRoller2' : nothing : nothing : off & toggle 'voiceThing' & repeat_stop 'voxRoller2' & effect_active 'loop roll' off & get_var "VoxFXcount" & param_equal 1 ? effect_stems 'vocal' off & set 'VoxFXcount' `get_var "VoxFXcount" & param_add -1` : set 'VoxFXcount' `get_var "VoxFXcount" & param_add -1`
var 'effectActive' 0 ?
on & set 'VoxFXcount' `var 'VoxFXcount' ? get_var "VoxFXcount" & param_add 1 : get_text '1' & param_cast val` & set 'voxLoopCycle' 0 & effect_stems 'vocal' on & repeat_stop 'voxRoller2' & quantize_loop on & padfx 'loop roll' 0.9 0.75 & wait 1bt 1 & repeat_start 'voxRoller' 1bt & effect_slider 'loop roll' 2 -20% & cycle 'voxLoopCounter' 2 & var 'voxLoopCounter' 0 ? repeat_stop 'voxRoller' & repeat_start 'voxRoller2' 1bt & effect_slider 'loop roll' 1 -15% & cycle 'voxLoopCycle' 6 & var 'voxLoopCycle' 0 ? repeat_stop 'voxRoller2' : nothing : nothing : off & repeat_stop 'voxRoller2' & effect_active 'loop roll' off & get_var "VoxFXcount" & param_equal 1 ? effect_stems 'vocal' off & set 'VoxFXcount' `get_var "VoxFXcount" & param_add -1` : set 'VoxFXcount' `get_var "VoxFXcount" & param_add -1`
 

geposted Wed 18 Sep 24 @ 4:09 pm
locoDogPRO InfinityModeratorMember since 2013
invert where you call led on/off
 

geposted Wed 18 Sep 24 @ 4:27 pm
ChaksiPRO InfinityMember since 2011
sorry but I am very green with VDJ scripts. I can’t find the “led toggles” in the script I uploaded . Thanks for your help as always 🙏🏾

 

geposted Thu 19 Sep 24 @ 2:44 am
locoDogPRO InfinityModeratorMember since 2013
var 'voiceThing' 0 ?
off & toggle 'voiceThing' & set 'VoxFXcount' `var 'VoxFXcount' ? get_var "VoxFXcount" & param_add 1 : get_text '1' & param_cast val` & set 'voxLoopCycle' 0 & effect_stems 'vocal' on & repeat_stop 'voxRoller2' & quantize_loop on & padfx 'loop roll' 0.9 0.75 & wait 1bt 1 & repeat_start 'voxRoller' 1bt & effect_slider 'loop roll' 2 -20% & cycle 'voxLoopCounter' 2 & var 'voxLoopCounter' 0 ? repeat_stop 'voxRoller' & repeat_start 'voxRoller2' 1bt & effect_slider 'loop roll' 1 -15% & cycle 'voxLoopCycle' 6 & var 'voxLoopCycle' 0 ? repeat_stop 'voxRoller2' : nothing : nothing : on & toggle 'voiceThing' & repeat_stop 'voxRoller2' & effect_active 'loop roll' off & get_var "VoxFXcount" & param_equal 1 ? effect_stems 'vocal' off & set 'VoxFXcount' `get_var "VoxFXcount" & param_add -1` : set 'VoxFXcount' `get_var "VoxFXcount" & param_add -1`
var 'effectActive' 0 ?
off & set 'VoxFXcount' `var 'VoxFXcount' ? get_var "VoxFXcount" & param_add 1 : get_text '1' & param_cast val` & set 'voxLoopCycle' 0 & effect_stems 'vocal' on & repeat_stop 'voxRoller2' & quantize_loop on & padfx 'loop roll' 0.9 0.75 & wait 1bt 1 & repeat_start 'voxRoller' 1bt & effect_slider 'loop roll' 2 -20% & cycle 'voxLoopCounter' 2 & var 'voxLoopCounter' 0 ? repeat_stop 'voxRoller' & repeat_start 'voxRoller2' 1bt & effect_slider 'loop roll' 1 -15% & cycle 'voxLoopCycle' 6 & var 'voxLoopCycle' 0 ? repeat_stop 'voxRoller2' : nothing : nothing : on & repeat_stop 'voxRoller2' & effect_active 'loop roll' off & get_var "VoxFXcount" & param_equal 1 ? effect_stems 'vocal' off & set 'VoxFXcount' `get_var "VoxFXcount" & param_add -1` : set 'VoxFXcount' `get_var "VoxFXcount" & param_add -1`


I'm not going to bother trying to figure out what it is supposed to be doing,
If you see "on" or "off" on their own in a script then that's for LED logic
 

geposted Thu 19 Sep 24 @ 3:24 am
99%