sysex again, it´s geting complicated...

Discuss Lemur and share techniques.
dbk
Regular
Posts:98
Joined:14 Dec 2011 11:35
sysex again, it´s geting complicated...

Post by dbk » 11 Jan 2012 21:44

Hello,

the guys from elektron gave me pdf with the sysex documentation for the machinedrum.

so, i thought, i could fetch the current used machines and add a very important feature to the machinedrumcontroler, the ability to disaply the names of the tracks on the lemur.

however, it´s damn complicated and the data seems to be coded and needs to be decoded. i tried several things but didn´t come close to a solution.


i really hope one of you guys jumps in and gives me a proper hint on how to achieve my goal.

i allowed myself to attach the pdf with the informations, it´s sorta french to me ...

the infos i´d like to retrieve from the machine are on page four, especially "kitname' and 'selected drum model'.

thanks a lot in advance, ANY tip is really apprechiated.


cheers, martin
Attachments
md1_53-sysex-0_8.zip
Machinedrum sysex documentation
(58.75KiB)Downloaded 385 times

Macciza
Regular
Posts:1325
Joined:07 Dec 2011 04:57
Location:Sydney, Australia.

Re: sysex again, it´s geting complicated...

Post by Macciza » 12 Jan 2012 01:07

Hi
Yeah - sysex can get complicated . . .
And they certainly did not do any favours in there sysex steup - seems slightly non-standard to my eyes . .
The 8-bit encoding stuff is a bit weird but I do recall seeing it previously somewhere, and there checksum/length methods are a bit weird too . . .

Also it is usual that info is provided for 'requests' to the midi device and also for 'returned data' - I don't see any request info?

Once you sort how and when the device sends the 'Kit Message' data - whether by request or automatically from device? -
You need to capture the sysex via an 'OnMIDI - System Exclusive' script matching the MachineDrum header and Kit message data . . .
You then need a subarray of that data from position 0x0A - 16bits long = KitName - which needs to be convert with arraytostring to display as text rather than ASCII numbers

Selected Drum Model seems to be a data structure within the message -16*4byte ints - but I am not sure what the data is meant to represent . . .

Hope that helps

Cheers
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]

dbk
Regular
Posts:98
Joined:14 Dec 2011 11:35

Re: sysex again, it´s geting complicated...

Post by dbk » 12 Jan 2012 09:38

Hi,

I´m that far to request the current kit data (which should include all of the kit data from the pdf) and to use the Monitor to display it on the lemur.
Selected Drum Model seems to be a data structure within the message -16*4byte ints - but I am not sure what the data is meant to represent . . .
This data is meant to represent the current loaded machine on all 16 tracks, should look a lot like this:

Code: Select all

112,4,76,86...
each of the values are the code for a "machine", there´s a sheet where you see what machine has what number, as soon as i have them numbers accessible i could write a script which outputs the name of the machine (for example: TRX-BD) compared to a number, should be easy.


how do i know what position in the sysexstring holds this values ?

thanks you, your help is very apprechiated!

cheers

dbk
Regular
Posts:98
Joined:14 Dec 2011 11:35

Re: sysex again, it´s geting complicated...

Post by dbk » 12 Jan 2012 19:02

Hey,

with the arraytohex(array) script posted by mbncp (thank you), i was able to get the following data, which should represent the sysexdump i needed to get.

Code: Select all

00 20 3c 02 00 52 04 01 0B 4E 45 57 20 4B 49 54 00 30 12 00
01 is the end of the header data, according to the elektron sysex sheet 45 should hold 16 values representing my machines on the 16 tracks, if i´m right, once it´s 'unpacked', so they say in the manual.

so, assuming i´m right, how to "unpack" this data?

again, more than thankfull for any hints, code, whatever could help me :)

cheers,
martin

mbncp
Regular
Posts:87
Joined:08 Dec 2011 07:25

Re: sysex again, it´s geting complicated...

Post by mbncp » 12 Jan 2012 20:26

I think that they don't want you to fool with sysex, so they made it as difficult as possible ;)

Well, first you need to convert the blue part to 8 bits as it is coded in 7 bits. Most machines work with 8 bits (or 16,32,..) but for the MIDI spec all values larger than 7 bits are status byte, so you can't use them. The trick is to convert to 7 bits and back to 8 by using an extra byte that has the 8th bit value for the 7 following bytes.
I think bitwise operators are working on the lemur so that should be ok, so a function script could handle that.

But the problem I see here is the length of the data, I'm not even sure that the Lemur receives or can handle such big sysex message. Remember you figured out that the largest array size is 255 bytes. Are you receiving multiple arrays ?

And how do you get the data, is there some parameter request function ? As it doesn't seem documented on that pdf. Or do you have to trigger some function on the MD ?
On Korg machines you can query a single parameter which would be easier to deal with. Don't know about the MD.

dbk
Regular
Posts:98
Joined:14 Dec 2011 11:35

Re: sysex again, it´s geting complicated...

Post by dbk » 12 Jan 2012 20:45

hey, thanks for joining.
Well, first you need to convert the blue part to 8 bits as it is coded in 7 bits. Most machines work with 8 bits (or 16,32,..) but for the MIDI spec all values larger than 7 bits are status byte, so you can't use them. The trick is to convert to 7 bits and back to 8 by using an extra byte that has the 8th bit value for the 7 following bytes.
I think bitwise operators are working on the lemur so that should be ok, so a function script could handle that.
oh, i think that´s what they reffering to on page one, how the 7 bit encoding is generated?
But the problem I see here is the length of the data, I'm not even sure that the Lemur receives or can handle such big sysex message. Remember you figured out that the largest array size is 255 bytes. Are you receiving multiple arrays ?
i´m not sure either, that´s what i´ve read on the web. i will contact the support and ask for clarification on this. would be a major bummer. mail sent.
And how do you get the data, is there some parameter request function ? As it doesn't seem documented on that pdf. Or do you have to trigger some function on the MD ?
i send, what they call, a kit request. it´s a sysey string where i also send the number of the kit i want to have the data from. once i´ve send the request the machinedrum responds with an array of roughly 30 values in an array.

there´s actually an other option called kit sysex dump.

after 0x52 it requests Kit Data Bytes to be sent, any idea what that could be? maybe that´s how we could query single values?

cheers,
martin

edit: i attached a screenshot from the sysexpart in the manual.
Attachments
sysexscreen.zip
sysex screenshot
(13.41KiB)Downloaded 344 times

mbncp
Regular
Posts:87
Joined:08 Dec 2011 07:25

Re: sysex again, it´s geting complicated...

Post by mbncp » 12 Jan 2012 21:17

i send, what they call, a kit request. it´s a sysey string where i also send the number of the kit i want to have the data from. once i´ve send the request the machinedrum responds with an array of roughly 30 values in an array.

there´s actually an other option called kit sysex dump.

after 0x52 it requests Kit Data Bytes to be sent, any idea what that could be? maybe that´s how we could query single values?
Do you have the doc concerning these request sys messages ?

Don't know what they mean by after, but 0x52 seems to be the Kit Message, declared in the header.

dbk
Regular
Posts:98
Joined:14 Dec 2011 11:35

Re: sysex again, it´s getting complicated...

Post by dbk » 12 Jan 2012 21:25

Don't know what they mean by after, but 0x52 seems to be the Kit Message, declared in the header.
you´re right! Sadly i don´t have any more documents then the manual with all available sysex commands and the pdf attached in my first post :|

i tried to send the 0x52 command, the machinedrum receives but doesn´t send back anything then.

how would you go from here?

edit: added a picture of the lemur with the values sent from the MD
Attachments
Screen.PNG.zip
received string from kit request
(30.8KiB)Downloaded 312 times

mbncp
Regular
Posts:87
Joined:08 Dec 2011 07:25

Re: sysex again, it´s geting complicated...

Post by mbncp » 12 Jan 2012 22:22

Ok, got it, all sysex commands are listed in the manual in appendix C. Kit dump command is 0x53 and it replies with 0x52.

Anyway, I will go thru that doc to see what's available, create the 7to8bits and 8to7 bits functions on the lemur and some helpers to extract those data.

As I don't have an MD I will probably need you to send me some stuff. Also it would be good to download a sysex librarian so you can send me the files I need to test.
As I think that you're on mac there is this one : http://www.snoize.com/SysExLibrarian/, should be fairly simple to use.

Once the functions are working, I'll post them here for reference, but in the meantime, I think it's better that we discuss and test this stuff off forum.
I'll pm you when I need something, just be aware that it may take a day or two as I'm a bit busy right now, and pray that I'm done before I get my tempest and little phatty ;)

dbk
Regular
Posts:98
Joined:14 Dec 2011 11:35

Re: sysex again, it´s geting complicated...

Post by dbk » 12 Jan 2012 22:35

man, this is awesome!

i´ll supply whatever you need, just let me know and thanks for spending your time with this.

you sure will have some fun with your new toys :)

cheers,
martin

Post Reply