Pioneer DDJ-SR2 fully working on Linux

Hello, world!

First off, many, many thanks to everyone involved in the Mixxx project! Mixxx is a killer application. I had many problems with Serato in the past, such as the triggering of effects crashing the whole application, or samplers that buzz in the end of the sample.

Mixxx on the other way is rock solid, it doesn’t crash, the samples don’t buzz and you can actually download the source code and modify it to your needs. And running Mixxx on Linux with JACK and a realtime PREEMPT kernel is a must if you can afford all the RAM that it locks. Simply a better DJ setup than what you would achieve on Windows or even Mac.

I recently got the Pioneer DDJ-SR2 working fully on Linux and this is a thread to document it.

Well, the first thing you need is to patch your kernel. Nobody said it was gonna be easy, eh? But it’s actually a very simple patch. I already submitted the patch to Takashi Iwai and according to him it will be mainlined for kernel 5.11 if everything goes smooth.

So, before it is mainlined, I need your help. If you happen to run Linux and got a Pioneer DDJ-SR2 please test the following instructions and leave your feedback here on this thread, so we can know it’s really working for everybody, i.e. not just working for me :slight_smile:

Since the formatting here screws up the patch, I’ll just upload it.

ddj-sr2.patch (2.4 KB)

Well, that was the easy part, since it was just a matter of figuring out the audio endpoints (same as DDJ-RB already on quirks table) and how many inputs and outputs the DDJ-SR2 has.

Now, for the hard part.

Once you apply this patch you will be able to configure Mixxx sound hardware to use ALSA or preferably JACK. Inputs 5-6 record the MASTER + MIC so you will want to configure Mixxx to use that, but you will see inputs 1-2 and 3-4 are muted and Vinyl Control / Passthrough doesn’t work.

This is because the DDJ-SR2 mixes the inputs in hardware. We will need to put it into Serato Mode so that it activates the inputs and mutes the hardware input signal path. One caveat: activating the PHONE/LINE inputs will also mute the MIC on inputs 5-6 it seems.

So, before I tell you how to put the DDJ-SR2 in Serato Mode let me just give you some background on how I achieved that. I ran a Windows 10 VM as a guest on Linux both with VirtualBox and QEMU.

VirtualBox only allowed me to capture the first MIDI SysEx message that Serato sends as part of the authentication handshake. QEMU fully ran Serato with the nec-usb-xhci USB driver but I was lucky that the other QEMU USB drivers didn’t fully work

Because that allowed me to capture the MIDI SysEx messages one by one without a deluge of information. I used Wireshark for the capture of usbmon.

Oh, and by the way, before you do this turn off your DDJ-SR2, boot it while holding SHIFT + PLAY, and make sure left KEYLOCK is lit off (Serato Mode enabled) and right KEYLOCK is lit on (Mix in software while in Serato Mode).

Specifically if Serato Mode is disabled the MIDI SysEx messages that turn it on will make your controller unresponsive to MIDI commands (first SysEx message) and after that it will stop sending MIDI messages altogether (second SysEx message). This freezes Serato even on a real Windows machine.

Ok, so I will spare you the details and just leave the commands for activating Serato Mode. This assumes DDJ-SR2 is your only MIDI device connected. Run:

  • amidi -p “hw:1,0,0” -S “f0 00 20 04 7f 01 02 04 01 01 5f 04 0c 0e 05 04 03 0a 07 04 0f 02 06 04 0b 05 0f 04 01 05 03 06 00 f7”

The controller will now send what I believe is license information, so I will omit the reply. You can capture the reply with amidi -p “hw:1,0,0” -d

  • amidi -p “hw:1,0,0” -S “f0 00 20 7f 01 02 01 01 63 09 04 0e 05 0c 06 09 05 00 01 0a 04 0b 07 07 0c f7”

OK, that’s it, basically. Spin some Vinyl on one of the PHONO inputs and set that deck to PHONO/LINE. You should hear nothing. If that’s the case, congratulations, it worked, fire up Mixxx and set Vinyl to PASS (that’s assuming you correctly configured Vinyl Control 1 for inputs 1-2 and Vinyl Control 2 for inputs 3-4) and now you should hear your record on the MASTER.

Presto!

2 Likes

Thank you for the detailed information. What controller mapping are you using? Why don’t you send the MIDI sysex messages from the controller script?

I’m using the standard controller mapping Mixxx chooses (which is for DDJ-SX actually). That’s a great idea, I’ll try to do that.

Nota bene: I don’t know yet how to disable Serato Mode once it is enabled. One has to power off the controller and then power it on again to “reset” the Controller to Normal Mode.

OK, I’m a little burned out from working on this for the last few days but I was able to fire up the VM and Wireshark one more time.

  • amidi -p “hw:1,0,0” -S “f0 00 20 7f 50 01 f7”

This command will restore the DDJ-SR2 to Normal Mode once it has entered Serato Mode.

Why would a user want to do that? To play music vinyl through the DDJ-SR2 without running software?

You’re right Be0, it’s a bit useless, the only use case I can foresee is when the user wants the MIC to be recorded mixed together with MASTER on inputs 5-6. He’d need to turn Serato Mode off.

But that’s how far I wanna go with reverse engineering this. I’m not interested in cracking the DDJ-SR2 authentication protocol so some counterfeiter can produce junk that plugs into Serato. I just want to unlock the full features of MY hardware, period. :upside_down_face:

1 Like

Are you sure there is no way to decouple these? What signal comes in on inputs 5-6 in Serato mode? Is it the microphone alone? Is there no way to use the microphone input and vinyl control at the same time?

As I said I’m a bit burned out right now Be0, but happy.

I’ll check it out and let the community know.

And no, it’s MASTER + MIC always. No way to turn off MASTER for 5-6 inputs unless you mod the hardware of course.

I was mistaken. MIC is always present in 5-6 inputs regardless of Operation Mode.

Makes the possibility of an use case for turning Serato mode off even more remote, but it can’t hurt to map it too.

Good. I was afraid Pioneer wired the audio signals such that it was impossible to use both timecode and the microphone, which would be silly.

I recommend to simply turn on Serato mode unconditionally in the controller script’s init function and not switch it out of Serato mode on shutdown. I doubt anyone will care to switch it out of Serato mode.

Thanks for the recommendation Be0, before starting this adventure I was playing with the Mixxx source code a bit, I plugged into the AutoDJ function AutoDJProcessor::playerPositionChanged and made Mixxx reactive for external control by modifying regular files.

My plan is to build a DJ recommendation system on top of Mixxx, not an AutoDJ, but a system that helps to plan DJ sets. But one could easily make an Android/iOS app that ssh’s into the machine running the Mixxx instance and remote controls Mixxx.

I doubt it will be merged into the Mixxx tree (too hacky) but since it’s all open source I’ll just fork it.

That’s a bit beside the point. My point was having an entry point into code (Controller Mappings are still “code”) makes things way, way easier. So thanks for that.

@Be0 please take a look at the attached patch for the DDJ-SR2 Serato Mode engagement.

Serato_Mode_DDJ_SR2.patch (1001 Bytes)

There are a couple of issues with the patch.

First, I don’t know if this SysEx message works for the DDJ-SX too. The Controller Mapping is shared between DDJ-SX and DDJ-SR2.

Second, as explained on the first post, if the user has the wrong settings on the controller self-configuration mode (SHIFT + PLAY BOOT) it will screw up, neither sending nor receiving MIDI messages anymore.