Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 06-25-2016, 12:40 PM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,573
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
Old 09-17-2016, 05:40 AM   #2
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,088
Default

Quote:
You should be careful about what happens after calling MIDI_SetNote with noSort=true to change the timing and MIDI_Sort.. it looks like you're calling MIDI_sort first, too? That might be a bug...

Last edited by Justin; 09-17-2016 at 06:16 AM.
Justin is online now   Reply With Quote
Old 09-19-2016, 04:37 AM   #3
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,573
Default

I figured out why the extended note was happening!

Because the note on B1 was originally the earliest note, its Note-Off also had the lowest index of all the Note-Offs.

When SetNote with nosort=true was used to shift B1 to a later position and its pitch to C3, the index of its Note-Off remained the same, and therefore became the first *indexed* Note-Off on pitch C3, even though it actually had a later position than the first C3 note.

The MIDI editor therefore interpreted the shifted Note-Off at C3 as the Note-Off for the first C3 note. The first indexed Note-On got paired with the first indexed Note-Off at the same pitch (and with the same selected/muted status).
juliansader is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 08:12 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.