christofmuc / KnobKraft-orm

The KnobKraft Orm - The free modern cross-platform MIDI Sysex Librarian
GNU Affero General Public License v3.0
207 stars 27 forks source link

MKS-80 implementation #98

Open markusschloesser opened 3 years ago

markusschloesser commented 3 years ago

Had the first chance to try out the MKS-80 implementation, it's fantastic! What's especially great is that, in contrast to what the guy from Midiquest was saying, one can remotely import all patches without manual intervention and send them. Amazing work! :-)

Questions:

  1. Is there a way to import also from a memory card?
  2. is there a way to send to a memory card?
  3. the first import I have done, imported 64 sounds, as expected. the memory switch was on "A". Can one send receive to specific banks (internal / A / B )?

(I have a memory card MC-256 - Memory Cartridge from SynthastiX / Waverex, which has 256 banks, https://shop.waverex.de/en/mc-256-memory-cartridge-for-roland-m64-c-compatible-devices.html )

markusschloesser commented 3 years ago

Found a bug, I switched the bank on the MKS80 cartridge and the sounds are clearly different. KK though says "All patches already known to database" when importing

christofmuc commented 3 years ago

@markusschloesser Ok, let me wrap my head around this. The MIDI protocol of the MKS 80 does not allow addressing the cartridge at all. It just allows access to 64 patches.

My expectation would be as yours that when you set the memory switch to "Int" and do a bank request you get the 64 sounds from the internal memory, and when you switch to "A" you get 64 different sounds that are stored in the cartridge. Your modern cartridge adds another switch so you can have multiple banks under the same "A" switch position of the synth.

But our expectations might be wrong given this is an ancient device. It might just be that the use case of the cartridge was only to backup and carry around data especially when you do not have a computer connected (because if you have a computer to backup your sounds to, why even bother with a cartridge)...

I think the MIDI protocol maybe always addresses the internal memory, not the cartridge memory. Are the sounds you get those stored in the internal memory? Another test would be to transfer the sounds from the cartridge into the main memory (details on that in the manual p. 33ff) and then do a dump request, KK should find 64 new sounds.

As my MKS-80 came without a cartridge, I can't test myself.

Andy2No commented 3 years ago

That makes sense. It's how getting to patches on the Yamaha TX802 cartridge works too - sysex transfers only apply to internal memory, but you can manually transfer between internal memory and the currently selected cartridge bank, using the menus via the front panel.

markusschloesser commented 3 years ago

But our expectations might be wrong given this is an ancient device. It might just be that the use case of the cartridge was only to backup and carry around data especially when you do not have a computer connected (because if you have a computer to backup your sounds to, why even bother with a cartridge)... I think the MIDI protocol maybe always addresses the internal memory, not the cartridge memory. Are the sounds you get those stored in the internal memory? Another test would be to transfer the sounds from the cartridge into the main memory (details on that in the manual p. 33ff) and then do a dump request, KK should find 64 new sounds.

Makes sense! Will try it out later, just got the MKS80 back from reapir (one OSC was always out of tune, turns out there was a corroded PCB path)

It's how getting to patches on the Yamaha TX802 cartridge works too - sysex transfers only apply to internal memory...

Didn't even think of that! πŸ™„πŸ˜‚

but you can manually transfer between internal memory and the currently selected cartridge bank, using the menus via the front panel.

Yep, I know, will try it out

jmfreeland commented 3 years ago

First off, let me say thank you for doing this and that I'm already incredibly impressed. I'm also now confused about the structure of the MKS data after successfully importing mine. Does each square contain both one tone and one patch? I tend to think of them as separate data locations, but I could see how they could be done that way given the same number of slots.

Also, is there a way to put an entire bank back to the machine? I'd be interested in trying to find the original factory bank and sending it back. Mine arrived with some middling presets.

Separately, any shot you own an MKS-70? If I wasn't working as much as I am, I'd take a shot at it, but that's entirely unrealistic right now.

Thanks again for this. Being able to backup my MKS-80 patches will be a huge win.

christofmuc commented 3 years ago

@jmfreeland Thank you! Let me try to answer your questions!

  1. The current data setup only allows one data type per synth, and for the MKS80 this is a full data setup of 2 patches (upper/lower) and 2 tones (upper/lower). When sending this to the synth it is 4 messages, and get's stored in the Edit Buffer. It has been awhile since I tested it but to my memory the tones are loaded into the edit buffer, and are used by the patch in the edit buffer, so the reference of the patch to the tone might be ignored for the edit buffer. Thinking about this now I feel I need to do some more experiments!

  2. We currently can't load a bank into the synth, to keep things simple clicking a button sends the current patch (s.a.) into the edit buffer, if the synth supports it, or a dedicated patch slot if the synth has no edit buffer. Building a feature for bank management is on the list for the longest time (#9), but I first want to add generic lists of patches - then a bank is just a special type of list.

  3. Thank you for suggesting! I did some research on the MKS-70 (sadly I don't own one ;-), and it seems that a) the MKS-70 has better sysex capabilities than the JX-10, but still much worse than the MKS-80, which surprises me a bit given the MKS-80 is older. The data structure is similar, but you cannot request the data from the computer but always have to send it from the synth. Apart from that, I could reuse a lot of code from the MKS-80. The format seems to be much easier than the MKS-80, they ditched the memory-saving "tone format" which had the bits all over the place.

  4. I am not sure how much the Vecoven ROM changes the sysex capabilities and if it is worth of integrating it when implementing the MKS-70, or how many have been modded already.

jmfreeland commented 3 years ago

What a thorough response. I will do some experiments on the times as well. I’ve learned my MKS-70 quite well now, but I’m not as fluent on the interface of the 80. Good to know there’s potentially an edit buffer to be saving from.

There are the same tones and patches setup in the 70, as each patch has an upper and lower associated tone. On top of that there’s a unison 2 mode which plays one note an octave lower. Given that each patch can have two tones with their own detune settings plus separate detune settings across tones, plus the chorus, you can really get some wide sounds.

markusschloesser commented 2 years ago

But our expectations might be wrong given this is an ancient device. It might just be that the use case of the cartridge was only to backup and carry around data especially when you do not have a computer connected (because if you have a computer to backup your sounds to, why even bother with a cartridge)... I think the MIDI protocol maybe always addresses the internal memory, not the cartridge memory. Are the sounds you get those stored in the internal memory? Another test would be to transfer the sounds from the cartridge into the main memory (details on that in the manual p. 33ff) and then do a dump request, KK should find 64 new sounds.

Makes sense! Will try it out later, just got the MKS80 back from reapir (one OSC was always out of tune, turns out there was a corroded PCB path)

MS: I finally had some time to spend on sorting and organizing patches for the MKS80. And to confirm, yes, the sysex request always "gets" the internal bank. So copying from the cartridge to internal memory and then requesting again I managed to import 5 banks of patches and also additional banks I had on my computer. Also duplicates were found. So that's very fantastic! πŸ˜€πŸ˜ŽπŸ€—πŸ‘

It's how getting to patches on the Yamaha TX802 cartridge works too - sysex transfers only apply to internal memory...

Didn't even think of that! πŸ™„πŸ˜‚

but you can manually transfer between internal memory and the currently selected cartridge bank, using the menus via the front panel.

Yep, I know, will try it out

Thanks, that worked! See above

Now some things I noticed while spending about 4 hrs on doing that:

  1. As there's no patch names on the mks80, there obviously isn't a possibility to change the name of a preset, which surprised me at first, so maybe have that info in the mks80 info section?
  2. Meta data becomes way more important with that (my first synth using kk without patch names), so I know that you were thinking/working on having meta data shown side by side to a patch. I think this would really make working with "numbers only synths" a lot more convenient, especially as the numbers are not unique iirc? In this case a "meta data name" field
markusschloesser commented 2 years ago

fyi I went ahead and put all knowledge of this issue into a wiki entry https://github.com/christofmuc/KnobKraft-orm/wiki/Roland-MKS-80

markusschloesser commented 2 years ago

I am nearly done building a maxforlive device for the MKS-80. Stage 1 is to be able to edit parameters from Ableton > MKS80, Stage 2 to also parse what's coming from the MKS80 in order to properly show param values AS THEY ARE in the synth. 2 questions:

  1. changing the (upper/lower) TONES is received by the MKS (nice fun fact, the MKS midi-thru's all data that is valid to OUT again, which is a nice way of finding out, if what you send is valid), but the TONES themselves do not change. Does anybody know why?
  2. For stage 2: When I send a program change, the MKS replies with sysex. I though that might be the params and values but not sure as what is coming bacl looks strange 007581F1 2- -- F0 Buffer: 75 Bytes System Exclusive SYSX: F0 00 21 45 7F 00 73 65 6E 64 4D 65 73 73 61 67 65 3A SYSX: 20 70 6F 72 74 3D 30 2C 20 63 68 61 6E 6E 65 6C 3D 31 SYSX: 2C 20 74 79 70 65 3D 70 72 6F 67 72 61 6D 43 68 61 6E SYSX: 67 65 2C 20 70 72 6F 67 72 61 6D 4E 75 6D 62 65 72 3D SYSX: 31 32 F7 in dec: 7700977 2- -- 240 Buffer: 75 Bytes System Exclusive SYSX: 240 0 33 69 127 0 115 101 110 100 77 101 115 115 97 103 101 58 SYSX: 32 112 111 114 116 61 48 44 32 99 104 97 110 110 101 108 61 49 SYSX: 44 32 116 121 112 101 61 112 114 111 103 114 97 109 67 104 97 110 SYSX: 103 101 44 32 112 114 111 103 114 97 109 78 117 109 98 101 114 61 SYSX: 49 50 247 Any idea what that is? The sysex spec (attached) does NOT show any F0 00 21... MKS80syx.txt .

EDIT: Forget about 2. It's coming from the Electra ONE. When changing presets/patch ON the MKS, the sysex messages are what's to be expected (5 messages). Question now is, how to get those when sending a program change, is there an edit buffer request that's working for the MKS?

markusschloesser commented 2 years ago

@christofmuc is the "import edit buffer from synth" implemented for the mks80? Asking because I get no response from the MKS when clicking that button. Also a "recieve manual dump" and then hitting a patch number (11) ON the mks receives the correct 5 messages ( see one entry above), but doesn't store anything. Log shows 00:11:57: Wrong PGR message format, can't determine patch number 00:11:57: Ignoring APR message not preceded by proper PGR message 00:11:57: Ignoring APR message not preceded by proper PGR message 00:11:57: Ignoring APR message not preceded by proper PGR message 00:11:57: Ignoring APR message not preceded by proper PGR message

markusschloesser commented 2 years ago

UPDATE: I have found a couple of old tools, some of them even with the source code (@christofmuc it's GPL do you want it?), that helped me immensely in understanding what's going on and the lingo that Roland used. So for example the "request program buffer" is named by Roland as "Request a file (RQF)", this is: Hex Byte Description


  a   F0         1111 0000      Exclusive Status
  b   41         0100 0001      Roland ID #
  c   41         0100 0001      Operation code
  d  '0n'        0000 nnnn      Unit # : MIDI basic channel, nnnn=0 - 15
                                where nnnn = 0 for channel 1
  e   20         0010 0000      Format type
  f   4D         0100 1101      M : 
      4B         0100 1011      K :
      53         0101 0011      S : - File Name in ASCII
      2D         0010 1101      - :  
      38         0011 1000      8 : 
      30         0011 0000      0 :    
  g  'cs'        0000 0000      Check Sum
  h   F7         1111 0111      End of System Exclusive

So in my case:
HEX: F0 41 41 00 20 4D 4B 53 2D 38 30 00 F7 DEC: 240 65 65 0 32 77 75 83 45 56 48 0 247

Sending that to the MKS-80, the mks replies with what the manual describes as "5.1.3 Data (DAT)", which is 16 messages. From the manual: "Each DAT message consists of 4 sets of the Patch and Tone data. Each data set consists of 62 bytes total --- 39 bytes for Tone Parameters of a number and 23 bytes for Patch Parameters of the same number. These parameters are sent in sequence of the 'Tone Number's and 'Patch Number's. 2 DATs are sent for each 'Bank'. In normal operation, 16 DATs are totally sent for all 'bank's (1 - 8)." Transfer end is then indicated by SYSX: F0 41 45 00 20 F7 (240 65 69 0 32 247)

Questions:

  1. I assume this is ONE patch? And not all of the ones in the current bank? (not sure)
  2. After the intro (F0 41 42 00 20) it continues with 1C (28). I assume all the following are just the actual values of the params?
  3. So after sending a program change, I would then request that program number and parse it. Probably with a bit of delay? How much? (not related to knobkraft, just asking if someone knows)
jmfreeland commented 2 years ago

max

Hi,

Did you ever finish the MaxForLive device? I have a functional editor for CTRLR, but I'd also be interested in something that can pull in the parameters as they are, which I don't think mine does.

Cheers, Josh

markusschloesser commented 2 years ago

max

Hi,

Did you ever finish the MaxForLive device? I have a functional editor for CTRLR, but I'd also be interested in something that can pull in the parameters as they are, which I don't think mine does.

Cheers, Josh

I did, but only stage 1 https://github.com/markusschloesser/MKS-80_M4L There's no way to only request one patch, you can only do a bank request. Parsing that for the one patch that I actually want is a possible option (one tool I found does exactly that), but unfortunately is beyond my M4l skills.

christofmuc commented 2 years ago

I did, but only stage 1 https://github.com/markusschloesser/MKS-80_M4L There's no way to only request one patch, you can only do a bank request. Parsing that for the one patch that I actually want is a possible option (one tool I found does exactly that), but unfortunately is beyond my M4l skills.

I can easily see that. I wrote that code in C++, and that wasn't straightforward!

markusschloesser commented 1 year ago

@jmfreeland the latest version of my m4l device can now parse patches from the MKS80. However make sure to read the info on my repo. Currently only did "Phase 1" where you need to initiate the preset dump on the actual MKS80, but then all dials etc get updated to the real values. Also it gets stored in the Ableton Live project. Unfortunately right now the m4l device expects 5 messages (that's how it arrives from the MKS80, program number plus upper/lower patch and tone), next task is to find a way so that the device can also accept the 4 messages coming from knobkraft (upper/lower patch/tone). But as my max foo is still meh, this could take a while.

markusschloesser commented 1 year ago

Unfortunately right now the m4l device expects 5 messages (that's how it arrives from the MKS80, program number plus upper/lower patch and tone), next task is to find a way so that the device can also accept the 4 messages coming from knobkraft (upper/lower patch/tone). But as my max foo is still meh, this could take a while.

v35 of the maxforlive device can now receive directly from knobkraft, which is fantastic. So you can send from KK, device receives it, updates all dials etc and then sends to the MKS80. @christofmuc do you use Ableton Live? (I don't remember)

The device can also dump its content out (that's what it is doing to the MKS80, so it should also be able to send to kk, but I haven't tested it, yet. Is KK able to receive edit buffer messages? So 4, without program number @christofmuc

christofmuc commented 1 year ago

@markusschloesser I have Ableton Lite, but hardly use it. How is your setup, the M4L pretends to be an MKS80 towards KK?

christofmuc commented 1 year ago

@markusschloesser I looked into the code - currently the PGR message is mandatory. You could just make one up or always send the same program place PGR for KK to be happy, but it seems that needs some rework. I haven't touched the MKS80 code since I wanted to port it to Python - but it has all this beautiful handshake code in it which is only possible in C++ still. Did you checkout the revamped MKS70? It should now also be compatible with V3 bulk dumps.

markusschloesser commented 1 year ago

@markusschloesser I have Ableton Lite, but hardly use it. How is your setup, the M4L pretends to be an MKS80 towards KK?

Live lite unfortunately doesn't include maxforlive

Wrt question: do you mean when receiving? No the device has 2 buttons, one expects 5 messages, the other new one expects 4 messages. After receiving it closes sysex in down again to avoid loops

markusschloesser commented 1 year ago

@markusschloesser I looked into the code - currently the PGR message is mandatory. You could just make one up or always send the same program place PGR for KK to be happy, but it seems that needs some rework. I haven't touched the MKS80 code since I wanted to port it to Python - but it has all this beautiful handshake code in it which is only possible in C++ still. Did you checkout the revamped MKS70? It should now also be compatible with V3 bulk dumps.

Ah OK, thanks for looking! Due to the fact that the device saves its state in the Live project, for me there's no immediate need to be able to send to kk, but shouldn't be too hard to implement. Only problem is screen real estate (and explaining to users), but of course it would be nice to close the loop

christofmuc commented 1 year ago

Yeah, I haven't done anything in M4L obviously.

PGR seems mandatory when receiving/loading sysex for the MKS80.

The MKS70 adaptation now fully supports BLK from V3 and original Roland, and can also convert into APR messages. That I can't test however, sounds may sound wrong :-/

markusschloesser commented 1 year ago

I still have my old Live10 suite (you can upgrade to 11) license lying around (I am a crashologist/beta tester for Ableton since a couple of years). You interested? Would make you a good price 😁

the MKS70 is the next step for me, especially now that Fred has implemented an edit buffer sysex request. But will take a couple of weeks, first I need to properly enjoy the MKS80 with full recall.

jmfreeland commented 1 year ago

@jmfreeland the latest version of my m4l device can now parse patches from the MKS80. However make sure to read the info on my repo.

Currently only did "Phase 1" where you need to initiate the preset dump on the actual MKS80, but then all dials etc get updated to the real values. Also it gets stored in the Ableton Live project.

Unfortunately right now the m4l device expects 5 messages (that's how it arrives from the MKS80, program number plus upper/lower patch and tone), next task is to find a way so that the device can also accept the 4 messages coming from knobkraft (upper/lower patch/tone). But as my max foo is still meh, this could take a while.

Look forward to giving this a try! Big Live user, so definitely applicable. Had my family grow this weekend though, so time may be limited :)

markusschloesser commented 1 year ago

@jmfreeland the latest version of my m4l device can now parse patches from the MKS80. However make sure to read the info on my repo. Currently only did "Phase 1" where you need to initiate the preset dump on the actual MKS80, but then all dials etc get updated to the real values. Also it gets stored in the Ableton Live project. Unfortunately right now the m4l device expects 5 messages (that's how it arrives from the MKS80, program number plus upper/lower patch and tone), next task is to find a way so that the device can also accept the 4 messages coming from knobkraft (upper/lower patch/tone). But as my max foo is still meh, this could take a while.

Look forward to giving this a try! Big Live user, so definitely applicable. Had my family grow this weekend though, so time may be limited :)

Congratulations! πŸ˜ŠπŸŽ‰ Also see "v35 of the maxforlive device can now receive directly from knobkraft, which is fantastic. So you can send from KK, device receives it, updates all dials etc and then sends to the MKS80."

jmfreeland commented 1 year ago

Also see "v35 of the maxforlive device can now receive directly from knobkraft, which is fantastic. So you can send from KK, device receives it, updates all dials etc and then sends to the MKS80."

That sounds amazing. I use KK as a librarian but editing without knowing the existing parameters can be a chore even in the reasonably nice editor that exists. Does this work because of the MKS poor MIDI thru implementation?

markusschloesser commented 1 year ago

Does this work because of the MKS poor MIDI thru implementation?

I'm sorry, I don't understand the question. Could you please rephrase that?

Flow is: kk > M4l device > mks80

JK808909 commented 11 months ago

Hi! ,maybe off topic here... I am not able to import any MKS 80 banks in knobkraft 2.10 via sysex (10:41:43: error Checksum error, aborting!). I was neither able to request banks from the synth. request command worked, but it constantly said "saving" on the display and never finished. any ideas? andromeda and K3m sysex patches work great in the librarian via patches import...thanks so much!!

markusschloesser commented 11 months ago

Hi! ,maybe off topic here... I am not able to import any MKS 80 banks in knobkraft 2.10 via sysex (10:41:43: error Checksum error, aborting!). I was neither able to request banks from the synth. request command worked, but it constantly said "saving" on the display and never finished. any ideas? andromeda and K3m sysex patches work great in the librarian via patches import...thanks so much!!

The mks80 needs bidirectional communication, are you sure that both midi out and in are properly selected in knobkraft?

JK808909 commented 11 months ago

Hi! yes, I expected a handshake and connected motu Out and In respectively (don't know the error message, not in the studio) but I was not even able to import MKS 80 sysex files to KK via the patches "import from files to database" option that worked fine for my other synths...very strange...

christofmuc commented 11 months ago

Hm, that is strange, but as my MIDI interface currently is broken I haven't tested the MKS80 for a while. Can you send me the bank file you're trying to upload? It should work.

And the first thing to check for the bidirectional communication working is to try the autodetect and look at the MIDI log (you can upload that here as well) . Best temporarily disable the other synths (no data in the database will be lost) and activate only the MKS-80, and try an autodetection or the bank download, then let's have a look at the MIDI file.

Also, just to check, make sure the Midi interface is not set to do MIDI filtering. The MKS80 is notorious for echoing MIDI commands and causing MIDI loops, so it might be that MIDI filtering is activated somewhere.

christofmuc commented 11 months ago

Ok, "repaired" my MIDI interface. Finally dug deep enough into the 19" rack to detect a cabling issue.

The MKS80 successful auto detection looks like this in the log for me:


12:57:53.-648: In  Port 8 on MXPXT Sysex [f0 41 40 0f 20 4d 4b 53 2d 38 30 00 f7]
12:57:53.-648: In  Port 8 on MXPXT Sysex [f0 41 4f 08 20 f7]
12:57:54.-648: Out Port 8 on MXPXT Sysex [f0 41 45 00 20 f7]
12:57:54.-648: In  Port 8 on MXPXT Sysex [f0 41 45 00 20 f7]

And you need to make sure the MKS-80 responds to sysex. The MIDI function switch needs to be on roman III as far as I recall!

JK808909 commented 11 months ago

thanks guys. Roman III is selected and my Behringer BCR2000 editor works well with the MKS so I guess sysex should work. will try it again soon with another interface! but I need to store the patches on the synth before sending something in there;) and for the problem B of importing .syx files in KK I attach a file here. there is no error log in KK. import from files into DB just won't work as expected:(

AB Bass 1.syx.zip

christofmuc commented 11 months ago

The file you attached is for a Yamaha, not a Roland. It starts with 0xf0 0x43, which is the Yamaha code if I am not looking at it from the wrong angle?

JK808909 commented 11 months ago

OMG you are right. I bought hundreds of sysex sounds and only one file (the presets) was working, hahaha. 20:19:40: info All patches already known to database. I hope that I can sort out my import problem with the guidance you gave. thanks so much!!!

christofmuc commented 11 months ago

Same happened to me! It was on ebay sound load or some other name, and there were just a few files actually for the MKS-80. Note that I added .m80 and .mks80 import capabilities to the Orm because some older banks are floating around in these simple formats from other long forgotten Librarians. They might or might not work, worth a try. But if you're already setup with a BCR2000, you're good to go making your own! Which Preset do you use?

JK808909 commented 11 months ago

hi Christof, I tried some other things but ended up with the same issue when I tried importing patches from MKS into KK. I attached the log file. my own sysex control patch of BCR and MKS-80_M4L works for changing sounds but won't update the plugin with the values of the synth as well:( Any ideas? thanks so much.

21:11:37: info Found Roland MKS-80 on channel 1 replying on device micro lite Port 2 when sending to micro lite Port 2 on channel 1 21:11:38: info Opening master keyboard device micro lite Port 2, waiting for messages 21:12:04: info Opening master keyboard device Arturia KeyStep 32, waiting for messages 21:12:13: error Checksum error, aborting! 21:12:13: info Retrieved 0 patches from synth 21:12:13: warning No patches contained in data, nothing to upload. 21:12:13: error DATABASE ERROR in putPatchList: SQL Exception FOREIGN KEY constraint failed 21:12:13: info Bank of 0 patches retrieved from database 21:12:13: error Failed to create list! 21:12:13: error Program Error: Invalid synth bank, not stored in database. Can't load into panel

mks80_log..log

christofmuc commented 10 months ago

@JK808909 Sorry I somehow missed your post here! Happy new year!

About the import problem - there is a suspicious SQL exception in the log, the putPatchList should not fail. Also interesting is the checksum error. I can have a look at the MIDI data and see if I can find a problem with that, the SQL exception is hopefully only a follow up error of the checksum problem.

Regarding the bidirectional sync - I am not sure how this works with the plugin, @markusschloesser might have more insights? To have the BCR2000 reflect the current patch, you normally need to send it the update messages, and I think that doesn't work for direct sysex controls. Can you make the BCR2000 send CC to the M4L device which would then generate the sysex for the MKS?

christofmuc commented 10 months ago

@JK808909 Using your data I found a bug in the checksum calculation algorithm, which affects only the MKS80 and only for one specific checksum! With that fixed, it should be able to load your data without problems. I will make a fixed release as soon as I get around and let you know!