View Single Post
Old 06-25-2016, 12:40 PM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default Using MIDI_SetNote with noSort=true to move notes onto same pitch (SOLVED)

I am trying to write a script that would mimic the functionality of FL Studio's Slice Tool:

[EDIT: The script, whch can be found here, has since been updated with a workaround for this bug.]



Unfortunately, I encountered a problem that seems like a bug in REAPER's implementation of MIDI_SetNote. It is likely related to another bug report: Overlapping notes problem.

When MIDI_SetNote is used with noSort=true to move a note onto the same pitch as an existing note, the earlier note gets extended:
Code:
editor = reaper.MIDIEditor_GetActive()
take = reaper.MIDIEditor_GetTake(editor)
reaper.MIDI_Sort(take)
reaper.MIDI_SetNote(take, 0, nil, nil, 960*3, 960*3.5, nil, 60, nil, true)


If the two notes differ in selection status, the problem does not occur:



Strangely, when I use my Slice script (which also involves moving tiny notes into the line drawn by the mouse), the problem presents somewhat differently:
- Occurrence of the problem depends on whether the earlier note is close to the beginning of the take or not (as shown in the GIF below).
- Whether or not the notes differ in selection status does not seem to have any effect.


Last edited by juliansader; 09-19-2016 at 04:38 AM.
juliansader is offline   Reply With Quote