View Issue Details

IDProjectCategoryView StatusLast Update
0008209ardourbugspublic2020-06-05 21:24
ReporterTremeschin Assigned To 
Status newResolutionopen 
PlatformLinuxOSArch LinuxOS VersionRolling
Product Version6.0 
Summary0008209: Snaped MIDI notes ending not properly aligned to the grid based on their position + bpm + note size
DescriptionI decided to investigate this little issue I've been noticing that some midi notes weren't aligned at the end more often than not and sometimes on the start.

Turns out (explained better on additional information) that it depends on the bpm of the session, the note length and solely on their "horizontal" / time position on the track, happens on all vertical pitch / note notes.

It looks like an old issue I reported about midi region endings that have been solved, these tiny tiny misalignment on the ending of the region / note.

This issue is periodic, explained on additional information. Looks like a rounding error to start with.
Steps To ReproduceThose are the steps I made to get into this final result of the attached image:

With snap mode on, I changed the bpm of the session to the ones listed on the midi track name and drew alternating notes from the start to the end of a 8 bar long midi track, the "grid mode" or "note size" were (from the top to the bottom) bar, 1/4 note and 1/8 note.

I zoomed in the maximum possible on every note ending and set the note velocity to 127 to the ones which ending wasn't aligned properly to the grid. (so their colors are darker relative to others)

So basically put the right note length on the wrong spot for the issue to be revealed.
Additional InformationArdour compiled locally, commit 378a0af

waf configure -j 6 -p --optimize --cxx11

waf build -j 4 -p

JackAudio sample rate is 48 kHz (probably has to do with it as Ardour doesn't use "absolute time")

Haven't tested with a different sample rate because it's really annoying to go through the steps to reproduce again and restarting jack server and whatnot, pulseaudio.

(why the issue occurs?)

My intuition as a humble programming hobbyist says that there is a math.ceil() missing somewhere on the code that determines the midi note ending while on snap mode to the grid, causing this ( 1/sample_rate ? ) misalignment on the note endings.

It's somewhat very clear that when you analyze the image the issue is relative to the bpm of the session, as seen on the 120 and 60 bpm tracks, the position where the issue occurs doubles when halving the bpm, and with some bpm like 130 it occurs more often as it's a not-as-whole-number-as-120 internally.

My intuition says that this issue is present on a lot of possible note start positions but only shows up when the grid happens to match where the issue is happening, hence why on a more "broken" bpm like 150 it doesn't really follow an visible pattern with few information.

On the 130 bpm track, the issue is periodic and alternating as well as it depends on the note size (?), the 1/4 black note goes up up, down down while the 1/8 notes goes down up down up.
TagsNo tags attached.



2020-06-05 21:24


Issue History

Date Modified Username Field Change
2020-06-05 21:24 Tremeschin New Issue
2020-06-05 21:24 Tremeschin File Added: bug-report-midi-notes-ending-1.png
2020-06-05 21:24 Tremeschin File Added: bug-report-midi-notes-ending-2.png