MIDImyAPPBETA
is a free programmable UNIX command-line tool for Mac OSX 10.4 and 10.5 (Tiger/Leopard intel or ppc) to execute any shell command (a script [Shell, Ruby, Perl, Java, AppleScript, Python, etc.], an UNIX command [open, say, etc.]) triggered by any MIDI event sent by a MIDI device. In other words MIDImyAPP can not only control other music devices but also other applications on your Mac.
For instance you can remote GarageBand:
or to play/stop a sound file, to set the output volume of the Mac, or open an other application, or change the face of the selected word in your text editor to bold by a single MIDI event (programmable keyboard).
MIDImyAPP rescans the MIDI configuration for each change on the global MIDI settings automatically.
MIDImyAPP is written in Carbon-C++ entirely to decrease the latency time as much as possible. For live performances it is recommended to use at least a double-core Intel Mac with 2GHz.
Hint: Each AppleScript as shell command which begins with tell app
will be executed internally to speed up the execution.
Simply download and decompress the ZIP archive to any location on your Mac.
download MIDImyAPP (100kB)
MIDImyAPP is an UNIX shell command which runs in the Terminal.
cd ~/Desktop/MIDImyAPP
./MIDImyAPP
and press RETURNx
and press RETURNAn other option to start MIDImyAPP is to double-click at startMIDImyAPP
from Finder.
If there is the need to run MIDImyAPP in the background you can double-click at startMIDImyAPPBG
and close the Terminal afterwards. To stop MIDImyAPP double-click at stopMIDImyAPP
Once you invoked MIDImyAPP (not hidden) you should see the sent MIDI events in the Terminal window (a kind of MIDIlogger).
Inside the MIDImyAPP folder there is a default configuration file called config.plist
. This file is a standard Mac Property List file (plist) which can be edited with the “Property List Editor”. Simply double-click at it and the editor starts.
The internal structure is quite simple:
If you open it in a text editor you will see:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>THE MIDI EVENT</key>
<string>SHELL COMMAND</string>
</dict>
</plist>
Hints:
< > &
you have to write < > &
(only relevant while editing in a text editor); all other ASCII characters are allowed including new_line
If you press for instance a key the velocity is passed as variable (last byte), if you control a slider, drawbar, or knob the actual value is passed as variable. To ignore or use that variable follow this workflow:
XX
as KEY in the plist file%@
as place holder%@
will be replaced internally by the decimal value (in general 0-127)the release of key A5 on MIDI channel 4 should open the PDF file “test.pdf”:
935D00
SHELL COMMAND: open "test.pdf"
the hitting of key A5 on channel 4 should open the movie file “test.mov”:
935DXX
SHELL COMMAND: open "test.mov"
935D00
to " "
the hitting of key A5 on channel 4 should open a text document (TextEdit) containing the velocity times 100 plus the text “ speed”:
935DXX
SHELL COMMAND: echo "`perl -e 'print @%*100'` speed" | open -f
the hitting of key A5 on channel 4 should play the sound file “test.aif” (inside the MIDImyAPP folder) looped with the volume given by the passed velocity and stop it on release A5:
935DXX
SHELL COMMAND: ./play -l -v %@ test.aif
935D00
SHELL COMMAND: ./stop test.aif
play
and stop
see Appendixthe slider sending on channel 1 and CC 28 should control the master volume of “GarageBand”:
KEY: B01CXX
SHELL COMMAND: osascript -e "tell app \"GarageBand\" to set master volume of the first song to (%@/127)"
This works but it is rather slow. MIDImyAPP can execute any AppleScript beginning with “tell app” internally for speed, thus better is:
KEY: B01CXX
SHELL COMMAND: tell app "GarageBand" to set master volume of the first song to (%@/127)"
Hint Have a look at the config.plist shipped with MIDImyAPP for further examples.
The configuration file config.plist
will be used as default. MIDImyAPP accepts the option -p FILE
to load an other configuration file. To use for instance the configuration file “My first gig.plist” located on the Desktop start MIDImyAPP from Terminal via:
./MIDImyAPP -p "$HOME/Desktop/My first gig.plist"
It is possible to use MIDImyAPP as slave to send each MIDI event to an other script or file. In that mode MIDImyAPP does not make usage of a configuration file.
Examples
./MIDImyAPP -e "echo %@ >> ~/events.txt"
will append each event to the file ~/events.txt
./MIDImyAPP -e "echo %@ > ~/midi_pipe"
will send each event to the named pipe ~/midi_pipe (useful if a script is listening on that pipe to do something with these events)
The following runtime commands are available:
Hans-Jörg Bibiko mail@bibiko.de, bibiko@eva.mpg.de
MIDImyAPP is totally free. The only condition is to give feedback about usability, bugs, suggestions, etc.
Inside the MIDImyAPP folder there are two tiny command-line utilities play
and stop
.
./play {-l -v VOL} SOUND_FILE
plays a passed sound file
./stop SOUND_FILE
stops the SOUND_FILE which is playing back by ./play
./stop
only works inside the configuration file and if ./play
was called (literally)In that folder you find some useful AppleScripts for controlling “GarageBand” and others.