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

Reply
 
Thread Tools Display Modes
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
Old 09-09-2017, 01:13 PM   #2
Klangfarben
Human being with feelings
 
Join Date: Jul 2016
Location: Los Angeles, CA
Posts: 1,701
Default

Is this happening in 5.50 RC22? Will try on this end as well.
Klangfarben is offline   Reply With Quote
Old 10-15-2017, 11:47 AM   #3
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

I have just discovered something surprising: the amount of "drift" away from the grid position depends on the project sample rate.

Glueing MIDI items is in fact rendering-in-place, and somehow (I don't know why?) the audio sample rate affects the resolution of MIDI events too.

For example, when I use a high PPQ of 960000 together with a low sample rate of 8000, notes moves away from the grid by as much as 196 ticks. When the sample rate is 192kHz, the drift is 11 samples; and when the sample rate is 1MHz, there is no drift.

When I use the highest allowable PPQ of 2147483647 (= 32 bit signed integer) together with the highest possible sample rate of 100MHz, the notes are slightly off, but unnoticeable even at highest zoom.


The results may therefore suggest a way to fix this bug: under the hood, REAPER should perhaps always glue MIDI items at a sufficiently high sample rate relative to the PPQ?

Last edited by juliansader; 10-15-2017 at 12:04 PM.
juliansader is offline   Reply With Quote
Old 04-16-2018, 07:16 AM   #4
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,721
Default

This is likely that glueing happens at the project samplerate, so if you use some huge PPQ, tick positions will all be rounded to the project position in samples (e.g. 1/44100th of a second or 22uS)..
Justin is offline   Reply With Quote
Old 04-16-2018, 07:50 AM   #5
ivansc
Human being with feelings
 
Join Date: Aug 2007
Location: Near Cambridge UK and Near Questembert, France
Posts: 22,754
Default

I have a sort of philosophical question about this one.

I grew up on 192 ppqn in a MIDI-only sequencer & frankly have never really felt the need to us any more than that. Would someone mind telling me WHY so many people seem to want to work in higher - sometimes massively - values than this? To me it is about the trade-off between getting exactly the feel you want and having an excessively cluttered workspace.
What am I missing?
__________________
Ici on parles Franglais
ivansc is offline   Reply With Quote
Old 04-16-2018, 08:11 AM   #6
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by ivansc View Post
Would someone mind telling me WHY so many people seem to want to work in higher - sometimes massively - values than this? To me it is about the trade-off between getting exactly the feel you want and having an excessively cluttered workspace.
The links in the first post will give more background: The issue isn't human "feel", but rather the sequencing workflow.

The main problem is that, when gluing, MIDI events change position in order to align with ticks, as counted from the start of the first glued item. If the first item does not start precisely on the grid, all subsequent events may fall off the grid.

The idea was to use a PPQ with resolution as high or higher than the time resolution, so that a single tick increment will not move the event off the grid.

(It is therefore prudent to always start MIDI items on the grid. Users that do lots of precise alignments of MIDI and audio seem to encounter this issue most often)

Last edited by juliansader; 04-16-2018 at 09:48 AM.
juliansader is offline   Reply With Quote
Old 04-17-2018, 12:57 PM   #7
ivansc
Human being with feelings
 
Join Date: Aug 2007
Location: Near Cambridge UK and Near Questembert, France
Posts: 22,754
Default

Interesting. Given me a new way of looking at what I do. Thanks for the explanation.
__________________
Ici on parles Franglais
ivansc 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 01:54 PM.


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