Ive been waiting to get a Core Duo iMac so I can start writing this blog using iWeb. Well, things happen a little slower here and they will probably arrived in computer stores some time this week.
In the mean time, I was asked on a few occasions whether there is a way to send short MIDI control messages to MIDI devices. With TOE, thats quite easy to do if one can write a few lines of Python or Scheme. The result is of course a command-line application. TOE also has a C API which can be used in a Cocoa application, as demonstrated in my Program Panel project.
One way to implement a Cocoa application and still keep it customizable with Python or Scheme is to embed the Python or Scheme interepreter in the application. I wrote a new sample project MagicButton to illustrate how to do this (heres the application). To build it, first build the Python extension target in the TOE project included in the archive. The action invoked when the button is clicked can be customized by modifying the definition of the function
button in the file action.py in the Resources folder of the application bundle. For example, the contents of that file in the sample project is:
import TOEThat sends a volume change of 100 and program change of 127 to channel 1 on the Morpheus. Note that all the power of the Python language and the TOE extension is at your disposal for implementing the functiondef button(): d = TOE.Destination('Morpheus') d.Send('\xb0\x07\x64') d.Send('\xc0\x7f')
button. So you can pretty much do anything you like. Instead of a button, you can use a slider, stepper, or textbox and pass a value to the Python function, which can be sent to the MIDI device. That, as they say, is left as an exercise.