Accesso rapido:  

Forum: General Discussion

Topic: The difference (subtraction) of beats to a variable

Questo argomento è obsoleto e potrebbe contenere informazioni obsolete o errate.

Here is what I'm working on (BPM difference)


set '$BeatActive' '`deck active get_bpm' &
set '$BeatDefault' '`deck default get_bpm' &
get_var '$BeatActive' &
param_add -'$BeatDefault' &
param_cast &
set "$BeatDifference" &
var_list


So I wanted to create a variable called $BeatDiffference which is the difference in beats between both decks. Turns out the variable listing isn't showing any subtraction (actually the script isn't even completing when I add the subtraction sign (-) and doesn't add together if I remove it.)
 

Inviato Thu 26 Jan 17 @ 11:20 pm
locoDogPRO InfinityModeratorMember since 2013
I haven't found a way to add [nor subtract] a variable to a variable,
you can add a real number to a variable, but you're talking plugin territory here
plugins allow much greater maths capabilities and make stuff much easier
do you know any coding languages?
 

Inviato Thu 26 Jan 17 @ 11:39 pm
locoDogPRO InfinityModeratorMember since 2013
Although your problem might be solvable with a repeat_start script....
 

Inviato Thu 26 Jan 17 @ 11:41 pm
Yeah quite a few but I don't do it everyday so I'd have to relearn the compiling steps. Is there a section on this website that can get me started. I was hoping not to have to do any compiling of fancy footwork to just do some things which I might think is extremely basic for a scripting language.
 

Inviato Thu 26 Jan 17 @ 11:44 pm
locoDogPRO InfinityModeratorMember since 2013
I'm thinking rough here, the script is yours to work out

get default bpm save it to a var, compare smaller active bpm against default bpm, if smaller, set the default bpm +1, cycle another var up , compare again, keep doing that until bigger then -1 from default bpm and from -1 your cycling var, have a doOnce var to stop going up in +1bpms and start going up in +0.001bpms and use adding to a var method to increase the previously cycling var by 0.001 [see my blog lesser used scripts adding to var] your formerly cycling var will be your difference, reset the default bpm with the var you saved at the start

I think that will work,
 

Inviato Fri 27 Jan 17 @ 12:04 am
locoDogPRO InfinityModeratorMember since 2013
http://it.virtualdj.com/wiki/PluginSDK8.html

if you saw how you send commands in c++ [how script is understood by the program,] you'd see that further abstraction would spaghetti out really quickly especially
unfortunately YGTFWTDYHBG, rarely if you've a good idea, and it isn't too narrow in scope and the devs are felling cheerful a new verb might be added to the language.[rare but does happen]
 

Inviato Fri 27 Jan 17 @ 12:28 am
FruitPRO InfinityMember since 2003
Why not using get_beatdiff ? Or I missed something ?
 

Inviato Fri 27 Jan 17 @ 12:33 am
locoDogPRO InfinityModeratorMember since 2013
Not what he wants, he wants
deck active 130bpm
deck default 120bpm
so -10bpm
 

Inviato Fri 27 Jan 17 @ 1:07 am
Yeah using the first part of your rough idea before I fine tune this script later with the smaller pitch changes. The whole number pitch changes might go something like this:


repeat_start 'pitchMatch' 10ms 100 &
set '$decka' '`deck active get_bpm' &
set '$deckd' '`deck default get_bpm' &
get_var '$decka' &
param_smaller '$deckd' ?
deck active pitch +1% &
deck default pitch -1% :
deck active pitch -1% &
deck default pitch +1%


but it's not stopping. It should stop one increment after the conditional realizes it went over. Shouldn't it?

I used 100 repeating steps just for test purposes for now, which gives it a large range to play with.
 

Inviato Fri 27 Jan 17 @ 1:16 am
locoDogPRO InfinityModeratorMember since 2013
use a pad page with 2 of the buttons named `get_var "$deckX"` to see what's going on
like I said this one is yours to work out, but one way to get better versed with script is to help others [non script savy] with their problems.
Also, check out the users script database.

and further, repeat_starts the quickest they will run is 33ms, [so your 10ms is actually running @33ms {useful to remember if you're using a rep_script as a time counter}]
 

Inviato Fri 27 Jan 17 @ 8:56 am
Got my basic building block here working. Before I start really taking this code apart more and playing around, you can check out this auto pitch slide and manual mix (cough cough) with 2 songs 100% off BPM with the following code (this really depends on what you have the pitch range set for). Going to have it autoslide on my next change.


set '$latch' 0 &
repeat_start 'pitchMatch' 33ms 100 &
var_equal '$latch' 1 ?
deck default play & sync :
set '$decka' '`deck active get_bpm' &
set '$deckd' '`deck default get_bpm' &
var_smaller '$decka' '$deckd' ?
deck active pitch +1% &
deck default pitch -1% &
set '$decka' '`deck active get_bpm' &
set '$deckd' '`deck default get_bpm' &
var_bigger '$decka' '$deckd' ?
set '$latch' 1 : nothing :
deck active pitch -1% &
deck default pitch +1% &
set '$decka' '`deck active get_bpm' &
set '$deckd' '`deck default get_bpm' &
var_smaller '$decka' '$deckd' ?
set '$latch' 1 : nothing


What can I use it for.. I don't know yet but it would be nicer if I can figure out how to match the beatgrids large ticks during sync. Warning: cover your ears if you're mixing out of 6% range

 

Inviato Sat 28 Jan 17 @ 4:50 am


(Vecchi argomenti e forum sono automaticamente chiusi)