Forum: General Discussion

Discussions about VirtualDJ, and about DJing in general

Forum Guidelines
If you need extended support, contact our Support Team.
(*) The moderators hold the rights to move or modify posts in order to keep the discussions clear or to facilitate the search.
Topic: Need help with VDJ script (action on beat x/4 as loop)
Hi,
i'm trying to control freestyler dmx with virtual dj (over controller akai apc mini).
With the plugin freestyler8 it is possible to send commands to freestyler (over network to another laptop, very nice).
My goal: sending commands to freestyler on special beats (beat-detection of song).

I already got 4 leds of my controller sync to the beat:
LED1-mapping for beat 1/4:
get beat_num 1 ? color 'red' : color 'yellow'
...red on beat 1 of 4, otherwise stay yellow.
alternative (if you want to control the lenght of blinking):
get_beatpos & param_mod 4 & param_smaller 1 ? get_beatpos & param_mod 4 & param_smaller 2 ? color 'red' : off : color 'yellow'

LED2-mapping for beat 2/4:
get beat_num 2 ? color 'red' : color 'yellow'
...and so on.

Tested commands for freestyler8-plugin:
My mapping for a button (e.g. lights on/off):
cycle '$Var' 2 & var_equal '$Var' 1 ? set $fsvalue 255 & set $fscommand 66 : var_equal '$Var' 0 ? set $fsvalue 0 & set $fscommand 66 : nothing
>>set $fsvalue 255 & set $fscommand 66<< is telling freestyler "special lightscene-override on"
>>set $fsvalue 0 & set $fscommand 66<< is telling freestyler "special lightscene-override off"

What i'm trying to do:
- i want to press a button to activate (1. push) or disable (2. push) following "loop" (like the led-blinking)
- loop for beat x (e.g. 1): at beat 1 sending command1[lights on], else (Beat 2, 3 and 4) sending command2[lights off]
- result/wish: when activate (push a button) vitualdj is sending a special command on every single beat to freestyler, and stop (sending command2) when pushing the button again.

I want to use this for special light effects during playback on a special beat.

Thank you for any ideas/help.

Inviato Mon 20 Nov 17 @ 10:44 pm
I can't follow your thinking mostly because you try to be too technical and this results some inconsistencies on your writing.

However, is this the command you'r looking for ?

loop ? loop : loop X


Where X is a number of beats

If not please try to explain better what you want the SCRIPT to do and not how you intend to use it with Freestyler8 plugin.
It may help us to understand your needs better! :)

Inviato Tue 21 Nov 17 @ 10:27 am
Hello PhantomDeejay,
ok, let me explain with other words :)
I'm not talking about loop with samplers. It is about a programming loop.

VD has a really good bpm detection: "one" "two" "three" "four" - "one" "two" .... which is displayed inside the led-bar at the top of vd.

I have following layout of my controller:
https://virtualdj.com/img/248551/81989/mapping%2001.jpg

When the bpm-number is "one" the button1 turns into red.
https://virtualdj.com/img/248552/21959/mapping%20one.jpg

When the bpm-number ist "two" the button2 turns into red.
https://virtualdj.com/img/248553/66538/mapping%20two.jpg

On bpm-number "three" button3 turns into red, button4 on bpm-number "your". The LED-color is only for orientation.

I'm searching for a skript for button5-12.

for example:
Lets press button 6. There should be a command/action on every beat-number. BUT on beat-number "two" (because it is the 2nd row) there would be a special command.
The commands/actions rotating with the bpm-number like this:
https://virtualdj.com/img/248555/57236/mapping%20two%20commands.jpg

If you press button 6 again, it should stop rotating the commands and should quit the (logical) loop with only one command.

So you have a special command [lights "on"] on every bpm-number "two".

Inviato Tue 21 Nov 17 @ 6:54 pm

Inviato Wed 22 Nov 17 @ 11:48 am
I still don't get what you want, but are you looking for this ?

get beat_num 1 ? action1 : get beat_num 2 ? action2 : get beat_num 3 ? action3 : get beat_num 4 ? action4


or maybe this ?

get beat_num 1 ? action1 : nothing


or maybe this ?

get beat_num 1 ? action1 : action2



Inviato Wed 22 Nov 17 @ 1:46 pm
O.k. let's take your first script line to my "button6". Remember my button6 on beat "two".
action1 = e.g. "special lights off"
action2 = e.g. "special lights on"

get beat_num 1 ? action1 : get beat_num 2 ? action2 : get beat_num 3 ? action1 : get beat_num 4 ? action1

I need this script-line as a programm-loop.

With this script and if you press that button several times per second (until your finger hurts ;), it is the result I'm searching for.
But I only want to push the button once to activate that program-code-loop. So VD ist sending automatically action1 on beat "one", action2 on beat "two", action1 on beat "three"... until i will press the button again to stop that program-loop.
VD should send automatically an "actionX" on every beat.

Inviato Wed 22 Nov 17 @ 10:35 pm
Ok, I got it.

IT IS NOT RECOMMENDED TO USE THIS SCRIPT WITHOUT EXTENSIVE TESTING:

toggle 'MyRepeatButton2' & var_equal 'MyRepeatButton2' 1 ? repeat_start_instant 'MyRepeatAction2' 10ms & get beat_num 2 ? action2 : action1 : repeat_stop 'MyRepeatAction2'


Inviato Thu 23 Nov 17 @ 5:56 pm
Thanks! "repeat_start_instant" - thats it! ;)

I think we are on the finishing straight.

toggle 'MyRepeatButton2' & var_equal 'MyRepeatButton2' 1 ? repeat_start_instant 'MyLoop2' 10ms & get beat_num 2 ? set $fsvalue 255 & set $fscommand 66 : get beat_num 3 ? set $fsvalue 0 & set $fscommand 66 : nothing : repeat_stop 'MyLoop2' & set $fsvalue 0 & set $fscommand 66

The override button in freestyler automatically enables (at beat 2) and disables (at beat 3).

But the fixtures doesn't switch off after activating that program-loop. Looks like they get a permanent override command. I have to enable "Release All" in freestyler to disable that permanent override.

I have another button (mapped in vd) for manual control the same override button in freestyler:
down ? set $fsvalue 255 & set $fscommand 66 : set $fsvalue 0 & set $fscommand 66
This is working without any problems.

The override button in freestyler is configured as toggle button.

What could be the problem?

Inviato Fri 24 Nov 17 @ 12:42 am
Maybe that skript is sending to many (double) commands to freestyler...

I'll test with an additional variable to ensure that commands are only transmitted once.

Inviato Fri 24 Nov 17 @ 11:10 am
siggy019 wrote :

The override button in freestyler is configured as toggle button.

What could be the problem?

Set the button to Flash mode


Inviato Fri 24 Nov 17 @ 3:37 pm

Inviato Fri 24 Nov 17 @ 3:38 pm