DJL COMPILER
Make yourself .DJL files/styles for Ketron MidJay
As many other people that just bought Ketron MidJay - I also need very much the DJL Compiler by Ketron (as written in the Ketron MidJay's Manual). Actually Ketron already developed this software and it is called "DJL ver. 1.00", but unfortunately it is not available yet for download, so I decided to find out how to make myself these .DJL styles/files.
After a serious research, I finally discovered the .DJL file format - it is a normal 16-bit/Stereo/44.1kHz .WAV file, on top of which is added a header with some system information. Before we start – you’ll need to arm yourself with a bunch of programs that you’ll need during the process of making .DJL files.
- The first and most important program you’ll need is a simple hex editor. You can find many on Internet and most of them are freeware. A used the XVI32 hex editor. You can find and download it for free at: www.chmaas.handshake.de;
- You will also need the Calculator program (from the Windows accessories), but switched in scientific mode, where you can exchange numbers from Hex to Dec system;
- The last thing you’ll need is an audio (.WAV) file editor that can show you the timeline in samples mode (!!), not hh:mm:ss or some other mode.
Well, let’s start with the explanation of the structure of the .DJL file.
Once you understand it – it will be easier for you to figure it out how to compile your own .DJL file. I should also say, that I was well prepared for this task (examining the .DJL format), cause long time ago I had to make a .PIC files de-compressor (for the old Picture Maker program .PIC files). And that was a difficult task – to find the compression method of totally unknown file type, and then make the de-compressor for it.
First when I opened an original .DJL file (one from the original files coming on the Ketron MidJay’s hard-disk; N.B. - just rename the file before you open it – for example - 6_8Blues.djl you have to rename like 6_8Blues.wav before you start) I noticed the header block of data (in the beginning of the file) big 2560 bytes (in HEX numbers – 0A00 bytes, you can use the calculator to calculate it). There were some words among the symbols that make sense – “Intro (master).wav”, “A (master).wav”, “B (master).wav”, “C (master).wav”, “D (master).wav”, “Fill (master).wav”, “Break (master).wav”, “End (master).wav” and some others. So, somewhere there I figured out should be the certain information about the location of these parts. But still there were lots of bytes with different numbers around the part names, so it wasn’t so easy to figure it out where and how the exact numbers/pointers were placed and format was use for them. Not less – I didn’t know exactly what kind of addressing method was used – the old type [segment]:[offset] or the new platforms 32 bit addresses (4 bytes addresses). Anyway, after some time of looking at the digits and trying to figure it out – I finally discovered as follows:
The tempo of the .DJL is written in 8 bytes with start byte with address 80 (HEX). In the file it looks like 78 00 00 00 78 00 00 00. The tempo should mach the exact tempo of the loops included in the .WAV stream. And you see the tempo is written twice in the file (in groups of 4 bytes) and of course backwards!! Actually when you read the bytes backwards 4-by-4, they look like 00 00 00 78 and 00 00 00 78. And the value 78 (HEX) is exactly tempo 120 (DEC).
From byte with address 290 (HEX) in the file (in a block of 16 bytes) is written information about the type of the wave stream. In the file 6_8Blues.djl these bytes look like:
02 00 00 00 44 AC 00 00 00 00 00 00 10 00 00 00
You have to read these bytes again backwards and 4-by-4. The first 4 bytes 00 00 00 02 show the type of file – STEREO (02) or MONO (01), in this case is stereo, the next 4 bytes 00 00 AC 44 shows the sample rate – in this case AC 44 (HEX) = 44.100 kHz (DEC). The last 4 bytes has the value 10 (HEX) = 16 bit (DEC). So, in our case the file info is 16 bit/Stereo/44.1 kHz wave stream. Then:
Just before every line like: “Intro (master).wav”, “A (master).wav” etc. – there are 8 bytes of information about the location of the certain part. So, the first 4 bytes are the start point of the part, and the second 4 bytes are the duration (how long the part is – written in bytes). So, in the original file they looked like this for example (the 6_8Blues.djl file):
… 00 0A 00 00 00 96 04 00 Intro (master).wav …
The thing is - what the numbers are showing. The answer I found is:
The first 4 bytes show the start position of the part (in this case - the Intro part), but the bytes are placed in the file backwards (!!!!) The start position actually is not 00 0A 00 00, but it is 00 00 0A 00. Then - the duration of the part is not as you see it on the screen – 00 96 04 00, but 00 04 96 00 (remember that very well, cause after you have to fill these numbers yourself when you make your own styles). Just you have to read every 4 bytes backwards:
![]()
00
0A 00 00 00 96 04 00 Intro (master).wav
This is the way you should read the value of these pointers for each part – Intro, A, B, C, D, Fill, Break and End in the header of the .DJL file.
So, the real audio data in the this file starts at address 0A00, or just A00 (in HEX system, which in DEC system is 2560th byte of the file) – just after the header. Anyway – this doesn’t mean that the Intro part starts immediately after the end of the header. The real thing that matters is – where in the data area in the file the Intro pointer points at (what values you have for start and duration). Each part can starts in random position in the file. The wave parts in the wave file don’t even have to be placed sequentially – Intro, A, B, C etc. They can be placed in random order. The real thing is how you will setup the pointers for these parts, so when the Ketron MidJay loads the .DJL file in the memory, the positions written in the file for the parts have to be set right. Anyway – in the .DJL can be place wave data that you don’t need and if you don’t have to use it or if you don’t want to – just don’t point at it with the part pointers in the file.
You have to know, that when you open this .WAV/.DJL file with a wave editor program like Cool Pro (and make sure that the rulers are set on SAMPLES, so in the time line you see samples, not time format like HH:MM:SS or something else), the exact position of the start of the audio data will be not the 2560th sample, but 640th sample, because 1 sample contains 4 bytes (32 bits – 16 bits for each channel – L and R of the stereo wave). So, when you mark the zone of the INTRO part (in Cool Pro), you can see on the bottom right on your screen (for Cool Pro) also the duration of the part in samples, so you can recalculate it from samples to bytes (multiply the samples number of 4 and you’ll have the exact address position in bytes), then convert it with the calculator into HEX system and the put it backwards in the header of the file.
So, let’s explain now how to make a custom .DJL file.
Make your own .WAV file with loops and sounds that you wanna use for all parts – Intro, A, B, C, D, Fill, Break and Ending in the .DJL file. Save it somewhere like a normal .WAV file. I already extracted a file that contains the exact header that you will need for the .DJL file.
Open now your own made .WAV file with the hex editor. Click with the mouse on the first byte from the file you see on the screen (the first byte from the file itself). From the menu of the hex editor choose INSERT. Then find the location of the file HEADER.HEX that I extracted and insert this file in the beginning of the wav file you made. Then save the wav file with the header already added in the beginning of it.
Now open the .WAV file with Cool Pro or other wave editor (and set the rulers in samples mode for the timeline). Click at the beginning of the first part that you want to be INTRO, then mark the zone for this part. See on your right bottom where the part starts and what is it’s duration. Write down somewhere these values (in samples as shown on the screen). Do this for each part of the style. When you are ready with finding each part location and duration, you have to multiply the values of 4 and you will have this locations and durations in bytes values. Then convert these values with the calculator from bytes (DEC system) to HEX system and write the values again somewhere.
Then again open the .WAV file, but this time with the hex editor. Find in the file’s header the places you have to rewrite the values of the Intro, A, B etc. parts (every 8 bytes before the words: – “Intro (master).wav”, “A (master).wav”, “B (master).wav”, “C (master).wav”, “D (master).wav”, “Fill (master).wav”, “Break (master).wav”, “End (master).wav”. Just be sure that you place the numbers backwards, as I explained above.
For example:
If the start position of the Intro (shown in Cool Pro in samples) is 968th sample – you have to multiply 968 x 4 = 3872 (to find the exact address of the part in bytes - because 1 sample = 4 bytes - in 16 bit/stereo wave files). Then you have to convert it from DEC to HEX system and 3872 (DEC) is F20 (HEX) or 0F20 (in the format you will exactly need it).
If the duration of the Intro part (shown in Cool Pro in samples) is 45.000, you have to multiply 45.000 x 4 = 180.000 (DEC). 180.000 converted to HEX counting system is 2BF20, or 02BF20 to fulfill the bytes 2-by-2 digits (like 02 BF 20).
Now you have to generate the line for the Intro in the file. And because the pointers for start and duration have to be 4 bytes you have to fulfill with zeros (00) if the number is smaller – for example 0F20 have to become 00000F20 and 02BF20 have to become 0002BF20. Now you have to overwrite the values in the file but backwards, so the line for the Intro part will look finally like this:
20 0F 00 00 20 BF 02 00 Intro (master).wav
Now you have to put the same way the values for the rest of the parts of the style and after you have to safe the file with the changes made. Then rename the .WAV file to .DJL file and - CONGRATULATIONS - you have made your own .DJL file! Copy it to the Ketron MidJay's hard-disk in the directory with the other .DJL files and use it!