Friday, July 19, 2019

Non blocking reads in lua

So I wanted to try reading some midi data from my keyboard with lua and ubuntu. I installed lua 5.3 and lua posix with "sudo apt install lua5.3 lua-posix"


Then I plugged in my M-Audio Keyrig 49 to the usb and tested it with "aseqdump -l" to list the midi devices then "aseqdump -p 24:0" since it came up on port 24:0.

Ok, so now for the lua (something quick and hacky to test it):

The keyrig will generate 0x90 key on and always 3 bytes for each midi message (0x90 status, then pitch, the velocity) so that makes it really easy.


and some sample output:


................................................

90
3b
39
KEY=59 VELOCITY=57
.......................*.........................
9
90
3c
36
KEY=60 VELOCITY=54
.......................**........................
6
90
3e
23
KEY=62 VELOCITY=35
.......................**.*......................

No comments:

Post a Comment