How would I write a script to accomplish the following? If the difference in BPM between the two loaded songs is less than a certain amount (call it X), then play_sync, otherwise play.
The logic is this:
if (difference in BPM between deck 1 and deck 2) < X
then play_sync
else play
The expression in VDJscript might look something like this:
if difference between "deck 1 get loaded_song 'bpm'" and "deck 2 get loaded_song 'bpm'" < X ? play_sync : play
If anyone can figure out exactly how to do this, please let me know.
Thank you!
The logic is this:
if (difference in BPM between deck 1 and deck 2) < X
then play_sync
else play
The expression in VDJscript might look something like this:
if difference between "deck 1 get loaded_song 'bpm'" and "deck 2 get loaded_song 'bpm'" < X ? play_sync : play
If anyone can figure out exactly how to do this, please let me know.
Thank you!
Mensajes Mon 01 Sep 14 @ 11:51 pm
I don't really understand the scope, I get what you want to do, but not why you'd want to do it. (you can do it manually)
I had a couple of attempts and I can't see a way, if someone else knows I'd be interested.
I had a couple of attempts and I can't see a way, if someone else knows I'd be interested.
Mensajes Tue 02 Sep 14 @ 8:19 am
I don't know the exact syntax but there is a value called get_bpm_match that returns 0.5 if the bpm's are in sync. so the script would be something like:
get_bpm_match = 0.5 ? play : play_sync
if you just want to match bpm without realigning the beatgrid, you could use something like this:
get_bpm_match = 0.5 ? play : match_bpm & play
If you can work out what the values are for the tolerance that you need, you can probably do something like > 0.45 or < 0.55 to achieve the effect for nearby bpm's.
get_bpm_match = 0.5 ? play : play_sync
if you just want to match bpm without realigning the beatgrid, you could use something like this:
get_bpm_match = 0.5 ? play : match_bpm & play
If you can work out what the values are for the tolerance that you need, you can probably do something like > 0.45 or < 0.55 to achieve the effect for nearby bpm's.
Mensajes Wed 03 Sep 14 @ 2:55 am
Thank you, sjlwoods, for your thoughtful reply.
However, I am having an impossible time trying to implement this. First, there are no operators such as = or > or < in VDJscript. The only thing I can find is comparison of variables, such as var_smaller and var_larger. This requires first setting the value of get_bpm_match into a variable then doing the comparison, linking the two commands with "&". I cannot get this to work. Also... even if it did work, it would require something like an absolute-value function before comparing the figures. Ugh.
Again... if anyone can figure out an EXACT syntax for accomplishing this in VDJscript, please advise.
Thank you.
However, I am having an impossible time trying to implement this. First, there are no operators such as = or > or < in VDJscript. The only thing I can find is comparison of variables, such as var_smaller and var_larger. This requires first setting the value of get_bpm_match into a variable then doing the comparison, linking the two commands with "&". I cannot get this to work. Also... even if it did work, it would require something like an absolute-value function before comparing the figures. Ugh.
Again... if anyone can figure out an EXACT syntax for accomplishing this in VDJscript, please advise.
Thank you.
Mensajes Wed 03 Sep 14 @ 3:54 pm
I strongly think it isn't possible, VDJ script can do surprisingly little maths for a scripting language.
If you only wanted pitch 1 == pitch 2 ? sync & play : play,
that would be possible , but you want
pitch 1 => pitch 2 * 0.95 ? pitch 2 =< pitch 2 * 1.05 ? sync & play : play : play
And you just can't do that.
I wish you could, under the hood V8 HAS to be able to do this and I'd have a few applications for it but not possible yet.
If you only wanted pitch 1 == pitch 2 ? sync & play : play,
that would be possible , but you want
pitch 1 => pitch 2 * 0.95 ? pitch 2 =< pitch 2 * 1.05 ? sync & play : play : play
And you just can't do that.
I wish you could, under the hood V8 HAS to be able to do this and I'd have a few applications for it but not possible yet.
Mensajes Wed 03 Sep 14 @ 4:49 pm
Thank you for another thoughtful reply, locodog.
Just to put this into perspective... this programming idea is far from necessary. It would be a nice touch and a good safeguard to add to play_syn... but that's all, definitely not anything that is critical. Was just wondering if it could be done, since I wasn't having much luck. Thanks.
Just to put this into perspective... this programming idea is far from necessary. It would be a nice touch and a good safeguard to add to play_syn... but that's all, definitely not anything that is critical. Was just wondering if it could be done, since I wasn't having much luck. Thanks.
Mensajes Wed 03 Sep 14 @ 7:06 pm
at least that could be done with VDJScript (I think)
get_bpm_match = 0.5 ? play : match_bpm & play
should be either
get_bpm_match param_equal 0.5 ? play : match_bpm & play
or
param_equal get_bpm_match 0.5 ? play : match_bpm & play
get_bpm_match = 0.5 ? play : match_bpm & play
should be either
get_bpm_match param_equal 0.5 ? play : match_bpm & play
or
param_equal get_bpm_match 0.5 ? play : match_bpm & play
Mensajes Thu 04 Sep 14 @ 8:29 am
Aye like I said testing for exact match is no problem, (There are a few ways it can be done) but to test a unknown number within tolerances can't be done.
Mensajes Sun 07 Sep 14 @ 2:04 pm
How about:
get_bpm_match & param_greater 0.6 ? play : get_bpm_match & param_smaller 0.4 ? play : play_sync
Would that work?
Regards,
Duggy.
get_bpm_match & param_greater 0.6 ? play : get_bpm_match & param_smaller 0.4 ? play : play_sync
Would that work?
Regards,
Duggy.
Mensajes Fri 19 Sep 14 @ 5:24 pm