Giter Site home page Giter Site logo

autohotkey-midi's Introduction

About This Fork

Midi2.ahk

This is compatible with AutoHotkey v2. Due to this impact, the description method has been changed. Like this.

#include "path\to\Midi2.ahk"

midi := AHKMidi()
midi.midiEventPassThrough := True
midi.delegate := MyDelegate()
;midi.specificProcessCallback := True

; open midi device manually
; midi.OpenMidiInByName("name")
; midi.OpenMidiOutByName("name")
;
; or save and load devices setting with ini file
; auto save selection from task tray menu
midi.settingFilePath := A_ScriptDir . "\setting.ini"

Class MyDelegate
{
    ; if specificProcessCallback is set true
    ; trigger only when the applicable process is front
    ; replace any spaces or "." in the process name with "_".
    explorer_exe_MidiNoteOnC4(event) {
        MsgBox("C4 on explorer.exe")
    }

    MidiNoteOnC4(event) {
        MsgBox("C4 Pressed")
    }

    ; use "s" instead of "#"
    MidiNoteOnCs4(event) {
        MsgBox("C#4 Pressed")
    }

    MidiControlChange(event) {
        MsgBox(event.controller . "=" . event.value)

        ; pass through this event to midi out device
        event.eventHandled := false
    }
}

Midi.ahk

AutoHotkey-Midi

Add MIDI input event handling to your AutoHotkey scripts

#include AutoHotkey-Midi/Midi.ahk

midi := new Midi()
midi.OpenMidiOutByName("X-TOUCH MINI")
midi.OpenMidiInByName("X-TOUCH MINI")

; send some  Outout
midi.MidiOut("CC", 1, 127, 0) ; ControllerChange on Channel 1, Code 27
midi.MidiOut("N1", 1, 1, 100) ; Note on On Channel 1, Note 1, Velocity 100

Return

MidiNoteOnA4:
    MsgBox You played note A4!
    Return

MidiControlChange1:
    cc := midi.MidiIn()
    ccValue := cc.value
    MsgBox You set the mod wheel to %ccValue%
    Return

Requirements

License

BSD

TODO

  • Documentation!

autohotkey-midi's People

Contributors

9chu avatar dannywarren avatar fashberg avatar hetima avatar

Stargazers

 avatar  avatar  avatar  avatar

Forkers

steveseguin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.