{"id":1109,"date":"2020-12-10T17:07:17","date_gmt":"2020-12-11T01:07:17","guid":{"rendered":"https:\/\/www.tranzoa.net\/~alex\/blog\/?p=1109"},"modified":"2020-12-10T17:07:17","modified_gmt":"2020-12-11T01:07:17","slug":"technical-details-of-the-akai-mpkmini-professional-midi-keyboard","status":"publish","type":"post","link":"https:\/\/www.tranzoa.net\/~alex\/blog\/?p=1109","title":{"rendered":"Technical Details of the AKAI MPKmini Professional MIDI Keyboard"},"content":{"rendered":"<p>This year I impulse-bought an AKAI MPK mini Pro 2-octave MIDI device.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.tranzoa.net\/alex\/blog\/images\/akai_mpk_mini_pro_01.jpg\" alt=\"AIKI MPKmini Pro\" \/><\/p>\n<p>And found that, apparently, if you want to do anything with Midi music, you buy a Mac.<\/p>\n<p>Well, I&#8217;ve always found Mac\/Apple UI to be unusable, so that&#8217;s out.<\/p>\n<p>Anyway, it turned out to be easy to get MIDI messages from a USB device to a Python program using <code>python-mido<\/code>. And, after some dithering, creating sound from Midi was do-able. I tweaked one of several variants of <code>fluidsynth.py<\/code> on GitHub. The actual instruments came from various SoundFont files downloaded from the magical Internet. My favorite of the 48 I have is gigabyte-sized <code>Compifont_13082016.sf2<\/code>.<\/p>\n<p>Re-inventing the wheel can be entertaining.<\/p>\n<p>In the course of playing with the AKAI I made the following notes about the AKAI&#8217;s sysex and light control logic. Make of them what you will.<\/p>\n<pre>\r\n\"\"\"\r\n\r\nSome things found about the Akai Pro Mini using (after plugging the device alone in to USB bus 3 - the near plug on the front panel of spring):\r\n    sudo modprobe usbmon                        # makes the \/dev\/usb\/usbmon[0-7] devices\r\n    sudo cat \/sys\/kernel\/debug\/usb\/usbmon\/3u    # doesn't print more than 24 real data bytes at a time (32 bytes packaged in 8 4-byte words)\r\n\r\n    Note: Each 4 bytes has a 04 as the 1st byte and a 07 instead of 04 on the last 3 real data bytes.\r\n\r\nOr:\r\n    sudo tcpdump -i usbmon3 -x\r\n\r\nNote:       https:\/\/github.com\/mungewell\/mpd-utils\/blob\/master\/sysex\/sysex_mk2.md   has some sysex reverse-eng info for the device\r\nNote:       private\/akai\/APC40Mk2_Communications_Protocol_v1.2.pdf                  for a similar device (some note on the web said this MPKmini doesn't have such a doc)\r\n\r\nMPK Mini sysex from device\r\n\r\nsysex data=(\r\n71,         Akai device     71==0x47\r\n0,          More Akai dev?                      (which particular device? - 0x7f is broadcast, apparently, and 0x7e is non-real-time?)\r\n38,         Akai model      38==0x26\r\n103,        sysex function  103|0x67 is (prog_memory below: 0..4=RAM|prog1..4) coming from device.\r\n                            102|0x66 requests a program (prog_memory below: 0..4=RAM|prog1..4) from device.\r\n                            100|0x64 puts program to device.\r\n                             96|0x60 requests the knob positions (see the code for example).\r\n                             97|0x61 is knob positions from the device.\r\n0,          hi-7-bits of how many bytes\r\n109,        how many more bytes there are or are meant to be if the device didn't have bugs?\r\n\r\n0,          prog memory     0=RAM 1=prog1 2..4=prog2..4\r\n\r\n0,          pad channel     0..15\r\n\r\n0,          key channel     0..15\r\n4,          key octave      0..8    4 + octave      (changes LEDs)\r\n\r\n0,          arp             off=0 on=1              (changes LED)\r\n0,          arp mode        0..5\r\n0,          arp time div    0..7\r\n0,          arp clock       internal=0 external=1\r\n0,          arp latch       on=1    off=0\r\n0,          arp swing       0..5    50%|55%|57%|59%|61%|64%\r\n3,          arp tempo taps  2..4\r\n1,          hi bit          arp tempo  30..240\r\n0,          lo 7 bits       arp tempo  30..240\r\n0,          arp octave 0..3 (displayed on-screen in Akai setup program and on device's keys in red as 1..4)\r\n\r\n0,          0=pitchbend     1=cc1 2=cc2\r\n0,          cc1|cc2-down    0..127\r\n0,              cc2-up      0..127\r\n2,          cc2\r\n65,         cc2-down 65\r\n64,         cc2-up   64\r\n\r\n48,         note_on note when not in CC or PC mode\r\n0,          cc\r\n0,          pc\r\n1,          momentary=0 toggle=1\r\n49,1,1,1,\r\n50,2,2,1,\r\n51,3,3,1,\r\n52,4,4,1,\r\n53,5,5,1,\r\n54,6,6,1,\r\n55,7,7,1,\r\n56,8,8,1,\r\n57,9,9,1,\r\n58,10,10,1,\r\n59,11,11,1,\r\n60,12,12,1,\r\n61,13,13,1,\r\n62,14,14,1,\r\n63,15,15,1,\r\n\r\n0,      cc\r\n0,      lo\r\n127,    hi\r\n1,0,127,\r\n2,0,127,\r\n3,0,127,\r\n4,0,127,\r\n5,0,127,\r\n6,0,127,\r\n7,0,127,\r\n\r\n12          0..24   12 + transpose of -12..12\r\n)\r\n\r\n\r\n\"\"\"\r\n\r\n#\r\n#\r\n#   If the device is in the right state, apparently any channel 0 note_on (non-127?) will turn off the PROG_CHANGE light until some other note_on messages are sent or something.\r\n#   led_lite values:\r\n#       0..2    At start-up most recent is Prog Change - it turns off\/on.\r\n#       3       Apr On\/Off\r\n#       4       Tap_tempo changes only if human has turned off Arp\r\n#       5       Octave down\r\n#       6       Octave up\r\n#       7       Full level\r\n#       8       ?\r\n#       9..16   Pads\r\n#       17..24  Most recently used lite.\r\n#       25      Bank A\/B if Green, off goes to off or red, whichever it was last set by the human. Human-set red cannot be turned off.\r\n#       26      CC\r\n#       27      Prog Change\r\n#       Other led_lite values are just weird. Most recent lite changed or something is affected.\r\n#   The lites don't affect the meaning of the button. The button must be hand-toggled from its logical state to get to a state that matches the lite after the lite is turned off.\r\n#\r\n#   The 127-ness came from a comment at: https:\/\/cycling74.com\/forums\/akai-mpk-mini-send-get-signals-to-light-buttons\r\n#\r\n#\r\nAKAI_MPK_MINI_LITES   = [\r\n    [ 3,    \"Arp\",          ],\r\n    [ 4,    \"Tap_Tempo\",    ],\r\n    [ 5,    \"Oct_down\",     ],\r\n    [ 6,    \"Oct_up\",       ],\r\n    [ 7,    \"Full_level\",   ],\r\n    [ 9,    \"Pad_1\",        ],\r\n    [ 10,   \"Pad_2\",        ],\r\n    [ 11,   \"Pad_3\"         ],\r\n    [ 12,   \"Pad_4\",        ],\r\n    [ 13,   \"Pad_5\",        ],\r\n    [ 14,   \"Pad_6\",        ],\r\n    [ 15,   \"Pad_7\",        ],\r\n    [ 16,   \"Pad_8\",        ],\r\n    [ 25,   \"Bank_A\/B\",     ],\r\n    [ 26,   \"CC\",           ],\r\n    [ 27,   \"Prog_change\",  ],\r\n                        ]\r\n\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This year I impulse-bought an AKAI MPK mini Pro 2-octave MIDI device. And found that, apparently, if you want to do anything with Midi music, you buy a Mac. Well, I&#8217;ve always found Mac\/Apple UI to be unusable, so that&#8217;s &hellip; <a href=\"https:\/\/www.tranzoa.net\/~alex\/blog\/?p=1109\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,5,12,16],"tags":[],"class_list":["post-1109","post","type-post","status-publish","format-standard","hentry","category-bloggy-things","category-programing","category-programming","category-tips"],"_links":{"self":[{"href":"https:\/\/www.tranzoa.net\/~alex\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1109","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tranzoa.net\/~alex\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tranzoa.net\/~alex\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tranzoa.net\/~alex\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tranzoa.net\/~alex\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1109"}],"version-history":[{"count":5,"href":"https:\/\/www.tranzoa.net\/~alex\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1109\/revisions"}],"predecessor-version":[{"id":1114,"href":"https:\/\/www.tranzoa.net\/~alex\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1109\/revisions\/1114"}],"wp:attachment":[{"href":"https:\/\/www.tranzoa.net\/~alex\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tranzoa.net\/~alex\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tranzoa.net\/~alex\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}