script cc and pitch bend
-
I'm familiar with how to create notes for the midi player through scripting like you example @Christoph-Hart
// ADD NOTE FUNCTION inline function addNote(list, channel, notenumber, velocity, position, length) { var m = Engine.createMessageHolder(); m.setType(m.NoteOn); m.setNoteNumber(notenumber); m.setVelocity(velocity); m.setChannel(channel); m.setTimestamp(Engine.getSamplesForQuarterBeats(position)); var o = Engine.createMessageHolder(); o.setType(o.NoteOff); o.setNoteNumber(notenumber); o.setChannel(channel); o.setTimestamp(Engine.getSamplesForQuarterBeats(position + length)); list.push(m); list.push(o); }
Is there a similar way to script cc and pitch bend information for the midi player?
-
Sure:
o.setType(o.PitchBend); o.setType(o.Controller);
-
@Christoph-Hart great, thanks!
-
@Christoph-Hart btw, let's say I have 8 quarter notes in a sequence, and I wan't to have cc1 going from min to max from the start to the end of sequence, how should I calculate the timestamp for cc1, and does it matter in which order the different events is pushed to the list?
-
how should I calculate the timestamp for cc1
The same way you calculate it for the notes. Use the tick format, then
o.setTimestamp(quarterPos * 960.0)
.does it matter in which order the different events is pushed to the list
Nope, they are sorted chronologically when they are put into the MIDI player.
-
@Christoph-Hart I use the
setControllerNumber() & setControllerValue()
for controllers between 1 - 127 and it works great
but with what function do I set the pitch bend value? -
@ulrik never mind, I set the pitch bend value with the same function
setControllerValue()