Quick Sign In:  

Forum: General Discussion

Topic: Script help
I’m trying to setup a button that when once it’s pressed it loads a track, sets the downbeat, sets the first hot cue and goes to the next track in the folder until it reaches the bottom.

I’ve tried using the repeat but I have to hold the button down.

Help would be most appreciated.
 

Posted Thu 29 Apr 21 @ 4:13 am
NicotuxHome userMember since 2014
sounds like your repeat loop was wrong :/
1) this is repead_start or repeat_start_instant
2) load is not immediate (specially with stems), some load time is not known. load_pulse or load_pulse_active may be needed
3) browser_move is not immediate, needs some undetermined time to achieve
4) wait loop using get_status may be a good idea to test whenever browser ends its command
5) maybe show what you tried may be usefull to get more specific help
 

Posted Thu 29 Apr 21 @ 4:44 am
Actually, you need two repeats:
One repeat to scroll the browser and one repeat to do the rest actions.
The reason was provided by Locodog. "Load" is not instant and you need to let some time pass by before you perform any other action

So
repeat_start_instant 'RunThruBrowser' ? repeat_stop 'RunThruBrowser' : repeat_start_instant 'RunThruBrowser' 3000ms & browser_scroll bottom ? repeat_stop 'RunThruBrowser' : browser_scroll +1 & load

This is the code that will advance the current folder every 3 seconds and will load the track
Now we will add the rest actions (that you'll need to edit) with a second repeat just to "delay" the execution after loading the track. We will delay the execution for 2 seconds, which should be plenty of time for most cases:
repeat_start_instant 'RunThruBrowser' ? repeat_stop 'RunThruBrowser' : repeat_start_instant 'RunThruBrowser' 3000ms & browser_scroll bottom ? repeat_stop 'RunThruBrowser' : browser_scroll +1 & load & repeat_start 'DoActions' 2000ms 1 & set_firstbeat & set_cue 1

What's vital on the above additions to the script besides the wait time, is the number of repeats (1)
So, since we use a repeat_start and not a repeat_start_instant action and we execute it only once, we effectively are delaying the execution of it's actions.

You can tweak the times of the script, but remember, the wait time (2000ms) must always be smaller than the scroll time (3000ms)
 

Posted Thu 29 Apr 21 @ 7:18 am
AdionPRO InfinityCTOMember since 2006
Are you sure you meant 'set downbeat' ?
It would automatically screw up all the beat grids based on the current autocue setting?
 

Posted Thu 29 Apr 21 @ 7:54 am
True, perhaps he means go to down beat instead ?
Which then would be:
goto_first_beat (or goto 0, both do the same)

repeat_start_instant 'RunThruBrowser' ? repeat_stop 'RunThruBrowser' : repeat_start_instant 'RunThruBrowser' 3000ms & browser_scroll bottom ? repeat_stop 'RunThruBrowser' : browser_scroll +1 & load & repeat_start 'DoActions' 2000ms 1 & goto_first_beat & set_cue 1
 

Posted Thu 29 Apr 21 @ 8:54 am
NicotuxHome userMember since 2014
PhantomDeejay wrote :
You can tweak the times of the script, but remember, the wait time (2000ms) must always be smaller than the scroll time (3000ms) you'll never be sure that will work and will mostly loose time


if you really want be sure it will run and not loose time, slow computer, overload, analyzing, read errors, slow network, big files, skip missing... with emergency stop and faster
not guessing it may work and praying to be almost sure it will ever work... but using VDJ status to be sure instead

here is a functionnal proof of concept code in debugging mode -not dangerous, doing nothing else but displaying "do_action" in debug window:
repeat_start_instant Mainloop ? repeat_stop Mainloop & repeat_stop waitforload & repeat_stop waitunloaded  & debug forceclosed : debug start & repeat_start Mainloop 270ms -1 & repeat_start waitunloaded ? debug wait1 : repeat_start waitforbrowser ? wait2 : repeat_start waitforload ? wait3 : unload & debug unloading & load & repeat_start waitforload 170ms -1 & get_text `get_status` &  param_contains "Opening" ? debug opening : param_contains "Loading" ? debug loading : debug loaded & repeat_stop  waitforload & debug do_action & unload & repeat_start waitunloaded 30ms -1 & loaded ? debug unloading : repeat_stop waitunloaded & debug unloaded & browser_scroll +1 & repeat_start_instant waitforbrowser 50ms -1 & get_text `get_status` & param_contains "Browsing" ? debug scrolling : repeat_stop waitforbrowser & debug scrolled & browser_scroll 'Bottom' ? repeat_stop Mainloop & debug Done :

Mainloop have to better be at least bigger sum of other wait in a way to limit not necessary loops
 

Posted Thu 29 Apr 21 @ 10:41 am
NicotuxHome userMember since 2014
as usual there is an issue in first attempt ;)
The test for bottom reached and scrolling have to be switched in a way to apply do_action to last entry ^^
repeat_start_instant Mainloop ? repeat_stop Mainloop & repeat_stop waitforload & repeat_stop waitunloaded  & debug forceclosed : debug start & repeat_start Mainloop 270ms -1 & repeat_start waitunloaded ? debug wait1 : repeat_start waitforbrowser ? debug wait2 : repeat_start waitforload ? debug wait3 : unload & debug unloading & load & repeat_start waitforload 170ms -1 & get_text `get_status` &  param_contains "Opening" ? debug opening : param_contains "Loading" ? debug loading : debug loaded & repeat_stop  waitforload & debug do_action & unload & repeat_start waitunloaded 30ms -1 & loaded ? debug unloading : repeat_stop waitunloaded & debug unloaded & not browser_scroll 'Bottom' ? browser_scroll +1 & repeat_start_instant waitforbrowser 50ms -1 & get_text `get_status` & param_contains "Browsing" ? debug scrolling : repeat_stop waitforbrowser & debug scrolled : repeat_stop Mainloop & debug Done
 

Posted Thu 29 Apr 21 @ 11:35 am
Adion wrote :
Are you sure you meant 'set downbeat' ?
It would automatically screw up all the beat grids based on the current autocue setting?


I want the first beat set, 1:1 for the grid. Then I want hot cue 1 set there and then after that’s done I want VDJ to load the next track in the library and do it all over again.

So maybe it’s “Tap” that I want to use??

I basically load all my new tracks in a folder and then I go thru them and at least add the first hot cue.

I don’t want to manually sit there and load every track and set the grid and set the hot cue.

I want it to be automated for the lack of a better term 🤷🏾‍♂️
 

Posted Thu 29 Apr 21 @ 9:24 pm
locodogPRO InfinityModeratorMember since 2013
I get what you're after, but do all your tracks start hot? as in the very start of the file is the first beat, some tracks have a brief silence.
it does depend on your load options, I'm not sure if load to first beat option will actually load to the zero beat of the cbg, in some cases I know the zero cbg beat can be several bars after the track start [maybe this is why you want to zero the cbg at the first bit of audio]

I think your idea could save some time for you, but anomalies will creep thru and the only error check is human, so the time save could be not as much as you think.
that said, a batch, then a second batch for you to check for a few seconds each track and mark if wrong, would indeed be a time saver.
 

Posted Thu 29 Apr 21 @ 10:12 pm
Ok so I have VDJ set to "skip silence" and most of what I download comes from pools so they have the 16 bar intro/outro.

Right now I have a button set up like this

"beat_tap & set_cue 1 & beatjump +16 & set_cue 2 & beatjump +16 & set_cue 3 & beatjump +32 & set_cue 4 & goto_cue 1"

I want to be able to press a button that will do that for all my tracks in the folder I pick without me having to load each track 1 by 1.

Ive seen Phantom do a script that does what I want except to was cutting the BPM in half. You would press a button and it would move down the browser track by track and cut the BPM in half. It was a time saver but I can't find the thread he posted that script in hence why Im asking here lol!

Hope that makes sense??
 

Posted Thu 29 Apr 21 @ 11:20 pm
NicotuxHome userMember since 2014
Did you try to put your line unchanged in a "light" version of my code (in place of "debug do_action") ? it would apply it to all next tracks.

More interesting and flexible way:
existing custom button can be used (make sure it is not the one the code stay in) making it possible to automate any script selected in a custom_button with only one instance of automation script
i.e.:
custom button 1 contains some scripts :
"beat_tap & set_cue 1 & beatjump +16 & set_cue 2 & beatjump +16 & set_cue 3 & beatjump +32 & set_cue 4 & goto_cue 1"

automation script for custom_button 1 in custom_button 2:
repeat_start_instant Mainloop ? repeat_stop Mainloop & repeat_stop waitforload : unload & repeat_start Mainloop 270ms -1 & repeat_start waitforload ? : repeat_start waitforbrowser ? : load & repeat_start waitforload 170ms -1 & get_text `get_status` & param_contains "Opening" ? : param_contains "Loading" ? : repeat_stop waitforload & CUSTOM_BUTTON 1 & unload & not browser_scroll 'Bottom' ? browser_scroll +1 & repeat_start_instant waitforbrowser 50ms -1 & get_text `get_status` & param_contains "Browsing" ? : & param_contains "Renaming" ? : repeat_stop waitforbrowser : repeat_stop Mainloop
Light synced automation code without debug
Code is somehow uncommon, but it is not missing tracks, not wasting much unneeded time
 

Posted Fri 30 Apr 21 @ 5:42 am
Thanks Nicotux, your script worked.

Most appreciated.

Edit, it advances the track but doesn't add the first hot cue.

Phantoms script does what I want exactly...
 

Posted Sat 01 May 21 @ 3:12 am
NicotuxHome userMember since 2014
the script only executes what is i the related custom button
strange, the script call the action but does not seem to execute it (same as a set var in a query)

After deeper investigation: there is a race condition with long scripts and the track is reloaded before the of script ends (my fault ^^)

I tried some different thing because it look like tracks do not need to really be loaded in a way to the cues to be set - specifically there is no need to any other sync but browser (and global script is not a loop) in this case

specific to your script (speed is .... impressive)
repeat_start_instant Mainloop ? repeat_stop Mainloop & set running 0 : set running 0 & unload & repeat_start Mainloop 170ms -1 & var running 1 ? : set running 1 & load & beat_tap & set_cue 1 & beatjump +16 & set_cue 2 & beatjump +16 & set_cue 3 & beatjump +32 & set_cue 4 & unload & not browser_scroll 'Bottom' ? browser_scroll +1 & repeat_start_instant waitforbrowser 50ms -1 & get_text `get_status` & param_contains "Browsing" ? : & param_contains "Renaming" ? : repeat_stop waitforbrowser & set running 0 : repeat_stop Mainloop
 

Posted Sat 01 May 21 @ 5:47 am
Nicotux wrote :
the script only executes what is i the related custom button
strange, the script call the action but does not seem to execute it (same as a set var in a query)

After deeper investigation: there is a race condition with long scripts and the track is reloaded before the of script ends (my fault ^^)

I tried some different thing because it look like tracks do not need to really be loaded in a way to the cues to be set - specifically there is no need to any other sync but browser (and global script is not a loop) in this case

specific to your script (speed is .... impressive)
repeat_start_instant Mainloop ? repeat_stop Mainloop & set running 0 : set running 0 & unload & repeat_start Mainloop 170ms -1 & var running 1 ? : set running 1 & load & beat_tap & set_cue 1 & beatjump +16 & set_cue 2 & beatjump +16 & set_cue 3 & beatjump +32 & set_cue 4 & unload & not browser_scroll 'Bottom' ? browser_scroll +1 & repeat_start_instant waitforbrowser 50ms -1 & get_text `get_status` & param_contains "Browsing" ? : & param_contains "Renaming" ? : repeat_stop waitforbrowser & set running 0 : repeat_stop Mainloop


That script is totally not what I wanted. lol!! It just tripled the bpm and every track in a test folder lol!!
 

Posted Sun 02 May 21 @ 12:03 am
Ok I finally found the thread that I was talking about that shows how it will scroll the browser with a one button press



I think with this as my example I can figure it out from here 🤙🏾
 

Posted Sun 02 May 21 @ 12:11 am
NicotuxHome userMember since 2014
the SOUND INSURGENT wrote :
That script is totally not what I wanted. lol!!


It's only blindly copy/past of the initial script (but last "goto_cue"); I just took care about the cues but not bpm LOL
"beat_tap & set_cue 1 & beatjump +16 & set_cue 2 & beatjump +16 & set_cue 3 & beatjump +32 & set_cue 4" integrated into a scroll automation script

so that ... "beat_tap" applies ... at the speed the script runs (for me it was x2, only for the last track)
to use "beat_tap" in an automated script is not a good idea, it's a manual function

by the way
deleting the altered files from test folder then copy back original ones does NOT restore the original bpm (and other modified tags) - reanalyses does not help
it looks like database entries are attaches to location not to tracks and do not delete or copy with files
 

Posted Sun 02 May 21 @ 8:53 am