Deep-Symmetry / dysentery

Exploring ways to participate in a Pioneer Pro DJ Link network
Eclipse Public License 1.0
196 stars 24 forks source link

Updates related to Link NFS/DeviceSQL Implementation #5

Closed Fraeyon closed 6 years ago

Fraeyon commented 7 years ago

Hello there ! Since i am working like people there to discover all of Pioneer ProDJ Link's hidden secrets I decided to participate to this projet by bringing you some thoughts I have about how Pioneer CDJs/ Rekordbox are exchanging data through NFS implementation.

First, to introduce myself briefly I am a French engineering student involved in an association bringing to students live DJing, light shows and sound services all across the region. One day, some of our light technicians wondered if we were able to visualize in realtime what the DJ is doing on the players to sync perfectly our light show and that's how I started working on the Link protocol, at least a year ago now. The ideal would be to be able to get track's waveform and current play position within track.

Then I discovered this GitHub repo and by reading all of your analysis PDF I was surprised by the quality of the work, and this document helped me going further in my exploration of the protocol by lighting some shadowy areas of packet content I didn't understood.

And as I'm really close to achieve what I wanted to do (remember, get live waveform data from playing CDJs) I wanted to share some discoveries and thoughts I have about how the whole process works. So let's go !

Raw capture : [5173707431576d4a4f4c]1043444a2d323030304e58533200000000000000000100[DD]0000 [DD] is the 1-byte requesting player ID

raw capture : [5173707431576d4a4f4c]172656b6f7264626f78000000000000000000000001011101041101000000410053005500530050004900450052005200450054004800490042000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 This capture contains two string fields in the data : the first is 'rekordbox' and the second one is my computer's network name.

Raw capture of the '00 00 request : [11872349ae11][fffffffe][1000000f]01140000000c060000000000000000000000[1100000003]

Raw capture of the '00 00' request corresponding acknowledge response : [11872349ae11][fffffffe][1040000f]02140000000c060600000000000000000000[1100000000][1100000011]

Raw capture of the 192 bytes "magic packet" : 5173707431576d4a4f4c0672656b6f7264626f780000000000000000000000010111009c000000110000000400720065006b006f007200640062006f007800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000001010000000000000000000000000000000000000000

Raw disconnect packet : [11872349ae11][fffffffe][1001000f]00140000000c000000000000000000000000

Raw capture : [5173707431576d4a4f4c][19][72656b6f7264626f780000000000000000000000]010111003411000000110401[000000000f]00000032000000000000000000000000000000000000000000000000000000000000000000000000 Where 0000000f is the requested track rekordbox ID.

Being a little rush about writing this document I know some points may be unclear, don't hesitate to contact me and I will be able to give more details about my findings. I'm also working on the JAVA version of a Pioneer Link library to support my original software.

In the hope you'll find this findings useful enough to take the job further ;D , Yours,

HunterDKS

brunchboy commented 7 years ago

Hello! Thank you so much for writing this, it is always delightful to find more people doing research about these topics, especially when they are willing to share. I probably won’t have time to explore this information in detail until the weekend, but I can already see there are some interesting new discoveries here. It was fun to see you explain the UDP packet that causes a CDJ to load a track, I had always been a bit curious about that.

I would love to learn the details of the track waveform files! Have you seen the user interface that my own lighting software draws on the graphical display of the Ableton Push 2 controller? You can see an animated capture of it on this page if you scroll down past the large photograph. It would be amazing to be able to replace the metronome graph on the left with waveforms from the master CDJ.

Also, did you look at beat-link as a starting point for your own Java Link library? It has a fair bit of features already, and its license should be compatible with whatever use you want to make of it. (Although I would very much appreciate pull requests for things like adding waveform retrieval! 😁) And have your light technicians played with beat-link-trigger at all? I’ve had people use it at music festivals and big clubs around the world to synchronize visuals, and even had some headlining artists use it to synchronize synthesizers with tracks on their CDJs.

Finally, I have been very careful to not try to implement or document any sort of access to the music data itself. I think that if people start doing that, and big DJs and record labels hear about it, they will start fearing their music is in danger of being stolen, and will pressure Pioneer to encrypt the protocol, which will completely destroy our ability to do cool things like synchronizing our light and laser shows, visuals, and synthesizers to it.

Fraeyon commented 7 years ago

Hi there !

Yep, I already tried your software and found it very nice ! But I believe none of our light techs played with beat-link-trigger already, I'll show them to see if they're intersted ^^

I didn't got any time this week to implement my fidings further in my experiments to comfirm all of them but I have some time now to give you more details about Rekordbox anaylsis files, containing all data about tracks (including waveform, quantize data, ...).

When a CDJ player or Rekordbox analyses a track, one or two analysis files are created in a "PIONEER" folder located at your USB stick root (if analyzed by a player) or in your computer's user data (if analyzed on Rekordbox). One file will be named "ANLZ0000.DAT". There may be a ".EXT" file created along with the ".DAT" file but it will be created only if you perform a complete voice analysis on the track (leading to colored waveforms on CDJ's screen).

Both files are organized the same way : by tags. The standard tag format for Pioneer analysis is defined as follows :

TAG = [TAG NAME][TAG HEADER LEN][ > DATA < ]

Note : in the tag, numbers are all big endian.

TAG NAME is a 4-byte field containing one of the following names, describing tag content :

TAG HEADER LEN is a 4-byte integer containing tag header length. Both fields are common amongst all tags.

Tag-specific details :

Here is all I know about the analysis files. Many details are still unknown to me but I guess it should not be hard to determine each remaining parameters in PCOB, PVBR and PQTZ fields. However, that should be enough to get usable waveforms as they are sent through DeviceSQL queries !

Regarding music data itself I'm not intersted in it too and will not describe precisely how to obtain it, but there is a risk some other people will eventually find that by themselves. In that case we should warn explicitly people not to try to obtain it =)

marek-memsql commented 7 years ago

@HunterDKS Great analysis! About a year ago I have been messing with this data and was able to "redraw the waveform" on the cdj to look like I wanted to look just by editing the file etc. but as the details about the pro link were not know yet, I had no use for it, I gave up and did not continued... :-(

Seems like all we need now is to decipher a firmware file :-DD

brunchboy commented 6 years ago

Just an update, because I forgot to mention it here when many of these things happened, but there has been huge progress on a lot of these fronts, and we have all the metadata working through the DeviceSQL interface (as long as there are less than four CDJs using a particular media store), and I am currently working on parsing the raw export.pdb database, so that can be retrieved via NFS and worked with directly for situations where there are four players in use.

brunchboy commented 6 years ago

And my new Crate Digger library is finished and working, and being used to fetch and parse export.pdb databases and track-analysis .DAT and .EXT files, so all of the metadata can be obtained even when there are four players on the network. There is a preview release of Beat Link Trigger that uses it, and people are testing it. Once everything looks good, I will publish a release of Crate Digger to Maven Central. Thanks again, everyone, for all these insights and ideas!

brunchboy commented 6 years ago

@Fraeyon I just saw what you said about having the full spec for the waveform data. Do you know how to draw the color waveforms? That is something I have not yet figured out, and would love to be able to do it.