Sunday, June 2, 2013

First Glasgow release

Generating music straight from a computer language has always been very fascinating for me. Off course, the code will never replace the composer, but it becomes a very interesting tool if it is used at the right place. There is a lot of offering and some very cool implementations like :
  • AC Toolbox - cool old school LISP tool.
  • noatikl - complete all in one solution. Impressive demo.
  • mxdublin - this one is my latest (2008) experiment. Too complex and heavy. It is dead.
By using those tools and even designing one, I have learn some implementation lessons :
  • The tool should not be a sequencer. In this implementation, the sequencer is Ableton Live and it does a great job. Once the notes are generated, the tool is not required to "play" the song, it is only use to change the live clips. This technique is used to have a minimal impact on the existing composition workflow.
  • The tool should only be used to generate notes and ctrl events; no raw midi events. Midi channel and routing should be programmable by the sequencer/host it self.
  • Time is always relative to the sequencer speed; nothing gets calculated in milliseconds. 0.25 means one quarter note (1/4). 1 means four quarter notes (4/4) or a whole note.
  • The event stream of data should not be encapsulated in a complex object. A event stream in Glasgow should be a simple array and this array should only contains the data of a simple Live clip.

    [ [ 0, 64, 127, 0.25 ], [ 0, 66, 127, 0.25 ] ]

    Events with 4 elements are notes (time, note, velocity, duration). Glasgow API helps you write those type of arrays but if you don't like them, you can make your own API that outputs this type of data. Events with 3 elements (time, midicc, value) could support midi controller change but the M4L API doesn't support that. I am thinking of opening a ticket at Cycling '74 for that.
  • The API should be adaptive based on the type of data. If it is a string, try to parse it into a list. If it is a list, create an iterator based on this list. If it is already an iterator, use it to create the events. Don't create different API for each data type, this is Javascript, let the API adapt it self to the data that is passed.
So this is Glasgow 0.1; it is a Max For Live plugin that enable to write (and get) the content of midi clips by Javascript code. maxforlive.com download


And by Javascript code, I mean this :

// this generates a beat (mapped to a bassdrum, snare, hihat)
[ mkp( "0:1", "C-3" ),
mkp( "0:2:2.2:-4", "D-3"),
mkp( "0:0.5:0.3/4", "A#4") ]

This is a work in progress. I will add the chord generation within the next version.