Quote:
Originally Posted by Trancit
- "Fill with notes" in a musical sense and with options like this got
- "Thin out notes" in a musical sense and with options like this got
- "Randomize notes"
|
I am not aware of any script that offers all those options, but you can try "Lokasenna_MIDI Randomization Tool" for some basic randomization.
REAPER has several native actions to invert or reverse notes -- just search the Actions list for "inver" and "rever".
Quote:
- "Repeat notes to part end"
|
Here is a simple script that I sometimes use to duplicate stuff to the end of the take. Just select the events to duplicate, set the time selection across the selected events to the duplication step size, and run the script. (Warning: it is just a simple script that doesn't do error checking etc.)
Code:
reaper.Undo_BeginBlock2(0)
editor = reaper.MIDIEditor_GetActive()
take = reaper.MIDIEditor_GetTake(editor)
ppq = reaper.MIDI_GetPPQPosFromProjQN(take, reaper.MIDI_GetProjQNFromPPQPos(take, 0) + 1)
sourceLengthTicks = ppq * reaper.GetMediaSourceLength(reaper.GetMediaItemTake_Source(take))
timeSelStartTime, timeSelEndTime = reaper.GetSet_LoopTimeRange2(0, false, false, 0, 0, false)
timeSelStartTick, timeSelEndTick = reaper.MIDI_GetPPQPosFromProjTime(take, timeSelStartTime), reaper.MIDI_GetPPQPosFromProjTime(take, timeSelEndTime)
timeSelLengthTicks = timeSelEndTick - timeSelStartTick
while (timeSelEndTick + timeSelLengthTicks <= sourceLengthTicks) do
reaper.MIDIEditor_OnCommand(editor, 40888) -- Edit: Duplicate events within time selection, if any (smart duplicate) (do not trim notes) (all editable)
timeSelStartTick, timeSelEndTick = timeSelEndTick, timeSelEndTick + timeSelLengthTicks
reaper.GetSet_LoopTimeRange2(0, true, false, reaper.MIDI_GetProjTimeFromPPQPos(take, timeSelStartTick), reaper.MIDI_GetProjTimeFromPPQPos(take, timeSelEndTick), false)
end
reaper.Undo_EndBlock2(0, "Repeat duplication to take end", -1)
This one is a bit more versatile, as it repeats the selected events within time selection up to the edit cursor position:
Code:
-- Repeat selected events within time selection up to edit cursor position
reaper.Undo_BeginBlock2(0)
editor = reaper.MIDIEditor_GetActive()
take = reaper.MIDIEditor_GetTake(editor)
cursorTime = reaper.GetCursorPositionEx(0)
cursorTicks = reaper.MIDI_GetPPQPosFromProjTime(take, cursorTime)
-- Bug: After duplication, REAPER maintains time selection *time* length, instead of *tick* length.
-- which causes problems when duplicating across tempo changes.
-- So must reset time selection length after each duplication.
timeSelStartTime, timeSelEndTime = reaper.GetSet_LoopTimeRange2(0, false, false, 0, 0, false)
timeSelStartTick, timeSelEndTick = reaper.MIDI_GetPPQPosFromProjTime(take, timeSelStartTime), reaper.MIDI_GetPPQPosFromProjTime(take, timeSelEndTime)
timeSelLengthTicks = timeSelEndTick - timeSelStartTick
while (timeSelEndTick + timeSelLengthTicks <= cursorTicks) do
reaper.MIDIEditor_OnCommand(editor, 40888) -- Edit: Duplicate events within time selection, if any (smart duplicate) (do not trim notes) (all editable)
timeSelStartTick, timeSelEndTick = timeSelEndTick, timeSelEndTick + timeSelLengthTicks
reaper.GetSet_LoopTimeRange2(0, true, false, reaper.MIDI_GetProjTimeFromPPQPos(take, timeSelStartTick), reaper.MIDI_GetProjTimeFromPPQPos(take, timeSelEndTick), false)
end
reaper.ApplyNudge(0, 1, 6, 1, cursorTime, false, 0) -- Reset cursor position
reaper.Undo_EndBlock2(0, "Repeat events up to cursor position", -1)