MIDI library for AutoHotKey v2

I have created a MIDI library for AutoHotKey v2.
The library is available for download on GitHub here:
https://github.com/emliberace/MIDIv2.ahk

Detailed documentation is available online here.

Features

  • Open and close Input and Output ports
  • Get all available MIDI Input/Output ports
  • Define a default MIDI Output channel
  • Filter incoming MIDI messages to a specific channel
  • Send and receive MIDI messages:
    • Note On/Off
    • Control Change
    • Aftertouch
    • Poly Aftertouch
    • Pitchbend
    • Program Change
    • SysEx
    • MMC (MIDI Machine Control)
    • MIDI Time Code
  • MIDI Through

I have an older version of a MIDI library for AutoHotKey v1 that is available in these forums here. It has fewer features but is still functional.
The library for v2 is recommended.

(Special thanks to @Aurasphere for inspiration!)

6 Likes

Looks brilliant…ill get a chance to check next week…under pressure to get our translation speakers ready for namm :wink:

Ahk is just brilliant for keys>midi…i migrated all those bits from Bome and its so much better. Im just looking to add HID trapping so u can add kb etc as dedicated/single purpose

Cant wait to check our your guru scribing :slight_smile:

1 Like

MIDIv2 Updated to v1.1!

Added

  • Added support for RPN/NRPN
  • Added support for System Real Time messages
  • Properties added

    • RPN_Enabled
    • NRPN_Enabled
    • SRT_Enabled
  • Functions added

    • SendRPN()
    • SendNRPN()
    • ControlChangePair()
    • SRT_TimingClock()
    • SRT_Start()
    • SRT_Stop()
    • SRT_ActiveSensing()
    • SRT_SystemReset()
  • Callbacks added

    • RPN
    • NRPN
    • SRT_Timing
    • SRT_Start
    • SRT_Continue
    • SRT_Stop
    • SRT_ActiveSensing
    • SRT_SystemReset

Changed

  • Updated error handling to be more concise and descriptive

Fixed

  • MMC_DeviceID Get - Now returns Integer and rather than String

To download, see link in the top most post of this thread.

2 Likes

MIDIv2 Updated to v1.1.2

Added

  • Properties added

    • SysExInputBuffers
    • SysExInputBufferSize

Changed

  • Incoming SysEx messages now use multiple buffers which enables larger sized messages to be received
  • Minor code cleanup

Notes:

Each SysEx buffer is still limited to 64KB (65536 Bytes) but as far as I know, there is no limit, other than system resources (RAM), of how many buffers you can assign.
It’s probably good practice to not go too crazy when allocating buffers and keep it to just over the expected maximum data size.
Since the buffers are automatically allocated when a MIDI Input port is opened, I kept the default buffers and sizes quite small—16 buffers of 64 Bytes each for a total of 1KB. For SysEx dumps, especially sample data, they must be increased by a fair amount.
Also note that if a virtual MIDI port is used, it might impose a limitation on the total size of the SysEx message.
I have successfully tested receiving a single data stream from a .syx file of 256KB in size.


To download, see link in the top most post of this thread.

1 Like