Thread: Intercept the MIDI Out

  1. #1
    Registered User
    Join Date
    Oct 2007

    Intercept the MIDI Out

    I was wondering if there was any way (on any OS) to intercept the outgoing MIDI events. For example, if a program is running (maybe Cubase) and sends out a MIDI event for Channel 16, Note "Middle C", how could my program (which is also running) receive this event when it is sent?

    So basically it's like the software equivalent of having a midi wire running from the computer's MIDI out to MIDI in.


    (Oh, and is this possible through any cross-platform libraries, like PortMidi?)

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    For any OS, to intercept MIDI events from other applications would probably involve you hooking something low level. Needless to say this would be very OS specific once you got down to the actual method used.

    For example, on Windows, you might be able to get away with this by injecting a DLL into a running process and hooking some function that processes MIDI events (I'm being extremely simplistic.). So yeah.... you might want to consider what you really want.

    I don't know of any easy way of doing this.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    I'm not sure, but I think another option (also quite complex) would be to write a "filter driver", which is essentially a driver that sits between the originating OS level and the actual hardware driver.

    This involves quite a bit of understanding of how the OS does MIDI things.

    Hooking, as suggested by MacGyver is generally not officially supported, and is likely to break at any update of the OS [for example, the structure of a DLL may change, a new function introduced, etc]. Not to mention that different processor architectures will require different methods to insert a hook.

    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to play midi music from resource without directX
    By alaphate in forum Windows Programming
    Replies: 0
    Last Post: 03-12-2009, 08:49 AM
  2. Guitar Hero ALSA MIDI output
    By redxine in forum Linux Programming
    Replies: 0
    Last Post: 01-24-2009, 11:03 PM
  3. Playing a Midi. (win32 console) (MSVC++)
    By knave in forum Windows Programming
    Replies: 3
    Last Post: 05-17-2003, 10:40 AM
  4. Converting from MIDI to WAV/DLLs
    By sean in forum A Brief History of
    Replies: 7
    Last Post: 10-27-2002, 11:31 AM