Table of Contents
Es un tutorial para instalar un programa de pionner para DJhttp://rekordbox.com/download/download.php?lang=es. Rekordbox Linux, Autodesk AutoCAD Utility Design 2015, Corel WordPerfect Office X7 Professional Edition Trial, How To Intsall Microsoft Visual Studio 2008 Professional.
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.
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:
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
About Rekordbox
Pioneer's Rekordbox is one of the top commercial DJ software in the market. Beside preparing and managing your music files for DJ sets, you can play your sets live with your own Pioneer controller.
Offical support by Pioneer
Officially there is no Linux support from Pioneer. There may not be a large enough market for the additional support and engineering effort required. But Pioneer pushes it a bit farther. Discussing Linux support or compatibility is not allowed on their official forums and threads get closed.
The holy law of the pioneers permits thinking of Linux
Furhtermore, they try to detect if you are running Rekordbox in Wine to stop it.
Why Linux
In my personal opinion, I simply do not want to reboot just to do some DJing. It is possible to run Rekordbox in a virtual machine but I think the energy consumption on a laptop is higher this way. BUT running in a VM has other benefits regarding the trial mode by using snapshots ;).
I bought a license because it was worth it for me and I simply want to run Rekordbox in Linux as well.
How to run Rekordbox in Linux
In my setup, I am using the ArchLinux distribution. Some details may differ for you but the concept is the same.
The first thing you need to install is the latest wine-staging package. You can either check, if your distribution has it in their repository or you can compile it on your own. In ArchLinux the package is called wine-staging
.
To install Rekordbox, you simply run the official installer with Wine and install in the default or a custom location. After the setup, you have to run the rekordbox.exe
binary in the installation directory.
Change into the folder where rekordbox is installed and run the binary with Wine from there. Somehow it does not start when you do not run it within the same folder and it ends with 'Unexpected application error' .
Even after this, it will still not get past the registration screen because Rekordbox is Wine aware and does some buggy stuff under the hood.
Rekordbox Para Linux
Unexpected errors stopping us from using Rekordbox
To solve this problem, we have to hide Wine from Rekordbox. A way to detect Wine is by checking the exports of ntdll
and check for the function wine_get_version
. In that case, the system is using Wine. With wine-staging we can disable this. Run the winecfg
utility and go to the Staging tab. There you have to enable the radio button next to Hide Wine version from applications.
Rekordbox Alternative Linux
Disabling Wine version in winecfg
If you run Rekordbox now, you may miss some fonts in the user interface. To solve this install corefonts by using the command winetricks -q corefonts
.
Rekordbox finally running in Linux
Rekordbox Linux Operating System
Now we can run Rekordbox for the first time. There are still some bugs and unsolved problems. For example, if you move the mouse cursor to the bords of a dialogue button, the dialogue starts moving. Another unsolved problem is the usage of USB sticks. USB sticks are not detected the same way as on Windows.
I hope you guys like this small tutorial. Some people on reddit were messaging me already for this.
If you just want to debug the problems without using your own license, you can simply remove the ~.wine
folder and reinstall Rekordbox with the installer.
Rekordbox For Linux
In our next blog post, I will show you how you can use your Pioneer controller in Linux with Rekordbox.
Relevant resources
- https://bugs.winehq.org/show_bug.cgi?id=45514
- https://bugs.winehq.org/show_bug.cgi?id=45535
- https://bugs.winehq.org/show_bug.cgi?id=45543