Rekordbox For Linux



Pioneer Rekordbox. Native Instruments Traktor Scratch Pro 2. The software is compatible with Linux/Unix OS. Terminal based cross-platform Rekordbox compatible DJ Application for nerdz. Since Pioneer doesn't bother to build this for Linux I decided to testing building it my-self. Progress might be slow since rekordbox uses an closed protocol for it's data transmission. This will not try to become a Rekordbox GUI application for linux. The DDJ-RR is designed to be used under Windows with the Rekordbox DJ software. However, this DJ controller will now work with Linux 5.11+ so it can be used with software like the open-source Mixxx DJ software package. The Pioneer DJ DDJ-RR controller needs a quirk added to the Linux USB audio code so it can be seen as a USB audio device.

Table of Contents

Introduction to the Problem

In the previous article, we already got Rekordbox to run with Wine in Linux. But what we really want is to use Rekordbox with our Pioneer DJ controller (e.g. DDJ-SR, DDJ-SX2, etc). The DJ controller is basically a MIDI device and a USB soundcard. We can connect it to our system and it is also detected but we can not control Rekordbox with the controller itself. In this article, we will show how we can solve this problem.

How to detect MIDI controllers in Linux

In linux we can list all connected MIDI devices with the amidi utility. It reads from and writes to ALSA RawMIDI ports. By using amidi -l we can list all connected MIDI devices.

Also we can see the devices information this way:

Comparing this output with windows, we can see that the appeneded 'MIDI 1' string at the end of the product name is not visible in Windows. But the proper product name is stored somewhere as we can see.

How to detect MIDI Controller in Windows

So how can a Windows application detect or enumerate MIDI devices? There are two handy functions for this:

  • midiInGetDevCaps: Retrieves the capabilities of a given MIDI input device and places this information in the MIDIINCAPS structure.
  • midiOutGetDevCaps: Retrieves the capabilities of a given MIDI output device and places this information in the MIDIOUTCAPS structure.

The MIDICINCAPS structure looks like this:

The interesting part for us is szPname which is the 'Product name in a null-terminated string'. More information can be found here and here.

John Haskey has developed a tiny Windows application ([here[(http://haskey.com/midi/)) which enumartes MIDI devices this way and which we can use to understand how WINE sees our MIDI devices.

Hypothesis

I assume that Rekordbox detects the controller by product name. In Windows it shows up as 'PIONEER DDJ-SR' but in Linux it is 'PIONEER DDJ-SR MIDI 1'. If we can remove the 'MIDI 1' part from the product name, Rekordbox should be able to detect and use the controller again.

Rekordbox For Linux

Solution

There are two approaches I thought about how to solve this problem. We can either change this naming convention on Linux side so that Linux shows already the right product name from the beginning or we can change how Wine shows the product name in Windows applications.

I did the second approach but I have gathered some information for the first one as well, which I will list here for completeness.

The alsa-lib has some raw MIDI functions which are interesting in this case. snd_rawmidi_info_get_name gets the rawmidi hardware driver name but there is no equivalent snd_rawmidi_info_set_name function.

But there are other interesting functions like snd_seq_set_client_name() and snd_seq_set_client_info() which may be used to set the name. I was not able to create a working proof of concept for this. Tell me if you are successful!

So let's get to our working solution and the path of how it was found.

Changing MIDI product name in WINE

Our goal is to change what WINE sees as the product name of the MIDI devices so that other Windows applications see the same change.

First we have to get Rekordbox running in Wine. Please check my other article for this.

The we run Rekordbox the following way to get more verbose debug information:

WINEDEBUG=warn+mci,+mcimidi,+mmsys,+winmm,+midi wine rekordbox.exe &> ~/winemidi.log

The following line was particulary interesting which contains the wrong name received from Alsa:

I wandered from midiInGetDevCapsA() in dlls/winealsa.drv/winmm.c in the Wine sourcecode to dlls/winealsa.drv/midi.c. midi.c was actually the right file where we could solve the problem. I changed some places in ALSA_AddMidiPort() to change the device name removing the 'MIDI 1' part at the end and added some debug messages to see if it really happened (GitHub).

To verify if this change is visible with Wine in Windows applications, we can test the previously mentioned midienum application:

Rekordbox For Linux

Rekordbox for linux windows 10

This was not working at the beginning because it only change the IN devices name but not for the output. Changing the output in a similar way worked and the controller was detected in Rekordbox.

Demin Dmitriy had a better idea and found a cleaner solution. He modified the part where it gets the name and uses the client name instead of the port name:

with

See GitHub for more information.

Thanks again Demin! He also created an issue in the Wine bug tracker for this.

I still have the wine-staging package in ArchLinux installed. To add these changes I downloaded the sourcecode and build Wine as described here. Additionally I build for 32-bit as well (see here) so that I could verify the changes with midienum.exe but this is not mandatory as Rekordbox is x64.

During compiling you should run make -j10 to run multiple recipies at the same time and speed up the process. When everything is compiled you have to copy two files to the right locations:

Additionally I copied 32-bit version but you don't have to:

If you do not want to compile Wine yourself, you can download those two files here.

Then we run Rekordbox as described in the previous article and voila.

Rekordbox detects the controller

If you have problems with getting the sound through the controller, check with pavucontrol or your favorite audio tool, if Rekordbox uses the controller devices and that the controller device is chosen in the Rekordbox preferences.

I hope you guys liked this article and have fun using Rekordbox in Linux.

Using the DDJ-SX2 in Linux

Ideas for the future

  • Give non-Pioneer controllers a Pioneer product name
  • Check what happens, if we use DDJ-200 as product name ;)
  • Translate midi commands at input and output to use any controller with Rekordboxaösa

How to export tracks from Rekordbox to USB so you can use it with Pioneer XDJ controllers or CDJ players like the CDJ 2000.
In this article a step-by-step explanation with a YouTube video.

What does Rekordbox do?

The software Rekordbox prepares your music for the XDJ and CDJ players by Pioneer, like the CDJ 2000.
Rekordbox let’s you do a number of things:
• Check and change detected beatgrid and BPM
• set cue points, cue point names, (auto) loops
• set hot cues and hot cue names
• set CDJ or XDJ settings (like wave form color, auto cue and much more)
• analyses the beatgrid so it will load fast on your CDJ or XDJ
• warns you for incompatible file formats
• make playlists / smart playlists
• set My Tag labels to find your songs quickly
• record song matches
• set related track requirements (i.e. key and tempo)
• add song notes/description

Technically you could slap some mp3 files on a USB drive and load it in the CDJ 2000.
However, the machine is extremely picky in its accepted file formats.

On top of that, the CDJ needs to analyze the file on the fly.
This takes a while and is sometimes wrong.
Nothing is more confusing than a wrong beatgrid when you are spinning.

To get the most out of your DJ set, use Rekordbox to prepare your USB drive for spinning with the CDJ and XDJ machines.

Format your USB drive correctly

An essential part of preparing your USB drive is to format your USB drive correctly.
It needs to be formatted as FAT32 or HFS+ on the MBR (Master Boot Record) setting.
If you don’t know how to do this, check out my Rekordbox USB formatting tutorial for Mac and Windows.

Import songs

Before you can export songs from Rekordbox to USB, Rekordbox needs to have songs imported to begin with.
I’ve written tutorial on how to import songs in Rekordbox, check it out if you don’t know how to do this.

Export songs to USB drive

There are mainly two ways to get songs from Rekordbox on your USB
• via Synchronisation
• via Exporting

Synchronization

Rekordbox For Linux Operating System

I’m not a fan of synchronisation, because there were some bugs in older versions of Rekordbox which led to improper synchronisation.
This meant missing songs on my DJ gig.

Linux

Instead I would advise you to opt for exporting.
This does basically the same thing.
It looks also for files that already exist on your USB drive and skips the ones that already exist to reduce export time.
The difference between synchronisation and exporting is that synchronisation will delete files on your USB drive when you delete them from Rekordbox, exporting does not.
How to delete files from your USB drive, see exporting later in this article.

Rekordbox

To synchronize:
• In the bottom left corner of the screen click Sync Manager

  • check the checkbox Synchronize playlists with a device
  • check all the playlists in column in the middle that you want to synchronize
  • Click on the big arrow next to the Rekordbox playlists.
  • This will start the the synchronization process. You can follow the progress at the bottom of the screen

Exporting to USB

There are several ways you can export songs from Rekordbox, which do basically the same thing.
You can export a playlist or one or more individual songs.

Exporting all songs in playlist

Exporting all songs in a playlist can be done in on of two ways:
• Click a playlist
• Select on the top of the screen Playlist
• Select Export playlist
• Click [name of your USB drive]
• A progress indicator on the bottom of the screen shows the progress

Rekordbox Linux Wine

Or
• Right click on a playlist
• select Export playlist
• Click [name of your USB drive]
• A progress indicator on the bottom of the screen shows the progress

Exporting one or more individual songs

  • Look for the song you want to export by clicking on a playlist or search for it
  • You can select multiple songs by holding Shift and clicking on more songs
  • Right click on one of the selected tracks
  • Select Export tracks
  • Click [name of your USB drive]
  • A progress indicator on the bottom of the screen shows the progress

Delete songs from USB drive

If you want to get rid of deleted files in Rekordbox, you have to format the drive and export again.
Or delete them one by one from the USB drive in Rekordbox

Rekordbox For Linux Windows 10

Linux
  • select USB drive
  • click on the arrow down next to your USB drive
  • selectall tracks,the playlist or search for the song
  • right click on the file
  • clickdelete track
  • clickokwhen Rekordbox if you are sure if you want to delete the file

Rekordbox For Linux Download

If you are serious about Djing and want to know all the ins and outs, check out my CDJ 2000 video course or my Rekordbox video course.
In both courses I’ll take you by the hand and show you all the features to get the most out of your DJ gig.