Connexion rapide:  

Forum: VirtualDJ Skins

Sujet VDJ Script to set pitch from user field

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

alucasCUE userMember since 2008
I would like to set the pitch of a loaded song from a value previously stored in a user field in the database. Firstly, I could't find a way of setting the pitch to a value that wasn't a constant. Then I thought maybe I could make a loop that incremented the pitch until it reached the desired value but couldn't see how to get the value from the user field into a script variable. I found the following in one of the examples:
"get_beatpos & param_cast & set 'nowBeat' "
to set a variable to the current beat position, so tried
"get_loaded_song 'field2' & param_cast & set 'myvar'"
but this didn't work. Any help appreciated.
 

Posté Fri 17 Jun 16 @ 12:33 am
alucasCUE userMember since 2008
I have made some progress on this. The problem with setting a variable from the user field was that variables have to be numbers. Hence

get_loaded_song 'field2' & param_cast 'integer' & set 'myvar'

puts the value from the user field 2 into 'myvar' provided it's a number of course. I still can't find a way of setting the pitch to anything other than a constant so I've used a loop:

pitch_zero & get_loaded_song 'field2' & param_cast 'integer' & set 'myvar' & repeat_start_instant 'pitchChange' 50ms 21 & var_greater 'myvar' 100 ? pitch +1% & cycle 'myvar' -200 : repeat_stop 'pitchChange

which sets the pitch to +3% if the user field contains 103.
However, when I try to account for negative pitch changes thus:

pitch_zero & get_loaded_song 'field2' & param_cast 'integer' & set 'myvar' & var_greater 'myvar' 100 ? repeat_start_instant 'pitchChange' 50ms 21 & var_greater 'myvar' 100 ? pitch +1% & cycle 'myvar' -200 : repeat_stop 'pitchChange : repeat_start_instant 'pitchChange' 50ms 21 & var_smaller 'myvar' 100 ? pitch -1% & cycle 'myvar' +200 : repeat_stop 'pitchChange"

works fine for user field values >100 but for < 100 does nothing. Something to do with nested conditionals I guess but I can't see why is doesn't work. Help please.
(VDJ V8.2 b3217 OS X 10.11.5)
 

Posté Sat 18 Jun 16 @ 2:55 am
alucasCUE userMember since 2008
I have found the problem. There was a single quote missing each time I used

repeat_stop 'pitchChange

The whole chain now is:

pitch_zero & get_loaded_song 'field2' & param_cast 'integer' & set '$myvar' & var_greater '$myvar' 0 ? var_greater '$myvar' 100 ? repeat_start_instant 'pitchChange' 50ms 21 & var_greater '$myvar' 100 ? pitch +1% & cycle '$myvar' -200 : repeat_stop 'pitchChange' : repeat_start_instant 'pitchChange' 50ms 21 & var_smaller '$myvar' 100 ? pitch -1% & cycle '$myvar' +200 : repeat_stop 'pitchChange' : nothing

I guess $myvar could be renamed to something more meaningful!! Similar command chains could be used to set other values that are not constants.

Incidentally, the new 8.2 feature:

- Improved action editor with colors and highlighting of if-then-else parts

is very useful in finding errors/typos like this.
 

Posté Thu 23 Jun 16 @ 12:05 am


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