Sign In:     


Forum: Old versions

Topic: Need Help writing a device and a mapper file for Traktor Kontrol X1

This topic is old and might contain outdated or incorrect information.

Since the Traktor Kontrol X1 is not supported by Virtual DJ yet, I'm trying to write a device and a mapper file for it. Here is what I have so far:
Quote :
<?xml version="1.0" encoding="UTF-8"?>
<device name="Traktor Kontrol X1" author="Felix Geibel" type="MIDI" decks="2">
<button cc="28" name="trans1_loopin" deck="1"/>
<button cc="30" name="trans1_loopout" deck="1"/>
<button cc="32" name="trans1_beatleft" deck="1"/>
<button cc="34" name="trans1_beatright" deck="1"/>
<button cc="36" name="trans1_cuerel" deck="1"/>
<button cc="38" name="trans1_cupabs" deck="1"/>
<button cc="40" name="trans1_play" deck="1"/>
<button cc="42" name="trans1_sync" deck="1"/>
</device>


Quote :
<?xml version="1.0" encoding="UTF-8"?>
<mapper device="Traktor Kontrol X1" author="Felix Geibel" description="Traktor Kontrol X1 Mapper" version="607" date="10/04/2010">
<map value="trans1_play" action="deck 1 play_pause" />
<map value="trans1_sync" action="deck 1 sync" />
<map value="trans1_cuerel" action="deck 1 cue_stop" />
<map value="trans1_beatleft" action="deck 1 pitch_bend +0.06" />
<map value="trans1_beatright" action="deck 1 pitch_bend -0.06" />
<map value="trans1_loopin" action="deck 1 loop_in" />
<map value="trans_loopout" action="deck 1 loop_out" />
</mapper>


It does not work yet. The first problem is, that Virtual DJ does not detect the device. Unfortunately the MidiTrace Program does not show any response from The controller, so for now I did not put any identification in the device file. In that case, my file should be used as a default device? It does not seem to do that. And how do I find out the driver name?

First I tried to use the simple midi mapper, but except for play_pause I could not get anything to work (it did detect the keys, but did not respond to them after the mapping was set up). I was acutally hoping for some easy way to teach the most important keys.

Any help is much appreciated, thanks in advance!

- Felix
 

Posted Sat 10 Apr 10 @ 10:46 am
Thanks for the driver location. The Traktor Kontrol X1 does not only support NHL but also MIDI! (just that the resolution of the knobs is larger with NHL). It comes with a configuration utility where I can customize the MIDI note/cc that every button or encoder sends! I think the problem was that I did not set the "Start in MIDI mode" option in the Traktor Controller Editor. Another problem could have been a syntax error in my device xml file. So vdj now detects the controller automatically (no identification part yet). First problem fixed.

I got the transport section working ok so far, what bugs me most is, that the buttons react when they are released, not when they are pressed. I'll give an example (play button).

In the Traktor Controller Editor I set the play button to send a control change nr. 40 channel 1. The mode is "gate", the value for off is 0 and for on is 127. Here is how I defined it in the device file:
Quote :
<button cc="40" name="trans1_play" deck="1"/>

in the mapper file:
Quote :
<map value="trans1_play" action="deck 1 play_pause" />

so to change the behavior to react on button down I tried to set the action to "down ? deck 1 play_pause : nothing", for some reason that didn't work. I also made the Traktor Kontrol to send a note instead of a cc, I couldn't get that to work either (no reaction).

Another issue is that I try to use an encoder knob to seek through a song. Here the excerpt from my device file:
Quote :
<encoder cc="16" name="browse1_rotate" deck="1"/>
<button cc="18" name="browse1_push" deck="1"/>
<encoder cc="60" name="sh_browse1_rotate" deck="1"/>

here's the corresponding part from the mapper file:
Quote :
<map value="browse1_rotate" action="browser_scroll" />
<map value="browse1_push" action="deck 1 browser_enter" />
<map value="sh_browse1_rotate" action="seek" />

The browser_scroll and browser_enter part works great, but I can't get the seek encoder working as I want. With the above "seek" action vdj starts scrolling through the song and never stops until it has reached the end of the song. I tried "param_greater 50% ? seek +1 : seek -1" resulting in similar behaviour (either scrolls all the way to the end or to the beginning). The next one: "song_pos", first I had to restart vdj because that scrolling to the beginning of the file from the previous commands was still in charge. Then it only scrolled to the right, no matter what direction I was turning (at least only when I was turning not forever like seek). Then "param_greater 50% ? song_pos -1 : song_pos +1", same behaviour, only scrolling to the right, what am I doing wrong there? And how do I set the step size?

Thank you for any help! I'll also keep you up to date on my progress...

- Felix
 

So I've gotten pretty far, some issues still remain:

1) How do I assign different actions for encoder turned left and encoder turned right? (e.G. loop_half for left and loop_double for right?)

2) Why does song_pos with an encoder always move to the right only? I want to use one encoder to scroll through the song quickly and another one to scroll back and forth precisely (e.g. +-4 beats and +-100ms). I am wondering why the browser_scroll works so well with an encoder but song_pos does not, seems odd to me...

3) The buttons still react when released as opposed to when they are pressed down. Also the while_pressed modifier doesn't work, if I use it, the corresponding action is never executed. I really need it for pitch_bend/nudge actions.

Any help appreciated!

- Felix

PS: I'll post the complete xml files once I'm finally done.
 

fgeibel wrote :
1) How do I assign different actions for encoder turned left and encoder turned right? (e.G. loop_half for left and loop_double for right?)

Have you tried with "param_greater" and "param_smaller" ? Otherwise, use loop_length

something like that : "param_greater 50% ? browser_scroll +1 : browser_scroll -1" ?

fgeibel wrote :
2) Why does song_pos with an encoder always move to the right only? I want to use one encoder to scroll through the song quickly and another one to scroll back and forth precisely (e.g. +-4 beats and +-100ms). I am wondering why the browser_scroll works so well with an encoder but song_pos does not, seems odd to me...

Try "param_greater 0% ? song_pos"

fgeibel wrote :
3) The buttons still react when released as opposed to when they are pressed down. Also the while_pressed modifier doesn't work, if I use it, the corresponding action is never executed. I really need it for pitch_bend/nudge actions.

Try "down ? xxxx : xxxx" or "up ? xxxx : xxxx"
 

Ok, the param_greater thing works now! I tried it before but the problem was, that during testing I changed the encoder from relative to absolute and never changed it back... My fault.

But the button down thing still remains, using "down ? play_pause : do_nothing" does not work, in fact I think it has to do with how vdj interprets the midi signal. Currently I'm sending a cc with the mode "gate" and value 0 for off and 127 for on. It appears that vdj only detects a button action when the value changes from 127 to 0 (from off to on). I can change what command the controller sends, but I have to know what vdj expects! This must also be the reason why the modifier "while_pressed" does not work. Sending a midi note instead doesn't change anything (for that I can also configure the values for off and on, default is 0 for off and 127 for on).

Any suggestions? Would be greatly appreciated!

- Felix
 

Still no one? It doesn't need to be someone who ones the Kontrol X1, but I have to know what the exact midi signal (including all parameters) is, that vdj expects for a button to work properly. I can then configure the controller to send exactly that sequence. What is the required sequence for vdj to detect a button down action? What for button up? Come on, there should be plenty of midi experts, all these other controllers were successfully programmed...

Curiously in vdj5 it worked fine!

- Felix

 

Normally a MIDI controller should send a NOTE on (127) and off (0) event for buttons, not a CC (Which is for encoders, sliders, etc.)

E.g:

<button cc="40" name="trans1_play" deck="1"/>

Should probably be:

<button note="40" name="trans1_play" deck="1"/>

If it does actually send a CC, then you would use something like:

<button cc="40" value="127" name="trans1_play" deck="1"/>

(Assuming it sends 127 when pressed - A MIDI tracing tool can help determine this.)

For further information, please see:

http://www.virtualdj.com/wiki/ControllerDefinitionMIDI.html
http://www.virtualdj.com/wiki/VDJscript.html
 

Thank you, I had been reading the links you posted quite extensively, and I had tried to change from cc to note, the reason it had not been working was that I used either:

<button note="E1" name="trans1_play" deck="1"/>
<button note="0x28" name="trans1_play" deck="1"/>


instead of

<button note="40" name="trans1_play" deck="1"/>

well, now I got all buttons and encoders working, thanks a lot for your help!

Is it possible to upload files here? I would like to make the files available so other people don't have to go through the same time consuming procedure...

Oh, and if someone wants to extend the device file to support the LEDs, I would shure be happy to use that! (You'll have to email NI to get the correct midi signals of the LEDs though, I could not find them out yet)

 

 

Great, I've uploaded them:

http://www.virtualdj.com/addons/11370/Traktor_Kontrol_X1_device_and_mapper_files.html

I think it will save some other people a lot of work!

Oh, one other question: I could not find a vdj script verb to move songs up and down the playlist, there must be one, right? I would really appreciate it, that was the function I was missing most during my first gig with the Kontrol X1.

Many thanks for all the help so far!
 

fgeibel wrote :
Great, I've uploaded them:

http://www.virtualdj.com/addons/11370/Traktor_Kontrol_X1_device_and_mapper_files.html

I think it will save some other people a lot of work!

Oh, one other question: I could not find a vdj script verb to move songs up and down the playlist, there must be one, right? I would really appreciate it, that was the function I was missing most during my first gig with the Kontrol X1.

Many thanks for all the help so far!


Thanks for all the hard work on the mapper, I have waiting ages for someone to come up with a solution and this is spot on. Are you having any joy with the LEDs?
 

 

Oh and one other question concerning the LEDs: I would like the LEDs assigned to the cue points to behave differently. I'll give an example:

<button name="but1" .../> is assigned to the function "deck 1 cue 1"
<button name="but2" .../> is assigned to the function "deck 1 cue 2"
and the LEDs are defined like:
<led note=".." name="led_but1" default="but1"/>

currently the LEDs light up when the song is cued at the specific cue point. So only one cue LED at a time will light up and only when the song is stopped at that cue point. I would rather like all LEDs where the cue point is set to light up, to indicate which cue points are set already (lighting up) and which ones are still free (dark). If the song is cued at a specific cue point it would be nice if the LED blinks, but that is just a "nice to have". I would already be happy with cue set-> light, cue still empty->dark. Is it possible to program this using vdj script? Do I have to define this in the mapper or in the device file?

Thank you for any help!
 

fgeibel wrote :
Still haven't found a solution to move songs up and down the playlist.


Sorry, that isn't currently possible with VDJscript.

fgeibel wrote :
I would rather like all LEDs where the cue point is set to light up, to indicate which cue points are set already


Map the button to hot_cue 1 instead of cue 1.

The 'deck 1' should not be necessary. If the controller has two decks, then add decks="2" to the <device> line in the definition, and then add deck="1" or deck="2" as appropriate for which deck each button, knob, slider, etc. is on.

If it's a single deck controller, add decks="1" to the <device> line and then leave out the deck 1 / deck 2 in the mapping. It will then apply to the deck that the user has selected. You should ideally map an appropriate button to invert_controllers & refresh_controller 'NAME' so that the user can toggle the active deck if they only have one controller. Normally the EJECT button on a CDJ-style controller is used for this purpose.

With two of the same controller connected, one will automatically apply to deck 1 and the other to deck 2.

 

Just got My X1 , How to set a command (temporary) ? Toggle on / off effects while holding button down
and also whats the LED notes ? an example plz
 

 



(Old topics and forums are automatically closed)