The MK Sound Format

The MK Sound format is designed to let people share microKORG sounds on the Internet using simple text copy/paste operations.

Here's an example sound - a big Church Organ:
!- microKORG: "Church Organ"
!- http://www.artlum.com/mk
!QlgAEQABQ2h1cmNoIE9yZ2FuAggHAEAA
!PAAuXQERGQAMRAlLAHhBBWQBAP//cApA
!QkBFBQAAFgACNEAAf0AAAUpKQEBAf0AA
!QEAAQH9EB39/JwIKAwJGDAJAA0BCQENA
!- crc32: 1132787708
!- end: "Church Organ"

If you have a MIDI cable and a microKORG sound in this format then you can use the sound directly in the MK Editor by copying and pasting it from this page.

You can also convert these sounds into ordinary microKORG® parameters by clicking here and pasting your sound into the online decoder.


Other synthesizers

The text format is designed to be as universal as possible. If you write editing software for other synthesizers and want to add copy/paste functions then this is a good format to use. The format is documented below. If you decide to use it then get in touch and I'll put links to your software here on this page so people can find your software easily.


Technical details of the format

The sound is encoded as multiple lines of plain text. There are two types of line in the text:

  • Lines that begin with "!-". These lines contain information about the sound, not sound data.
  • All other lines begin with a "!" and contain base64 encoded sound data.

Here we see the information lines(1) shown in red and the data lines(2) shown in blue.

!- microKORG: "Church Organ"
!- http://www.artlum.com/mk
!QlgAEQABQ2h1cmNoIE9yZ2FuAggHAEAA
!PAAuXQERGQAMRAlLAHhBBWQBAP//cApA
!QkBFBQAAFgACNEAAf0AAAUpKQEBAf0AA
!QEAAQH9EB39/JwIKAwJGDAJAA0BCQENA
!- crc32: 1132787708
!- end: "Church Organ"

The individual lines are described below:



!- microKORG: "Church Organ"

The first line contains the name of the synthesizer where the sound is expected to work ("microKORG"), and the name of the sound ("Church Organ").

This information is only here for humans - a human looking at the sound data will know right away that the sound is for a microKORG and that it's a "Church Organ" sound.



!- http://www.artlum.com/mk

The second line contains a link to this web page so that humans who find sounds on the Internet can follow the link and (hopefully) find out how to use them.

If you decide to use the MK format in your own software then let me know and I will provide links to your software from this page.



!QlgAEQABQ2h1cmNoIE9yZ2FuAggHAEAA
!PAAuXQERGQAMRAlLAHhBBWQBAP//cApA
!QkBFBQAAFgACNEAAf0AAAUpKQEBAf0AA
!QEAAQH9EB39/JwIKAwJGDAJAA0BCQENA

Next comes the binary data. This is a stream of base64 encoded data for the sound. The data contents are described in detail further down this page (in the section titled "The Binary Data"), here we only describe the encoding:

Most programming languages have a library for base64 encoding included as standard and there are many implementations on the web.

The '!' at the start of each line of text is not part of the Base64 encoding, you should only use the characters that follow the '!' on each line.

nb. In MK Editor the data is split into lines containing 32 characters each. This is just for convenience and not a requirement of the format. If your sounds contain a lot of data then you're free to use longer lines to keep the text more compact. Remember that sounds may be emailed and/or posted in online forums though, so don't go too far... 64 characters is probably good :-)



!- crc32: 1132787708

Next is a line with a crc32 checksum of the binary data. This is required when writing sounds but not required when reading (good software will check it though - to make sure the sound has been copied/pasted properly by the humans).

The crc32 polynomial used is the ANSI standard one as used in PKZIP, Ethernet, PNG, etc. There are many implementations of this crc32 available on the web and many languages include a library function.

nb. The crc32 is a checksum of the decoded data, not the base64 data stream.



!- end: "Church Organ"

After the checksum comes an end-of-sound marker. This can be useful if multiple sounds are stored in a single text file and you need to know where the end of each sound is.



Implementation notes:

Any lines of text not starting with a '!' are discarded.

Any line starting with '!' but not immediately followed by a '-' contains encoded sound data. It's a good idea to copy this data into a buffer as you read the sound then decode the complete sound when you reach the end. Discard all non-base64-chars as you go.

Any line starting with "!-" is informational (ie. it has information about the sound, not sound data). The lines are mainly there for the humans to read but lines that contain "crc32:" and "end:" can also be useful for the machines.


The binary data

If you decode the "Church Organ" sound shown above you should get the following data (hex dump):
0000  42 58 00 11 00 01 43 68-75 72 63 68 20 4F 72 67 BX....Church Org
0010  61 6E 02 08 07 00 40 00-3C 00 2E 5D 01 11 19 00 an....@.<..]....
0020  0C 44 09 4B 00 78 41 05-64 01 00 FF FF 70 0A 40 .D.K.xA.d....p.@
0030  42 40 45 05 00 00 16 00-02 34 40 00 7F 40 00 01 B@E......4@..@..
0040  4A 4A 40 40 40 7F 40 00-40 40 00 40 7F 44 07 7F JJ@@@.@.@@.@.D..
0050  7F 27 02 0A 03 02 46 0C-02 40 03 40 42 40 43 40 .'....F..@.@B@C@
The first five bytes of this data (ie. 42 58 00 11 00) are the MIDI identifier of the synthesizer. These bytes are sent by the synthesizer in response to a MIDI "universal device inquiry" request (they're bytes 5-10 of the SysEx reply packet).

These five bytes identify the manufacturer and model of a synthesizer, in the case of a microKORG they are:

42      - Korg
58 00 - MS2000 series
11 00 - microKORG

If the sound is for a different synthesizer then you'll see the MIDI ID for that synthesizer instead.

After the ID bytes there is a single version byte (in this case "01"). This version byte allows you to keep backwards compatibility of you ever change the format of the rest of the binary data.

The rest of the data (beginning at "43 68...") is the binary sound data. This will normally be specific to a particular synthesizer.


Microkorg-specific data

In the case of the Microkorg, the binary data is a simple dump of the data in the Program, as follows (refer to Table 1 of the microKORG MIDI document):

38 bytes - The first 38 bytes of the program data. Byte 16 of this data tells you whether the program is Single, Layered or Vocoder.

For a Single program: The next 52 bytes of data are the first 52 bytes of Timbre1 (See Table 2 in the MIDI doc - only the first 52 bytes of Timbre data are useful).

For a Layered program: 52 bytes for Timbre1 followed by 52 bytes for Timbre2.

For a Vocoder program: 142 bytes of Vocoder data (Table 3 in the MIDI doc).