A keyboard instrument for OSX. Based on Leon Gruenbaum's Samchillian (Google "samchillian"!)
C Objective-C
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Xstrument is a laptop instrument.  Here is Jordan Rudess playing part of it (the top row and vibrato) with only 30 seconds of practice(!)


And here is me using more of the instrument (much steeper learning curve)


A Tutorial, which is more musically boring, but informative:


A reference map that I put up on youtube because I can't do somehthing as simple as post a static image on youtube:


Before you start Xstrument.app, you will need a place for the instrument to plug in to. Go to /Applications/Utilities/Audio Midi Setup.app and start that application. Under the MIDI Devices tab, double click the IAC driver and make sure that the device is online.

Once you have done that, you should start up an application that takes MIDI input such as Garage band, or plug in a MIDI keyboard (as an output device). When using a recording studio like Garage band, you will need to make sure that a MIDI track is selected and is prepared to respond to MIDI events. It is important that you start your MIDI device  (GarageBand, Reason, etc) before starting Xstrument.app - because Xstrument looks for the list of places to send MIDI events on startup.

I started this project with XCode 3.1 on OSX Leopard, and run it on Snow Leopard now.  I don't know if it still runs on Tiger, but this is code derived from code originally written for Tiger.  The organization is such that a Win32 port should be trivial, and hostable in the same project.  This is how that is achieved:

  - Objective-C
  - OSX Cocoa specific
  - Create an OpenGL surface that responds to key events
  - Pass to PortableUI

  - Portable OpenGL C code gets key events, draws screen 
    Interacts with MusicTheory, which handles MIDI.
  - No platform specific code
    (Put platform specific includes into a header that may contain 
    platform junk like #include <windows.h> that Win32's OpenGL does)
  - Pass to MusicTheory

  - Portable C code that uses no significant libraries
  - Imports a portable C MidiPlatform header and pass to MidiPlatform
  - Note that it's passive.  I am not getting MIDI events from external
    sources yet, and is not getting any timing information until echo
    buffers are re-introduced
  - It is the state machine that translates key presses into MIDI notes,
    and is the soul of the Samchillian instrument.

  - A platform specific implementation of MIDI hooks
  - The header is portable, which is important because MusicTheory imports it.
  - The implementation is platform specific.  In the case of OSX,
    it's in Objective-C.

General rules I try to follow:

  - I am placing documentation mostly in headers, rather than implementations.
  - Minimize dependencies and prove that they are REALLY minimized through
    the include structure.
  - Robustness is the most important feature.  Nobody will play live with
    an instrument that crashes "sometimes".  The source that this is based on
    has been played for over a year as my main instrument, and seems to be 
    at least as robust as the official OSX Samchillian by Leon.  However,
    this is a relatively recent build that will need to be vetted with 
    more time.  
  - If there is any regression, there might be performance regressions for
    people playing on slower laptops.  This implementation seems 100%
    real-time responsive for me, but I don't have my old laptop to see if 
    performance is actually the same as the old instrument.

Leon Gruenbaum holds patents with respect to the Samchillian instrument.  I got specific permission to start this project, as long as I respect his patent rights.  You cannot sell this software or anything derived from this source code, as it is for non-commercial use only.