Open trentgill opened 4 years ago
@tehn to write a super basic script example of what the syntax could look like / what features (events etc) would be enabled.
norns midi reference: https://github.com/monome/norns/blob/main/lua/core/midi.lua
basically the same, without vports
. to_msg
and to_data
are key. ie:
function midi.note_on(note, vel, ch)
midi.send{type="note_on", note=note, vel=vel, ch=ch or 1}
end
where midi.send
breaks it down into bytes and forwards to HID-MIDI endpoint.
--- play a random note on in 1 change
note = 0
input[1].mode("change")
input[1].change = function(state)
if state==1 then
note = math.random(127)
midi.note_on(note)
else
midi.note_off(note)
end
end
midi.event
gets called with midi data, which is first passed through to_msg
for clarity. to_msg
should have a raw
type for match failure.
midi.event = function(e)
if e.type == "note_on" then
output[1].volts = midi_to_volt(e.note)
output[2]() -- bang envelope
elseif e.type == "cc" then
if e.cc == 10 then
output[3].volts = 10/e.value
end
end
end
Consider #404 alternate clock sources if this ever makes it. would be nice to support MIDI input as the clock source, and feels preferable to a custom solution with lua functions etc.
Could be used with Norns quite easily as the MIDI clock system is built-in, rather than having to add custom params for turning on a special 'crow' sync.
Crow should simultaneously appear as a serial device, and a USB MIDI device to a connected host. This will allow out-of-box usage of crow with any MIDI capable host, specifically making integration into DAWs other than Ableton possible.
The full scripting environment will still be used, so the precise behaviour of the MIDI interop will be reconfigurable.
Defaults will of course be MIDI->CV conversion, but also MIDI->I2C bus conversion (eg. play Just Friends from your DAW, or sequence a hardware synth with the input jacks.
With #339 this could allow auto-synchronization between a USB host and crow's
clock
module.