View Single Post
Old 09-06-2017, 11:57 AM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default If using large PPQ, note position and length change by thousands of ticks when gluing

This bug report is a spin-off from two other reports:

Merge MIDI-items and
MIDI Item Glue 'BUG'.

When gluing, notes positions and lengths can be expected to change slightly in order to align the notes with MIDI ticks, as counted from the start of the glued item.

However, these "quantize to tick" shifts should never amount to more than one tick, since the MIDI events are supposed to remain as close as possible to their original positions.

When I tested gluing of MIDI items in the test projects discussed in these bug reports, I noticed that if I use large PPQs, note positions and lengths change by much more than one tick during gluing. The higher the PPQ, the greater the number of ticks changed: If I use the a PPQ of 32767 (=2^15-1), notes shift by about one tick. If I use a PPQ of 2147483647 (=2^31-1, which is apparently REAPER's maximum PPQ**), notes shift by thousands of ticks.

The following test project was provided in the above-mentioned threads:

Glue test 2.RPP

Quote:
Originally Posted by juliansader View Post
I noticed something else that is disconcerting, and which happens even in older versions such as v5.40:

Some other DAWs such as Digital Performer and Samplitude avoid these issues by using huge PPQs internally, which practically have the same resolution as time-based positions.

I therefore re-tested the gluing with large PPQs and discovered that the note -- and other notes that I draw myself -- shift away from their original grid positions by several dozen ticks, and also lengthen by variable numbers of ticks. For example, when using a PPQ of 1536000, the note position shifts to 24 ticks before the beat, and lengthens by 60 ticks.

These changes happen even when gluing each of the two items separately.

These changes amount to a mere few microseconds, but are still undesirable: Surely any quantize-to-tick shifts during gluing should never be more than a single tick?

** If I try any higher PPQs, REAPER misinterprets the values, sometimes even using a PPQ of "1".

However, while 2147483647 works for gluing, it is incompatible with other MIDI functions such as MIDI_Get/SetAllEvts.

Last edited by juliansader; 09-08-2017 at 02:22 AM.
juliansader is offline   Reply With Quote