Accesso rapido:  

Forum: VirtualDJ Technical Support

Topic: Custom mapping for NI Kontrol Z2
Hi everybody,

User of VirtualDJ Pro for years, I first wanted to congratulate the whole team for the great work accomplished over the last few years to bring our favorite Djing software to a spectacular level, while maintaining ease of use, a very efficient management of the music database , the most extensive device support, and many more... :-)

That said, I would like to have some advices about customizing a NI Kontrol Z2 mixer.
The goal is to add a CUE and a PLAY button for deck left and right. I would like to use the Hotcue 1 and 2 for these like shown in this picture:



Changing constant color for these are pretty easy like:

cue_color 1 : constant '999,0,0' (= red for CUE)
cue_color 2 : constant '0,999,0' (= green for PLAY)

But what about the ability to blink the PLAY button led if deck is stopped or paused ?

For example, I see this code for device Omnitronic CMX-2000:

LED_PLAY_PAUSE: loaded ? cue_stop ? var 'cup' ? on blink : off : play ? on : blink

As default definition file is not editable, is it still possible to define the green color blinking for this original Hotcue 2 button "converted" to a PLAY button?

Thanks to the community,
Iridium
 

Inviato Thu 30 Nov 23 @ 9:43 am
AdionPRO InfinityCTOMember since 2006
simply use the constants for the color you want instead of 'on' or 'off'
(and for blinking, something like blink ? constant '255,0,0' : constant '0,0,0')
 

Inviato Thu 30 Nov 23 @ 9:59 am
Thanks for your feeback.

So it means that using ON or OFF will take the color defined in the hard code definition file, and that the only way to workaround is to use this "constant" setting ? Is it right? Thanks!
 

Inviato Thu 30 Nov 23 @ 11:02 am
AdionPRO InfinityCTOMember since 2006
It depends on how the keys are defined, so not really a workaround.
on/off are used when the key is just a led that can only be on or off, like most likely the play LED in the Omnitronic CMX-2000.
When a key is defined as expecting a color, it should be given the color, rather than on/off, and it is indeed possible that the definition has a default color specified for when only on/off is given.

I am also guessing that the default mapping of the Z2 is relatively old, since for newer mappers there is a specific 'color' script that can be used instead (and which might work for the Z2 as well)
So then your script could use color red for example to make it easier to read instead of constant '255,0,0'
 

Inviato Thu 30 Nov 23 @ 11:19 am
I'll try and come back to you, thanks again!
 

Inviato Thu 30 Nov 23 @ 12:27 pm
Hi all,

After studying VDJscript a bit, I finally managed to finalize my custom mapper. No so difficult in the end :-)

For those interested in adding transport controls (PLAY, CUE, PITCH, PITCH BEND) to a Kontrol Z2, here is what to modify from the default mapper.



HOT_3: cue_button (playMode to configure in the VDJ options panel)
HOT_4: play_button (cueMode to configure in the VDJ options panel)
HOT_A: timecode_active ? nothing : deck left pitch_bend +2% 500ms
HOT_B: timecode_active ? nothing : deck right pitch_bend -2% 500ms
HOT_C: timecode_active ? nothing : deck left pitch_bend -2% 500ms
HOT_D: timecode_active ? nothing : deck right pitch_bend +2% 500ms
LED_HOT3: pioneer_cue ? color blue : constant '0,0,50'
LED_HOT4: pioneer_play ? color green : constant '0,50,0'
LOOP: var 'syncdown' ? pitch_reset : loop
LOOP_SIZE: shift ? loop_move : var 'syncdown' ? param_bigger 0 ? pitch +0.1% : pitch -0.1% : loop_double
SYNC: set 'syncdown' 1 while_pressed & down ? nothing : sync

Hold the SYNC button down and then use loop rotary to adjust the Pitch (Tempo) of the track.
Hold the SYNC button down and then push loop rotary to reset Pitch to its default (zero) value.

pioneer_play:
It behaves as play_pause. However, when used for leds it blinks when a track it's paused or playing while CUE is held, and stays on when the track plays normally. It turns off when the deck is not loaded

pioneer_cue:
It behaves as cue_play. However when used for leds it blinks when a track is paused (but not on a cue point), it stays on when a track has a cue-point set and turns off when a deck is not loaded.

Hope this helps some :-)
Iridium
 

Inviato Tue 05 Dec 23 @ 4:22 pm
 

Inviato Tue 05 Dec 23 @ 4:23 pm
Hello,
Everything is working fine except an undesirable effect for the functions using var 'syncdown' on these:

SYNC: set 'syncdown' 1 while_pressed & down ? nothing : sync
LOOP: var 'syncdown' ? pitch_reset : loop
LOOP_SIZE: shift ? loop_move : var 'syncdown' ? param_bigger 0 ? pitch +0.1% : pitch -0.1% : loop_double

I explain: Pitch and pitch reset are working fine while holding down the sync button and turning or pushing the LOOP knob. The issue is that 'sync' function is triggered when releasing the sync button.

Can anyone tell me why? Is there a way to avoid that?

Thanks for your advice :-)
Iridium
 

Inviato Fri 08 Dec 23 @ 8:01 am
Your code literally instructs VirtualDJ to do so.. down ? nothing : sync
(Do nothing on down, execute sync on up)

It appears that you try to use the "sync" button as a secondary "shift" button.
Also I can see potentional issues with the current implementation..
When you press sync down and move the encoder, pitch changes. But when you let go the sync button, it will also "sync" the decks (if BPM of the other track is in range) and therefore "undo" any pitch adjustment you just made.

Please revise how you want the buttons to work, and then we can help with the code.
 

Inviato Fri 08 Dec 23 @ 1:08 pm
Thanks for your reply :-)

In fact, I tried to mimic this shift function with the sync button from the default mapper of the Traktor Kontrol X1 MK2 where it's working fine (NO sync when releasing sync button). Here is the original code from VDJ default mapper:

SYNC: set 'syncdown' 1 while_pressed & down ? nothing : var 'bpm_touch' ? set 'bpm_touch' 0 : sync
PARAM_TOUCH: set 'bpm_touch' 1
PARAM: var 'syncdown' ? param_bigger 0 ? pitch +0.1% : pitch -0.1% : loop_double
PARAM_PUSH: var 'syncdown' ? pitch_reset : loop

In this case, there is also a 'bpm_touch' variable linked to "PARAM_TOUCH" from the default definition file.

So it means that as the LOOP knob is not a touch one, it will not be possible to do the same with a Kontrol Z2, right?

Thanks for your feedback,
Dimitri
 

Inviato Sat 09 Dec 23 @ 11:11 am