FK~

Moje odkazy

Ostatní odkazy

Close Windows
Nenajdete mě na Facebooku ani Twitteru
Rozpad EU
Jsem členem FSF
There Is No Cloud …just other people's computers.
Sane software manifesto / Manifest příčetného softwaru

Pioneer DJ DJM-250MK2 support in the Linux kernel

vydáno: 3. 8. 2020 23:59, aktualizováno: 18. 1. 2021 23:46

I am the author of the patch that adds partial support for the Pioneer DJ DJM-250MK2 in the Linux kernel. The MIDI and PCM output (from computer to the sound card) work.

Pioneer DJ DJM-250MK2 – rear connector panel

Back then, I was not sure about the quality of the phono amplifier and I was unable to make this mixer fully working in GNU/Linux, so I returned it to the seller and took Reloop KUT instead (which works out-of-the box and the audio quality seems great).

Later I got some inspiration and now I think, that I might be able to make the DJM-250MK2 fully working – including the inputs (from the mixer to the computer), that are important for recording and for vinyl control (DVS, e.g. in Mixxx). I could buy it again and do the development and testing, but I am already satisfied with my Reloop KUT, and the DJM-250MK2 would cost me about 450 USD.

I am not asking for money in advance, but I need to know, whether there are people willing to share the costs and not only the profit. Do you use DJM-250MK2? Are you interested in running it under GNU/Linux? Would you financially support it, if I make it working?

Update 2020-12-20: I have bought a new DJM-250MK2 myself and improved the kernel support. For now, I have done three patches: 1 (playback), 2 (recording), 3 (channel configuration through standard ALSA API and alsamixer – mapping playback and capture channels to available sources). Really challenging was to enable recording directly from LINE/PHONO channels while simultaneously playing CH1 and CH2 from computer (this setup is needed for DVS and timecode signals). This requires some magic – very helpful was the page Pioneer CDJ HID Analysis that pointed me to the proper hash function (according to the constants, it is bit uncommon but publicly known Fowler–Noll–Vo hash function, FNV) and some magic bits. I wrote a standalone C++ program that talks with the mixer over MIDI SysEx messages and does the magic. The code needs some clean-up, but it works and I will publish it soon. I will also try to integrate this feature into Mixxx and maybe in the Kernel. For now, enjoy the screenshots and stay tuned…

Pioneer DJ DJM-250MK2 working under GNU/Linux with Mixxx

Pioneer DJ DJM-250MK2 working under GNU/Linux with Mixxx

Pioneer DJ DJM-250MK2 working under GNU/Linux with Mixxx

Pioneer DJ DJM-250MK2 working under GNU/Linux with Mixxx

Update 2021-01-04: I have improved the djm-fix program a little bit and published it. Please test it and confirm whether it works for you or report bugs. You will probably need a custom kernel build containing the abovementioned patches. I recommend checking out the cdc01a1558de version (from torvalds tree at kernel.org). Then install some necessary packages (in Debian or Ubuntu – it will be similar in other distributions):

apt install mercurial make pkg-config g++ libasound2-dev

Download the djm-fix source codes:

hg clone https://hg.frantovo.cz/midi/djm-fix/        # primary source
hg clone https://hg.globalcode.info/midi/djm-fix/    # or use this mirror

Compile it:

cd djm-fix
make

And run:

make run                        # in most cases
build/djm-fix 'Pioneer DJ.*'    # or provide custom name pattern (regular expression)
                                # to select the proper card

If everything goes well, you should see output like this:

$ make run 
mkdir -p build
g++ -o build/djm-fix DJMFix.cpp AlsaBridge.cpp Logger.cpp djm-fix.cpp -fno-omit-frame-pointer -fsanitize=address -g -lpthread $(pkg-config --libs --cflags alsa)
build/djm-fix
2021-01-04T18:35:08+0100     INFO:  DJM-Fix started.
2021-01-04T18:35:08+0100     INFO:  Looking for available cards:
2021-01-04T18:35:08+0100     INFO:   - card: #0: 'HDA ATI SB at 0xfeb00000 irq 16'
2021-01-04T18:35:08+0100     INFO:   - card: #1: 'HDA ATI HDMI at 0xfea40000 irq 71'
2021-01-04T18:35:08+0100     INFO:   - card: #2: 'Pioneer DJ Corporation DJM-250MK2 at usb-0000:00:12.2-3, high speed' [matches]
2021-01-04T18:35:08+0100     INFO:  Going to fix card #2
2021-01-04T18:35:08+0100     INFO:  Sent greeting message.
2021-01-04T18:35:08+0100     INFO:  Received greeting message.
2021-01-04T18:35:08+0100     INFO:  Sent message with seed1.
2021-01-04T18:35:08+0100     INFO:  Received message with hash1 = 96c6feef and seed2 = 0cca3a09
2021-01-04T18:35:08+0100     INFO:  Verification of hash1 was successful.
2021-01-04T18:35:08+0100     INFO:  Sent message with hash2.
2021-01-04T18:35:08+0100     INFO:  Received acknowledgment message. Started sending keep-alive messages. LINE/PHONO channels should work now.
2021-01-04T18:36:08+0100     INFO:  Still sending periodic keep-alive messages (each 200 ms).
2021-01-04T18:37:08+0100     INFO:  Still sending periodic keep-alive messages (each 200 ms).
2021-01-04T18:38:08+0100     INFO:  Still sending periodic keep-alive messages (each 200 ms).
2021-01-04T18:39:08+0100     INFO:  Still sending periodic keep-alive messages (each 200 ms).
2021-01-04T18:40:08+0100     INFO:  Still sending periodic keep-alive messages (each 200 ms).
^C
2021-01-04T18:40:30+0100     INFO:  DJM-Fix stopping.

This tool must be running all the time you want to record from LINE/PHONO or do DVS, because it sends keep-alive messages to the mixer each 200 ms. When stopped, the mixer will silence the LINE/PHONO again after circa one second. To stop the program, just press Ctrl+C.

There are still some tasks, that will be resolved:

$ relpipe-in-todo | relpipe-out-tabular 
task:
 ╭────────────────┬────────────────┬───────────────┬────────────────────────────────────────────────────────────────╮
 │ file  (string) │ line (integer) │ type (string) │ description                                           (string) │
 ├────────────────┼────────────────┼───────────────┼────────────────────────────────────────────────────────────────┤
 │ DJMFix.cpp     │            177 │ TODO          │ graceful death                                                 │
 │ DJMFix.cpp     │            190 │ TODO          │ methods for parsing and constructing messages from parts (TLV) │
 │ AlsaBridge.cpp │             89 │ TODO          │ poll                                                           │
 │ AlsaBridge.cpp │             93 │ TODO          │ multiple messages combined together?                           │
 │ AlsaBridge.cpp │            115 │ TODO          │ do not use raw/exclusive access to the MIDI device             │
 ╰────────────────┴────────────────┴───────────────┴────────────────────────────────────────────────────────────────╯
Record count: 5

but the tool should already do its job (if not, try multiple times and let me know). Now I am waiting for your feedback and evaluating implementations in the Kernel and Mixxx in order to get rid of the need to run a standalone tool (both approaches has its pros and cons: the Mixxx controller mapping will be platform-independent – while the Kernel patch will make this device just work with any GNU/Linux application).

n.b. this device supports only one frequency: 48 000 Hz, so be sure you set it in your software (Mixxx, JACK etc.).

Contact: franta.djm250mk2@a.frantovo.cz

Komentáře čtenářů


MixB, 5. 1. 2021 14:27, Thanks for the shoutout [odpovědět]

Hey there, I'm the author of the protocol reverse-engineering efforts you mentioned in your 2020-12-20 update. Thanks for giving my efforts a shoutout and using my work to bring linux support to more pioneer devices. I updated the paragraph on the hashing function with accordingly, pointing out that the function is not of pioneers design but FNV-1a. I gave you shoutout in my doc as well (https://mixb.me/CDJHidProtocol/hid-analysis/startup.html#_thanks), I hope you don't mind. Have a good one. :)


long John, 3. 10. 2021 11:01, routing of output channels 7-8 [odpovědět]

Hi František, I am looking at mixers with digital outputs and these are often sold 2nd hand fairly inexpensively so your work is really useful, thank you! I have a question: So, there are 8 outputs (from computer to sound card). Where do channels 7-8 go? It looks like they are normally used for FX return, or do you get another 2 channels mixed in? also does the AUX trim knob work for channels 5-6?


MixB, 6. 12. 2022 17:26, New link [odpovědět]

fyi the domain got squatted so its currently being hosted here: https://swiftb0y.github.io/CDJHidProtocol/

Přidat komentář

reagujete na jiný komentář (zrušit)
jméno nebo přezdívka
název příspěvku
webová stránka, blog
e-mailová adresa
nápověda: možnosti formátování
ochrana proti spamu a špatným trollům

Náhled komentáře