Technical Details of the AKAI MPKmini Professional MIDI Keyboard

This year I impulse-bought an AKAI MPK mini Pro 2-octave MIDI device.

AIKI MPKmini Pro

And found that, apparently, if you want to do anything with Midi music, you buy a Mac.

Well, I’ve always found Mac/Apple UI to be unusable, so that’s out.

Anyway, it turned out to be easy to get MIDI messages from a USB device to a Python program using python-mido. And, after some dithering, creating sound from Midi was do-able. I tweaked one of several variants of 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 Compifont_13082016.sf2.

Re-inventing the wheel can be entertaining.

In the course of playing with the AKAI I made the following notes about the AKAI’s sysex and light control logic. Make of them what you will.


Some 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):
    sudo modprobe usbmon                        # makes the /dev/usb/usbmon[0-7] devices
    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)

    Note: Each 4 bytes has a 04 as the 1st byte and a 07 instead of 04 on the last 3 real data bytes.

    sudo tcpdump -i usbmon3 -x

Note:   has some sysex reverse-eng info for the device
Note:       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)

MPK Mini sysex from device

sysex data=(
71,         Akai device     71==0x47
0,          More Akai dev?                      (which particular device? - 0x7f is broadcast, apparently, and 0x7e is non-real-time?)
38,         Akai model      38==0x26
103,        sysex function  103|0x67 is (prog_memory below: 0..4=RAM|prog1..4) coming from device.
                            102|0x66 requests a program (prog_memory below: 0..4=RAM|prog1..4) from device.
                            100|0x64 puts program to device.
                             96|0x60 requests the knob positions (see the code for example).
                             97|0x61 is knob positions from the device.
0,          hi-7-bits of how many bytes
109,        how many more bytes there are or are meant to be if the device didn't have bugs?

0,          prog memory     0=RAM 1=prog1 2..4=prog2..4

0,          pad channel     0..15

0,          key channel     0..15
4,          key octave      0..8    4 + octave      (changes LEDs)

0,          arp             off=0 on=1              (changes LED)
0,          arp mode        0..5
0,          arp time div    0..7
0,          arp clock       internal=0 external=1
0,          arp latch       on=1    off=0
0,          arp swing       0..5    50%|55%|57%|59%|61%|64%
3,          arp tempo taps  2..4
1,          hi bit          arp tempo  30..240
0,          lo 7 bits       arp tempo  30..240
0,          arp octave 0..3 (displayed on-screen in Akai setup program and on device's keys in red as 1..4)

0,          0=pitchbend     1=cc1 2=cc2
0,          cc1|cc2-down    0..127
0,              cc2-up      0..127
2,          cc2
65,         cc2-down 65
64,         cc2-up   64

48,         note_on note when not in CC or PC mode
0,          cc
0,          pc
1,          momentary=0 toggle=1

0,      cc
0,      lo
127,    hi

12          0..24   12 + transpose of -12..12


#   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.
#   led_lite values:
#       0..2    At start-up most recent is Prog Change - it turns off/on.
#       3       Apr On/Off
#       4       Tap_tempo changes only if human has turned off Arp
#       5       Octave down
#       6       Octave up
#       7       Full level
#       8       ?
#       9..16   Pads
#       17..24  Most recently used lite.
#       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.
#       26      CC
#       27      Prog Change
#       Other led_lite values are just weird. Most recent lite changed or something is affected.
#   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.
#   The 127-ness came from a comment at:
    [ 3,    "Arp",          ],
    [ 4,    "Tap_Tempo",    ],
    [ 5,    "Oct_down",     ],
    [ 6,    "Oct_up",       ],
    [ 7,    "Full_level",   ],
    [ 9,    "Pad_1",        ],
    [ 10,   "Pad_2",        ],
    [ 11,   "Pad_3"         ],
    [ 12,   "Pad_4",        ],
    [ 13,   "Pad_5",        ],
    [ 14,   "Pad_6",        ],
    [ 15,   "Pad_7",        ],
    [ 16,   "Pad_8",        ],
    [ 25,   "Bank_A/B",     ],
    [ 26,   "CC",           ],
    [ 27,   "Prog_change",  ],

Expect / Want / Need — Standard American Politician

Years ago I learned a sequence to follow when giving things to people.

First, you must give a person what they expect.
Then you can give them what they want.
Finally, you can give them what they need.

Sadly, I almost always stumble on expect, but the few times I’ve followed this script have been magical experiences. The sequence works!

So, back in 2016 I watched the third Trump/Hillary debate and noticed something.

Hillary fluently spoke a dialect of English I dubbed “Standard American Politician” (SAP).

Trump did not.

What is SAP?

Listen to the sound of, “That’s an important issue, Ralph. We have laid out a comprehensive plan to move America forward on that issue.

Notice it’s not just any old plan, it’s a comprehensive plan. SAP has a unique set of buzzwords with idiosyncratic meanings.

Notice the politician has told you this “issue” is, um, not a priority, but they are ready to trot something out in case the issue ever bubbles up during a campaign. You understand that meaning because you understand SAP.

SAP allows a politician to state things in a way that makes it difficult for others to miss-spin meaning.

And SAP also makes it easy to, ah, add nuance when the politician’s position “evolves”.

Is that the end of it?

No, the sequence of expect/want/need comes in play here.

Most people expect politicians to speak Standard American English. The higher the office, the more fluent the politician. If a politician does not speak SAP, then expect-people will miss a beat when they first hear the politician, but will get the message that this politician is running an outsider campaign. So. … Nothing of note.

Many people want their politicians to speak SAP. This makes sense. SAP has evolved to match its use. Meaning is more easily gleaned from SAP words. Etc. If a politician does not speak SAP, want-people will miss a beat, but will adjust as they might adjust to someone who speaks non-native English.

And, finally, some people need their politicians to speak SAP.

With that observation, in an instant, I understood a common, gut-level reaction to Trump.

Two New Earth-Like Planets Discovered

While the rest of the world was sleeping, I have been building a space ship. This autonomous ship has recently explored space near our Sun at a distance of Earth’s orbit. This exploration has been a remarkable success.

The ship has discovered two new planets! These planets orbit our Sun in exactly Earth’s orbit. And, it appears they can host life.

You may be skeptical of these claims. That’s understandable. But, pictures don’t lie. I dub the first planet discovered, Oceania. Behold:

The newly discovered planet, Oceania.

Oceania is an ideal planet for fish.

I dub the other newly discovered planet, Landia. Terrestrial animals and plants will find Landia an ideal planet, as you can see clearly:

The newly discovered planet, Landia.

These discoveries promise to change the course of not only history, but of life on Earth, itself.

Covid 19 Does Not Specially Target Old Folks

In my mind’s eye, I thought of Covid 19 as specially targeting the old.

We all know stories of nursing homes packed with sick old folks. But nursing home residents succumb to any sickness more easily than, say, high school kids.

So, is Covid 19 going after old folks in particular, or is Covid 19 just one more way to be killed?

Let’s find out.

The CDC has data for all deaths in the US by week and by age groups. Let’s graph that data in a stacked area graph.

This stacked area graph shows horizontal bands, one for each of several age groups. Thick bands have higher numbers of deaths, thin, lower.

If Covid 19 specially affects old folks, then the bands for older age groups should get thicker during March and April when most US Covid 19 deaths happened.

Note: The unlabeled age groups in this graph are:

    45-54 years
    35-44 years
    25-34 years
    15-24 years
    5-14 years
    1-4 years
    Under 1 year.

A consistent quarter of all deaths are people 85 and up. A little less are in the 75 to 85 age group. And so on.

WARNING! THE SLOPE ON THE RIGHT IS CREATED FROM MISSING DATA. In the US, it takes time for notifications of deaths to get to the CDC. Raw numbers for recent weeks are always low. One thing this graph shows, therefore, is that death reports for 85+ people get to the CDC faster than others.

This graph makes it appear that Covid 19 really has no differential affect on different age groups.

But, is it misleading?

Have you noticed graphs that purport to show information about Covid 19 almost always cut off shortly before Covid 19 was a factor in the US? This one does, too. Uh, huh, Robinson, remove the baseline context from your graph, you sneaky devil, you. Well, is that a problem here?

Well, the CDC also has death-by-age information going back to the beginning of 2015. Slightly different age groups as in the graph above, but good enough for a picture. Let’s look:

The unlabeled age groups are:

    25-44 years
    Under 25 years.

Judging by this graph, if any age group has been hit harder by Covid 19, it’s the 45-64 year group! But look at the first, zoomed-in graph before jumping to that conclusion.

If you squint, you can see that 85+ people tend to die slightly more often in the winter than in the summer. There tends to be a time – anywhere from October out to March – when 85+ people are hit the hardest. That’s likely to be the various flu seasons doing what they do. They come early. They come late. They come once or twice or not at all. They vary.

I do not know what’s going on with the ramp-up on the left – early 2015. Looks like a particularly bad season to be 85+. But, it’s on the edge of the graph, so …?

OK. That’s about it. I was thinking wrong. There’s nothing special about how Covid 19 affects old folks.


JSON data behind the graphs (Do not hit these URLs unless you know what you are doing. Your browser may not handle them well.):

JSON 2020 Feb thru mid Aug weekly US deaths by age group

JSON 2015-2020 weekly US death counts – by state and age group – 60 megabytes

A new Kinsa fever movie

Here is another movie generated by my Kinsa fever data display program.

This video uses color to show which US counties have similar Kinsa fever thermometer statistics. This particular video colors counties with recent (previous 15 days) higher-than-other-county-fever-percentages in red tones, less recent high percentages in green tones, and high percentages older than 45 days in blue.

Watch red to see how fever moves around the country over time. Watch for blue to see counties that have had fever, but not for a while. Green counties were feverish around a month before the end date.

During the video, the end date runs from mid-March to August 7th.

Where Kinsa says it’s getting hot

Here is the current US map with green showing the highest percentage of feverish people in March and April, blue showing May, and red showing June so far, to theĀ 8th.

Notice California (e.g. Alameda County)

and Florida (e.g. Pasco County)

seem to be heating up in May/June (red and blue – orange), and western Utah (e.g. Beaver County)

has come alive in the last, red week – June, that is. I wonder if anything is going on in these places.

By way of contrast, consider most of Texas (e.g. Nolan County)

which was particularly feverish (compared to other places in the US) only in May. That drop-off in Nolan County, Texas is peculiar, too. Neighboring counties have a similar, but not so dramatic drop-off. Probably some peculiarity of data processing. … Or is it? Dum, dum, dum, dummm. Suspense!

I learned something about keyboards

As it turns out, the empty space between the Alt and Ctrl keys seems to be there for a reason:

The side of the hand needs room here.

On a real keyboard, one with real key travel, if you don’t put your hands on some kind of padding, the meaty side of your right hand will fit in this space!

I learned this when, on a whim and with only one usable keyboard left (a sad Model M) I picked up a little 82-key AJazz AK33 board. This board sports the modern world’s unserious attempt at approximating buckling keys – Cherry Blue-esquers. But, hey, it’s small. Or something. And lighted. And has some key roll-over.

Ajazz AK33 with no slot for the right hand to fit in to.

But it didn’t work for me. Turns out, my right hand would push the left arrow key at random – usually when hitting a burst of keys.

Luck was good, though. I got one of my ~30 year old NMB buckling spring boards working again. They aren’t the best keyboard ever made (i.e. an IBM AT board), but they are up there.