Blog

Sign In:     


VDJscript examples

Sun 21 Jun 09 @ 2:13 pm

Control 4 decks with a 2 deck controller (E.g: Hercules DJ Console):

Change the mapping of the PFL button (If it has one) to the following:

select ? device_side 'left' ? deck 1 leftdeck ? on & deck 3 leftdeck & deck 3 select : on & deck 1 leftdeck & deck 1 select : deck 2 rightdeck ? on & deck 4 rightdeck & deck 4 select : on & deck 2 rightdeck & deck 2 select : select


Pressing the PFL button will select the deck for headphone pre-listen if it's not currently selected, otherwise it will toggle between controlling decks 1 & 3 on the left side or decks 2 & 4 on the right.

Alternatively, you can assign a separate button that is present on both sides of the controller to the following:

device_side 'left' ? deck 1 leftdeck ? deck 3 leftdeck : on & deck 1 leftdeck : deck 2 rightdeck ? deck 4 rightdeck : on & deck 2 rightdeck


This will toggle between decks 1 & 3 on the left side and decks 2 & 4 on the right, with the button LED (If it has one) indicating which deck is selected (On = 3/4)

NOTE: On a single deck controller, you can use the action invert_controllers to change which deck it is assigned to. By default, this is assigned to the EJECT button of the controller if it has one.


Toggle single timecode between the decks using TAB:

If you are using a single timecode deck, then by default when you press TAB, it will not follow the selected deck. You must manually assign it in the SCRATCH section of the default skin.

To make it follow the selected deck as you press TAB, simply change the mapping for the TAB key to the following:

deck active select & get hastimecode ? timecode_active : nothing



Toggle vinyl (Scratch) mode on/off for all decks with a single button:

If you are using a controller such as a Hercules DJ Console that has a single SCRATCH button to toggle vinyl (Scratch) mode on/off, then you will find that this only works for the first two decks. Simply change the mapping for the button as follows to make it work for all 4 (Or 6) decks:

4 decks:

deck 1 vinyl_mode on ? deck 1 vinyl_mode off & deck 2 vinyl_mode off & deck 3 vinyl_mode off & deck 4 vinyl_mode off : deck 1 vinyl_mode on & deck 2 vinyl_mode on & deck 3 vinyl_mode on & deck 4 vinyl_mode on

6 decks:

deck 1 vinyl_mode on ? deck 1 vinyl_mode off & deck 2 vinyl_mode off & deck 3 vinyl_mode off & deck 4 vinyl_mode off & deck 5 vinyl_mode off & deck 6 vinyl_mode off : deck 1 vinyl_mode on & deck 2 vinyl_mode on & deck 3 vinyl_mode on & deck 4 vinyl_mode on & deck 5 vinyl_mode on & deck 6 vinyl_mode on



Use a combination of buttons to trigger two different actions (I.e: SHIFT button):

VDJscript for the button that will act as the modifier, i.e: SHIFT:


set '$shift' 1 while_pressed


Button to perform two different actions depending on the state of SHIFT button, e.g: FX:

var '$shift' ? effect 'backspin' active : effect 'Flanger' active


This causes the button to trigger flanger on its own, and backspin if SHIFT+button is pressed.


Toggle a specific effect on/off with a button:

effect 'Flanger' active


(Replace Flanger with any other effect name of your choice.)


Toggle a specific video effect on/off with a button:

video_fx_select 'Strobe' & video_fx



Adjust FX parameter using the jogwheel:

Change the jogwheel mapping to the following:

effect active ? effect slider 1 : jogwheel


(Use touchwheel instead of jogwheel for a touch sensitive jogwheel.)

To adjust parameter 1 with the left jogwheel and parameter 2 with the right jogwheel on a dual-deck controller:

deck active effect active ? device_side 'left' ? deck active effect slider 1 : deck active effect slider 2 : jogwheel



Double/half loop using the jogwheel (When a loop is active)l:

Change the jogwheel mapping to the following:

loop ? param_smaller 0% ? cycle %jog -100 & var %jog ? nothing : loop_half 1 : cycle %jog 100 & var %jog ? nothing : loop_double 1 : jogwheel


The sensitivity can be adjusted by changing the value 100 (Smaller = More sensitive.)

(As above, use touchwheel instead of jogwheel for a touch sensitive jogwheel.)


Adjust loop length using a knob or slider (When a loop is active)l:

loop ? param_smaller 12% ? loop 0.125 ? nothing : loop 0.125 : param_smaller 24% ? loop 0.25 ? nothing : loop 0.25 : param_smaller 36% ? loop 0.5 ? nothing : loop 0.5 : param_smaller 48% ? loop 1 ? nothing : loop 1 : param_smaller 60% ? loop 2 ? nothing : loop 2 : param_smaller 72% ? loop 4 ? nothing : loop 4 : param_smaller 84% ? loop 8 ? nothing : loop 8 : loop 16 ? nothing : loop 16 : nothing


To invert the behaviour of the slider, add param_invert, e.g:

loop ? param_invert & param_smaller 12% ? loop 0.125 ? nothing : loop 0.125 : param_smaller 24% ? loop 0.25 ? nothing : loop 0.25 : param_smaller 36% ? loop 0.5 ? nothing : loop 0.5 : param_smaller 48% ? loop 1 ? nothing : loop 1 : param_smaller 60% ? loop 2 ? nothing : loop 2 : param_smaller 72% ? loop 4 ? nothing : loop 4 : param_smaller 84% ? loop 8 ? nothing : loop 8 : loop 16 ? nothing : loop 16 : nothing


NOTE: To adjust loop length with an endless encoder knob (One that can be turned continuously with no stopping point), use:

param_greater 0 ? loop_double : loop_half



Assign different actions for the same button/knob on each side of a dual-deck controller:

The controller definitions for dual-deck controllers such as the Hercules DJ Console RMX, Denon DN-HC4500, etc. are setup so that each button only needs to be mapped once (E.g: PLAY is mapped once to play_pause instead of needing to map it twice (Once for each deck.)

This is done for convenience and to make the mapping considerably simpler, because in most cases, the button, knob, etc. will perform the same function on both sides.

However, you can make a mapping perform different functions for each side by using device_side, e.g:

device_side 'left' ? sampler play_stop : effect active


This would make a button trigger a sample on the left side and effect on the right.

Of course, the action will be applied to appropriate deck based on which side it's on. You can also get around this by preceding the action with the following:

deck left to apply to left deck.
deck right to apply to right deck.
deck 1 to apply to deck 1.
deck 2 to apply to deck 2.
deck 3 to apply to deck 3.
deck 4 to apply to deck 4.
deck active to apply to the active deck (The one playing out live.)
deck default to apply to the default deck (The one being cued up/pre-listened to.)

E.g:

device_side 'left' ? deck active sampler play_stop : deck active effect active


NOTE: Old VirtualDJ v6 mappings using action_deck should be changed to action_deck


Trigger a different function if the button is held down for a given amount of time:

By using holding, you can get a button to perform two different functions depending on whether it's 'clicked' or held down and then released. The amount of time in milliseconds can be optionally specified. E.g: A LOAD button on a controller could be mapped to the following:

holding 2000ms ? unload : load


This will cause the button to load the selected song from the browser if the button is clicked, and unload the song from the deck if the button is held down for 2 seconds and then released.

NOTE: You should be careful using holding with actions where timing is critical, such as hot_cue. This is because the function is triggered when the button is released rather than pressed, resulting in a small random delay depending on how fast you press and release the button. For load/unload, this is not important, but if you are trying to play a hot cue on the beat, this delay may result in your mix being slightly out of time.


Make buttons perform different functions depending on what mode is selected:

First map a button to cycle through the modes, e.g: For 4 different modes Normal, Effects, Video and Sampler:

cycle 'mode' 4 & var_equal 'mode' 1 ? show_text "Effects|Mode" : var_equal 'mode' 2 ? show_text "Video|Mode" : var_equal 'mode' 3 ? show_text "Sampler|Mode" : show_text "Normal|Mode"


If your controller does not have text displays, then map the button to:

cycle 'mode' 4


And map the LED of the button (BUTTONNAME_LED) to indicate the mode:

var_equal 'mode' 1 ? on : var_equal 'mode' 2 ? on blink : var_equal 'mode' 3 ? on blinkfast : off



The variable 'mode' now holds the mode number, which you can then use in the mapping for each button that will act differently depending on the mode, e.g: You could map a button as follows:

var_equal 'mode' 1 ? effect 'Flanger' active : var_equal 'mode' 2 ? video_fx_select 'Negative' & video_fx : var_equal 'mode' 3 ? sampler 1 play_stop : hot_cue 1


The button will act as follows:

Normal: Hot cue #1
Effects: Turns flanger on/off
Video: Turns the video effect 'Negative' on/off
Sampler: Plays sample #1


Fine pitch adjustment with a knob:

Assigning the following to an endless encoder knob on your controller (If it has one) will allow you to make very fine pitch adjustments.

param_greater 0 ? pitch +0.01% : pitch -0.01%


Alternatively, you can map two buttons to the following:

pitch -0.01%

pitch +0.01%



Protected CUE button:

Changing the mapping of the CUE button of a controller to the following will prevent the cue point from being accidentally changed by pressing the CUE button when the song is paused away from the cue point. To change the cue point, it must be deleted first.

play ? cue_stop : hot_cue ? cue_stop ? cue_stop : pause_stop : cue_stop



CUP (Cue and play):

This feature will go to the current cue point while the button is held down, then start the song playing as soon as the button is released. If the song is already playing, it will jump to the cue point and continue playing.

play ? goto_cue : down ? goto_cue : play



CUE button that does not modify existing cue points

Map the CUE button to the following:

play ? cue_stop : hot_cue ? cue ? cue : down ? stop : cue : set_cue



Stutter button:

The following implements a stutter button. The first press sets the stutter point (Loop in.) Further presses stutter the music from that point. If the button is not used for a few seconds, it will reset automatically.

NOTE: When a loop is active, the button will perform reloop.

Map the button to the following:

var 'shift' ? loop_in & loop_out & loop_exit : loop_in ? reloop & loop_out : loop_in


Map the button LED (If it has one) separately to the following:

loop ? off : loop_in ? blink : off



'Chop' between both decks:

The following will pause the active playing deck and start the opposite deck playing:

deck active pause & deck default play & deck active select



A.Cue Scratch:

This feature will jump to the current cue point when the jogwheel is touched, allowing you to scratch from that point. Once the jogwheel is released, it will jump back to the cue point again and continue playing the song from that point.

If no cue point is currently set, then this can also be used to set the cue point by scratching. The cue point will be set when you release the jogwheel.

NOTE: This will only work on controllers that have touch-sensitive jogwheels.

Map a button to toggle this feature on/off:

toggle 'acue'


Then add the following to the jogwheel's touch sensor mapping (Usually named JOG_TOUCH):

& var 'acue' ? down ? hot_cue ? goto_cue & play : nothing : hot_cue ? goto_cue & play : set_cue


E.g:

touchwheel_touch & var 'acue' ? down ? hot_cue ? goto_cue & play : nothing : hot_cue ? goto_cue & play : set_cue


If you don't want it to jump back to the cue point again after performing your scratch, add the following to the jogwheel's touch sensor instead of the above:

& var 'acue' ? down ? hot_cue ? goto_cue & play : nothing : hot_cue ? play : set_cue


NOTE: If the button for toggling A.Cue scratch mode on/off is not on the same side of the controller, or is in the middle mixer section (If it has one), then you will need to use '$acue' for the variable name above instead of 'acue'.

NOTE: On a Hercules 4-Mx or 4Set, please use the following for JOG_TOUCH:

touchwheel_touch & var '$acue' ? play ? hot_cue ? stop & goto_cue & play : nothing : play : nothing



Simple MIDI Wrapper invert pitch slider

When mapping the pitch slider with Simple MIDI wrapper, you may find that the slider is inverted, so that moving the slider up speeds the song up instead of slowing it down (As on most DJ CD players and vinyl decks.) To invert the pitch slider so that it behaves correctly (Up slows down), simply map it as follows:

param_invert & pitch_slider



Simple MIDI Wrapper Endless Encoder Knobs and Jogwheels

Simple MIDI wrapper only supports very basic MIDI such as buttons, sliders and knobs with a min/max stopping point. Other features such as endless encoder knobs, jogwheels and LED's ideally require a controller definition to work optimally: http://www.virtualdj.com/wiki/ControllerDefinitionMIDI.html

However, you can map an endless encoder knob in Simple MIDI Wrapper by using the following:

param_greater 50% ? action 1 : action 2


E.g:

param_greater 50% ? browser_scroll +1 : browser_scroll -1


And you can map a jogwheel using the following:

param_greater 50% ? jogwheel +0.1% : jogwheel -0.1%


For a dual-deck controller, you will need to add the appropriate deck in front of each action:

deck left param_greater 50% ? deck left jogwheel +0.1% : deck left jogwheel -0.1%
deck right param_greater 50% ? deck right jogwheel +0.1% : deck right jogwheel -0.1%


For a touch-sensitive jogwheel, you will need to use touchwheel instead of jogwheel in the above mappings and also map touchwheel_touch to the touch sensor.



Use left/right jogwheels to browse folders and songs on a dual-deck controller:

Map the jogwheel to:

wheel_mode "browser" ? device_side 'left' ? browser_window "folders,folders" & jogwheel : browser_window "songs,songs" & jogwheel : jogwheel


Map the button to toggle browsing on/off to:

wheel_mode "browser" ? deck left wheel_mode "jog" & deck right wheel_mode "jog" : deck left wheel_mode "browser" & deck right wheel_mode "browser"




Denon HC-DNH4500 A1/A2 buttons:

To make the A1/A2 buttons behave similar to how they do on Denon CD players, change their mappings as follows:

A1 = set 'A1' 1 while_pressed & var 'FLIP' ? delete_cue 98 & loop_exit : hot_cue 98 & loop_in & set 'ABTN' 1
A2 = set 'A2' 1 while_pressed & var 'FLIP' ? delete_cue 99 & loop_exit : hot_cue 99 & loop_in & set 'ABTN' 2
B = var 'FLIP' ? loop_exit : loop ? loop_half : loop_out

LED_A1_DIMMER = hot_cue 98
LED_A2_DIMMER = hot_cue 99

LED_A1 = loop ? var_equal 'ABTN' 1 ? on : off : off
LED_A2 = loop ? var_equal 'ABTN' 2 ? on : off : off

LCD_LOOP1_( = loop ? var_equal 'ABTN' 1 ? on : off : off
LCD_LOOP1_A1 = hot_cue 98
LCD_LOOP1_B = loop ? var_equal 'ABTN' 1 ? on : off : off
LCD_LOOP1_) = loop ? var_equal 'ABTN' 1 ? on : off : off

LCD_LOOP2_( = loop ? var_equal 'ABTN' 2 ? on : off : off
LCD_LOOP2_A2 = hot_cue 99
LCD_LOOP2_B = loop ? var_equal 'ABTN' 2 ? on : off : off
LCD_LOOP2_) = loop ? var_equal 'ABTN' 2 ? on : off : off

FLIP = set 'FLIP' 1 while_pressed & holding 1000ms ? delete_cue 98 & delete_cue 99 & loop_exit : var 'A1' ? wheel_mode "jog" : var 'A2' ? wheel_mode "jog" : loop ? wheel_mode "loop_move,loop_out,loop_in,jog" : wheel_mode "jog"


NOTE: This uses cue points 98 and 99 - If you don't want these saved in your song, please ensure that you ensure that you clear them first (Hold FLIP for 1 second or press FLIP+A1 and/or FLIP+A2)


[[Supported Controllers]]