Quick Sign In:  

Forum: VirtualDJ Technical Support

Topic: VDJscript: Total bars of the song
Hey guys,

I'm trying to identify the total bars of the song, as if it were the get_bar... but, as it is an increasing number, I will only know the total bars at the end of the song. I'd like something like get_total_bars, but that doesn't seem to exist.

I searched the forum and found some similar topics, and many point to using cue_countdown but the result doesn't look like the total bars of the song... what I got was a countdown, close to the total seconds of the song.

Does anyone know how to identify the total bars at the beginning of the song? Thanks!
 

Posted Sat 02 Sep 23 @ 8:32 pm
locoDogPRO InfinityModeratorMember since 2013
There is no verb that I can think of from memory but all the maths you need is available

set totalBars `get_time total '1000' & param_multiply 'get_constant 60000 & param_1_x' & param_multiply 'get_bpm' & param_multiply 0.25`

song in ms, * (1/min in ms) * bpm * (1/4)
 

Posted Sat 02 Sep 23 @ 10:04 pm
To get the total bars of the loaded track.. one could create this custom button, to display the Total bars ..
(once pressed, it will display the Total Bars for the track).



where the custom button script is goto 100% & get_bar & param_cast 'text' & set_var '$LoadedTotalBars' & goto_first_beat

and the custom button name is: `get_var $LoadedTotalBars'`




Or
to automatically have the custom button always display the total bars of the last loaded track,
add the same script
goto 100% & get_bar & param_cast 'text' & set_var '$LoadedTotalBars' & goto_first_beat
to the Keyboard's ONSONGLOAD mapping.


And of course one can script further as one wishes, since the variable '$LoadedTotalBars' contains the track's total bars.

 

Posted Sat 02 Sep 23 @ 10:41 pm
Thank you guys. Both suggestions are very interesting... I'll test which one best meets my needs. Thanks for your help.
 

Posted Sat 02 Sep 23 @ 11:08 pm