librelist archives

« back to archive

MIDI + audio_ffwd

MIDI + audio_ffwd

Tom Lieber
2010-02-26 @ 06:52
Two updates this evening, only really useful if you're willing to
update to the ckv bleeding edge..

First off, MIDI input support is partially finished. ckv takes the
command-line option -m N to listen on MIDI port N. To handle MIDI note
on/off messages, create an object with note_on(note, vel) and
note_off(note) functions defined and pass it to set_midi_controller
with the channel to listen on, like this:

  obj = {
    key_on = function(note, vel)
      print("on", note, vel)
    key_off = function(note)
      print("off", note)
  set_midi_controller(0, obj)

This is partially finished because the idea is that you will also be
able to pass a _constructor_ to ckv, which it will use to
automatically allocate as many objects as there are simultaneously
pressed keys. This way, if the constructor happens to be for a ugen
(like an Stk instrument, for example), polyphony works out of the box.

The other, less significant update is that I've added a function
audio_ffwd() which may help ease the pain of authoring long segments
of scripted ckv. If you call audio_ffwd(minute), ckv will go into
silent mode for one minute of virtual time, then resume. All ugens are
ticked, so the processing will still take some time, but at least it
won't take the entire minute to make it to an edit point.

Tom Lieber