Se Connecter:     


Forum: General Discussion

Sujet: comparing of two parameters in vdj

Ce topic est ancien et peut contenir des informations obselètes ou incorrectes.

Hello.
I'm searching info about comparing two values in vdj but still didn't find a normal explanation in how it working. The syntaxis (as I found) should be:
command1 & param_equal 'MyVar' ? command2 : command3 - will compare the value of command1 and if the result it's equal 'MyVar', execute command2, otherwise execute command3.
By the way, I'm confused because no matter what the command 1 is, somehow command3 is always performed.
get loop & param_equal 2 ? crossfader 0% : crossfader 100% always crossfades to 100% no matter I've set loop to 2 or 4.
 

Posté Sat 25 Jan 14 @ 4:21 pm
Anyone?
 

unfortunately when you use "get loop" you aren't getting a value that you can modify and compare. Using param_multiply|equal|smaller|larger is only for CC values. I have asked for a way to change "get" values which would be a string into an integer, percentage or float that we can map with. hopefully it get's included in VDJ8.

In regard's to loop though you can use "loop_select int|float"

loop ? loop_select 2 ? loop size is 2 and loop is active : loop size is not 2 but track is looping : not looping
 

Oh thanks, it works perfect! I wonder why this question wasn't explained anywhere in vdj documentation or forums because it's very important for programming.

By the way, it seems VDJ script, as a language, needs to have it's own interpreter strongly. It's difficult to identify exact variables and parameters if you don't know them. Types of these variables is often just predictable too (integers, percentage, floats, strings, commands (so when it has defined value and when not?), CC (I don't even know the meaning of that because VDJPedia doesn't say anything about this)). Hence something like 'identify_type' function would be more than great. I think VDJ script should have at least field of output. Don't you think so?
 

CC is a midi "control change" message. it is what is used to send information about absolute values of a knob, slider, touchstrip or pressure sensitive pad/button, jogs and encoders also use midi CC's but in a different way, but you can still us "param_multiply" within VDJ to change them.

Yes I agree that the documents leave a lot to be desired, hopefully they will be updated it the future. but If there is any questions I have I use google to search the forum or ask phantomdeejay as he knows more than anyone about scripting.

this is what you would type into google to search the forum

site:virtualdj.com something
 

I'm glad and thankful that now it everything gets much more easy to understand about this crazy kind of scripting. Yeah, so it's easy to check statements such as 'is loop size 2', 'is deck 1 active', 'is volume size 0%', 'is crossfader size 100%' and similar. But still, now I need COMPARING function, because other kind of commands as 'is crossfader size between 99% and 100%', 'is beat_bar between 0% and 10%' and so on is still riddle. How do you solve that? For first example, my task is to set crossfader position to a volume's percentage. Well, it's very easy to do that if volume is 0% or 100%, but what to do when volume is different?
Popular way out, like

volume 0% ? crossfader 0% : volume 1% ? crossfader 1% : volume 2% ? crossfader 2% : volume 3% ? crossfader 3% : volume 4% ? crossfader 4% : volume 5% ? crossfader 5% : volume 6% ? crossfader 6% : volume 7% ? crossfader 7% : volume 8% ? crossfader 8% : volume 9% ? crossfader 9% : volume 10% ? crossfader 10% : ............ : volume 96% ? crossfader 96% : volume 97% ? crossfader 97% : volume 98% ? crossfader 98% : volume 99% ? crossfader 99% : volume 100% ? crossfader 100% : nothing

won't give any use, because percentage of volume is saved as float like 70,19858...% so nothing is done. So, comparing (greater or smaller) is not escapable there.
 

You would need to be using a controller with VDJ Pro then you could easily map a macro to the physical crossfader, but because you can't get and cast the values that can be compared you can't do it on a button unless you do it the long way as you have shown.

A way to shorten it is to make a cycling variable and do different things at different values

key to go up
var 'myVar' 31 ? nothing : cycle 'myVar' 32 & var 'myVar' 1 ? doSomething : var 'myVar' 2 ? dosomethingElse : var 'myVar' 3 ? anotherThing : etc...

key to go down
var 'myVar' 0 ? nothing : cycle 'myVar' -32 & var 'myVar' 1 ? doSomething : var 'myVar' 2 ? dosomethingElse : var 'myVar' 3 ? anotherThing : etc...
 

Thank you for saying this method. It's really powerful! I'm not lazy to make long scripts because I use Python for that. After longer working with this vdj scripting I've notice another thing - there's no delay between command so it get's problematic to write more difficult mappings.
Let's take an example. Crossfader is set to 0%, both decks are playing and deck 2 is active (I work with two decks). I programmed something like scratch:

crossfader 100% & pitch +20% & jogwheel -0.03 & pitch -20% & crossfader 0%

I can't hear any effect because crossfader 100% and crossfader 0% are performed simultaneously :( So how to solve this problem normally?
As a second question, despite cycle helps a lot, it does not help to do other essential commands. What if I want to map a button that reverses whole tact between two neighbour beats automatically while pressed at the moment new beat begins? Using scheme, it's like
... -> | -> | -> | -> ...
and if I hold the button pressed during the first beat (marked as '|'), it plays the following way:
... -> | <- | -> | -> ...
Of course beat position cannot be set precisely so in the mapping, if beatgrid is between 95% and 100%, button works and does nothing otherwise. That's what I mean comparing is not escapable here.
Owkay, maybe vdj script really can't do these actions. Give me to know if so.
 

djloijord wrote :

I've notice another thing - there's no delay between command so it get's problematic to write more difficult mappings.
.


Commands are done in the order scripted, but since its ultra fast you wont hear it do the "scratch" you tried to do.

You can work with the logic a bit differently, by executing a command as soon as its true.. (works for buttons that repeat, such as keyboard)

crossfader 100% ? crossfader 0% & pitch -20% : crossfader 100% & pitch +20% & jogwheel -0.003


But wont sound like a scratch ..
 

Yeah, this script is working just a jogwheel needs to be larger, like +0.1, not +0.003. You need just to press a button twice and fast.
Well, as an idea it is really interesting and usefull for me but keeping the button while pressed is better this case, I think. And, just cuz I'm experimenting, pitch is not neccessary here, but I use it. I know, it's just a little part of scratch, but still... I'm improving it. That's how I did:
deck 1 clone_deck 2 & crossfader 100% while_pressed & deck 2 pitch +20% while_pressed & deck 2 jogwheel -0.1
 

for something like that you would need to write a plugin in C++, then you could use real physics to control the playback and make the jog scratch with a button. for the crossfader transforming you could just use a gater plugin, but you need a paid version of VDJ for that.
 

Ok, I'll know. And finally, what about VDJ8? Is there coming any essential changes in scripting?
 

don't know, I hope so, not that there is much wrong with it now since it's not meant to be too hard to do, If it were to become a higher level language it would defeat the purpose of having a scripting language.
 



(Les anciens sujets et forums sont automatiquement fermés)