Mapping for Stanton DJC.4

Hi All,

I have a Stanton DJC.4 that I wish to use with my MacBook Pro. Does anyone have a mapping file? I recently bought Traktor Pro 2 to use with my PC but can’t use anymore since I switched to a Mac. I would really appreciate any assistance with mapping if no has a mapping file. Thanks.

Andy

I got a DJC.4 today as well. Don’t know much about mapping, but would be happy to help out if anyone’s up for it.

So I’m trying to figure out how this mapping game works, and I’m doing some testing. I’m able to map the buttons using the wizard, but I can’t get the scripting going. What am I doing wrong here?

<?xml version='1.0' encoding='utf-8'?> <MixxxMIDIPreset mixxxVersion="1.11.0" schemaVersion="1"> <info> <name>Stanton DJC.4</name> <author>Martin Bruset Solberg</author> <description>Test</description> <wiki>http://mixxx.org/wiki/</wiki> </info> <controller id="DJC-4"> <scriptfiles> <file filename="Stanton-DJC-4-scripts.js" functionprefix="StantonDJC4"/> </scriptfiles> <controls> <control> <group>[Channel1]</group> <key>play</key> <status>0x90</status> <midino>0x18</midino> <options> <normal/> </options> </control> <control> <group>[Master]</group> <key>StantonDJC4.ledOnTest</key> <status>0x90</status> <midino>0x25</midino> <options> <Script-Binding/> </options> </control> </controls> <outputs/> </controller> </MixxxMIDIPreset>

[code]function StantonDJC4() {}

StantonDJC4.init = function(id) {

StantonDJC4.id = id;

}

StantonDJC4.ledOnTest = function (channel, control, value, status, group) {
midi.sendShortMsg(status,control,value); // This might light an LED
}[/code]

I’ve included the play button on one deck just as a test to see if the map is loaded. Midino 0x25 is a button with LED light. I want to be able to light the button, however, that doesn’t work.

Hey martibs,

I followed the approach used on the MC3000 script and modified it to make the script for the Denon MC2000 (you can download it and take a look for details).

I first got the MIDI reception commands from the spec sheet (found it just by using Google since it wasn’t included with my controller) and put them in an associative array.

// MIDI Reception commands (from spec)
mc2000.leds = {
	cue1: 			17,
	cue2: 			19,
	cue3: 			21,
	cue4: 			23,

	samp1_l: 		25,
	samp2_l: 		27,
	samp3_l: 		29,
	samp4_l: 		32,

	samples_l: 		35,
	samp1_r: 		65,
	samp2_r: 		67,
	samp3_r: 		69,

	samp4_r: 		71,
	samples_r: 		73,
	cue: 			38,
	play: 			39

	// etc.
};

Defined a function like this for every bound control:

mc2000.playSetLed = function(value, group) {
	mc2000.setLed(mc2000.group2Deck(group),mc2000.leds["play"],value);
};

The group2Deck function converts the group string to the Deck number. An if-elseif-else flow would work too.

mc2000.group2Deck = function(group) { var matches = group.match(/^\[Channel(\d+)\]$/); if (matches == null) { return -1; } else { return matches[1]; } };

And the setLed function which translates the status (given by mixxx) to the ledStatus code (from the spec sheet). The first parameter in sendShortMsg is the MIDI channel for the corresponding deck (0xB0 or 0xB1, from the spec again, for deck 1 or 2).

mc2000.setLed = function(deck,led,status) {
	var ledStatus = 0x4B; // Default OFF
	switch (status) {
		case 0: 	ledStatus = 0x4B; break; // OFF
		case false: ledStatus = 0x4B; break; // OFF 
    	case 1: 	ledStatus = 0x4A; break; // ON
		case true: 	ledStatus = 0x4A; break; // ON
    	case 2: 	ledStatus = 0x4C; break; // BLINK
    	default: 	break;
	}
	midi.sendShortMsg(0xB0+(deck-1), ledStatus, led);
};

What is good to do is to bind the mixxx controls to the appropiate buttons so that they show the correct status automatically (play lights up when playing, and lights off when not). I did this in the init function. The loop is just to avoid typing Channel1, Channel2 and having too much duplicate code.

[code]// Called when the MIDI device is opened & set up.
mc2000.init = function(id, debug) {

mc2000.id = id;
mc2000.debug = debug;


// ---- Connect controls -----------

// ---- Controls for Channel 1 and 2
var i=0;
for (i=1; i<=2; i++) {

	// Key lock
	engine.connectControl("[Channel"+i+"]", "keylock", "mc2000.keylockSetLed");
	// Sync
	engine.connectControl("[Channel"+i+"]", "beat_active", "mc2000.beatActiveSetLed");

	// Cue
	engine.connectControl("[Channel"+i+"]", "cue_default", "mc2000.cueSetLed");
	// Play
	engine.connectControl("[Channel"+i+"]", "play", "mc2000.playSetLed");

	// etc...

}

};[/code]

Since the controls are connected but the default functionality is used, I didn’t need to do a script-binding in the xml for the play button at least. Be sure to map the press and release codes (the wizard didn’t add them all for me on deck 2). Here is the relevant part of the midi.xml for my play buttons:

<control>
                <group>[Channel1]</group>
                <key>play</key>
                <status>0x80</status>
                <midino>0x43</midino>
                <options>
                    <normal/>
                </options>
            </control>

            <control>
                <group>[Channel2]</group>
                <key>play</key>
                <status>0x81</status>
                <midino>0x43</midino>
                <options>
                    <normal/>
                </options>
            </control>

            <control>
                <group>[Channel1]</group>
                <key>play</key>
                <status>0x90</status>
                <midino>0x43</midino>
                <options>
                    <normal/>
                </options>
            </control>
            <control>
                <group>[Channel2]</group>
                <key>play</key>
                <status>0x91</status>
                <midino>0x43</midino>
                <options>
                    <normal/>
                </options>
            </control>

Hope it helps, once you get one going the rest is very straight-forward :slight_smile:

Thanks a lot! I’ve got plenty of work ahead of me, there’s a ton of controls and lights on this thing. Is there a guide on how to map the controller VU meters?

Hmm, none that I know of, maybe a fellow poster can help you with a guide. But you can find the list of mixxx controls here.

The VuMeter control sends values on the default range, that is, between 0.0 and 1.0. I don’t know how to exactly implement it, because my controller doesn’t have a vumeter and it’s implementation would probably differ anyway. If you know other similar controllers compatible with mixxx, take a look at their scripts (hopefully another Stanton), maybe the same vumeter function works for yours :slight_smile:

Take a look here:
Windows: C:\Program Files\Mixxx\controllers
Linux: /usr/share/mixxx/controllers or /usr/local/share/mixxx/controllers
OS X: /Applications/Mixxx.app/Contents/Resources/controllers/

I found these:

/Applications/Mixxx.app/Contents/Resources/controllers/Stanton SCS.1d.midi.xml /Applications/Mixxx.app/Contents/Resources/controllers/Stanton SCS.1m.midi.xml /Applications/Mixxx.app/Contents/Resources/controllers/Stanton SCS.3d.midi.xml /Applications/Mixxx.app/Contents/Resources/controllers/Stanton SCS.3m.midi.xml /Applications/Mixxx.app/Contents/Resources/controllers/Stanton-SCS1d-scripts.js /Applications/Mixxx.app/Contents/Resources/controllers/Stanton-SCS1m-scripts.js /Applications/Mixxx.app/Contents/Resources/controllers/Stanton-SCS3d-scripts.js /Applications/Mixxx.app/Contents/Resources/controllers/Stanton-SCS3m-scripts.js

Could you explain the status argument in the mc2000.setLed2 function? This is the part I don’t understand:

status==1 ? 0x50 : 0x51

EDIT: Never mind, I figured out the ternary operator bit, but where does the status come from? Is it the control value from the button that is pressed?

I assume you got that from this function

mc2000.setLed2 = function(deck,led,status) { midi.sendShortMsg(0xB0+(deck-1), status==1 ? 0x50 : 0x51, led); };

In this context, 0x50 and 0x51 are led status codes (just as in mc2000.setLed). The 0x50 value is to tell the controller to turn on the LED for “Monitor Cue” (on left or right channel, which is specified on the first parameter of sendShortMsg). 0x51 is for telling it to turn it off. It is defined in a different function because, just for these 2 LEDs, Denon used a different led status byte (and didn’t define a ‘Blink on’ status), but it is essentially the same as mc2000.setLed.

Where does the status value come from? It comes from this function:

mc2000.pflSetLed = function(value, group) {
	var side = mc2000.group2Deck(group) == 1 ? 'l' : 'r';       // left or right
	mc2000.setLed2(mc2000.group2Deck(group),mc2000.leds["monitorcue_"+side],value);
};

Which in turn is bound to the PFL control, in the init function.

// Monitor cue
engine.connectControl("[Channel"+i+"]", "pfl", "mc2000.pflSetLed");

This tells Mixxx to call the mc2000.pflSetLed when the PFL (headphone cueing) control changes its status. When monitor cueing is activated, Mixxx calls that function with parameter value=1 and the corresponding group. When it is turned off, it calls it with value=0. This status change can be triggered by clicking the GUI control (clicking the headphones icon) or by pressing the button on the controller (which should be mapped for it to work, script-binding option is not needed unless you want to do something else).

I present to you: The Mixx v1.11.0 Stanton DJC.4 midi mapping v0.1 by martibs!

:laughing:

Still alot missing here, but at least you can mix with it now. The most obvious things missing are:
Browser support
VU Meters
Loop control
Shift functions

I may or may not add these things in the future. At least it’s a start, any feedback is welcome.
StantonDJC4.tar.gz (3.86 KB)

Congratulations!

Thank you so much for doing that! I have been trying for a while to get it to work! How can I get it to work with mixxx though? Its a different file format?

So I was able to get the DJC.4 controller pulled up in mixxx, but none of the buttons work when I select the controller?

NVM I wasnt doing it right. If anyone else cant open it, use 7 zip to open it and then you can drag it right over to the controllers in mix. Now the only problem left is headphone issues! Thank you for the giant leap forward in getting this to work!

Thank you for the feedback. I’ve done some more work on it, will hopefully upload soon. Please report how the mapping is working for you, and what needs fixing.

What is the issue with your headphones? As you’ll figure out, the Master volume knob is not connected with Mixxx, as it is not MIDI-enabled. It simply controls the volume out of the onboard sound device. For now, the Sample volume knob is connected to the Mixxx master volume, I’m not sure it’s such a good solution.

Attached is the new version.

Improvements:
Browser support*
Hot cue deletion**
Skip search***

  • Somewhat. The knob scrolls up and down through the playlist. Shift+load skips up and down the sidebar. Does Mixxx support more advanced browsing?
    ** Shift + hot cue deletes hotcues
    *** Shift + touch platter fast searches through the track (regardless of whether scratch is enabled)
    StantonDJC4.tar.gz (4.26 KB)

Thanks martibs. I’m so stoked right now. :smiley:

I bought a DJC.4 recently and was sad to see that it was not on the list for Mixxx.
Unfortunately, I don’t know anything about mapping but will research.

Any suggestions on a site to start reading up on it?

mixxx.org/wiki/doku.php#controll … umentation

Greetings from Munich Germany,

I actually had an afterhour and a friend of mine made me a brand new Stanton DJC 4 Mapping for Traktor … I hope It works for you as it does for me… i tested it right now with traktor version 2.10.2.9 … in case it works i hope you enjoy :slight_smile:
TRAKTOR MAPPING FOR Stanton DJC 4.rar (25.9 KB)

Hello everyone.

I am trying to map my DJC.4 to Mixxx 2.0 using this file as starter.

Unfortunately, scripting and mapping is new for me and I have some newbie questions where I did not find an answer on.

In the XML file, there are different controls. The item is obviously different for every button in Mixxx.
Is there some kind of list or method to find out what visual button or LED in the Mixxx interface is pointing to what “key”?