Inserting pitch bend value via a script?
I'm trying to insert pitch bend values using a shortcut key/script. I've downloaded a script that works well for inserting CC values at the edit cursor (example below for inserting cc1 value 100). Could this be easily adapted to insert Pitch Bend or are there any other scripts out there that do this?
function main()
channel = 0
MIDIEditor = reaper.MIDIEditor_GetActive()
if MIDIEditor == nil then return end
take = reaper.MIDIEditor_GetTake(MIDIEditor)
if take == nil then return end
item = reaper.GetMediaItemTake_Item(take)
itempos = reaper.GetMediaItemInfo_Value(item, 'D_POSITION')
if reaper.TakeIsMIDI(take) == false then return end
pos = reaper.GetCursorPosition()
ppq = reaper.MIDI_GetPPQPosFromProjTime(take, pos)
reaper.MIDI_InsertCC(take,
false,--boolean selected,
false,--boolean muted,
ppq,--number ppqpos,
176,--integer chanmsg,
channel,--integer chan,
1,
100)
reaper.UpdateItemInProject(item)
end
|