Bugzilla – Bug 1707
MIDI Loop Play misses first few notes on looping.
Last modified: 2018-08-20 11:46:03 UTC
Loop play seems to take several beats to recover playing on looping, missing out notes you would expect to hear played.
(In reply to James Crook from comment #0) I cannot reproduce this on either W10-CE audacity-win-ra45f3bb-2.2.0-alpha-22-jul-17 or macOS Sierra 10.12.6 6cb8852 On both I get perfect loop play Are you sure you are selecting the beginning of the "notes" - if you select in the middle of a "note" and press play the "note on" command will not be sent (this is a known "feature").
Created attachment 731 [details] James Bond MIDI file. Loop play from 30s to 34s
*** STEPS UPDATED *** I think I've narrowed the problem down a bit further as a result of comment 1. MIDI does not send note off events for the notes it is abandoning at the end of the loop, and those can suppress the new notes coming in at the start. I've attached the james bond theme tune so that you can try it out. Yes I am sure of the problem.
It's specifically channel #8 that is causing the problem. It's a 'drone' background. Click 8 to mute it and the other loop play channels play once again. One gets an even more marked effect buy selecting 31s to 34s.
(In reply to James Crook from comment #2) OK - yes I confirm I see this on W10 with your James Bond30-34 seconds
Added keyword MIDI.
AudioIO::AllNotesOff, with AUDIO_IO_GB_MIDI_WORKAROUND defined (as it is), looks like just the thing to fix this looping, although the original motivation for that code was to compensate for GarageBand not stopping the notes when it should have. It uses simple tracking of notes-on that are not yet paired with notes-off. The place to insert the call would be at the comment // jump back to beginning of loop in AudioIO::OutputEvent. James, will you try this out? PRL
Re Comment#7 Didn't work. The code reads: if (mNextEvent == &gAllNotesOff) { AllNotesOff(); if (mPlayMode == gAudioIO->PLAY_LOOPED) { // jump back to beginning of loop mMidiLoopOffset += (mT1 - mT0); PrepareMidiIterator(false, mMidiLoopOffset); } else { mNextEvent = NULL; } return; } Adding an extra AllNotesOff() makes no difference, as the code has just executed one. MIDI is 2.9 seconds in to the second time round the loop before it gets in to this 'if'. So other code is setting mNextEvent to gAllNotesOff 2.9s too late. Possibly (mistakenly) adding note-off events that are past mT1 to the queue? I think I've got a fix for this and am checking I didn't break anything else in the process. Will update this bug shortly.
DEVEL - FIX MADE https://github.com/audacity/audacity/commit/dddac6e47df6988cddb801e2dcbcc0fee3e2bfe5
(In reply to James Crook from comment #9) Tested on macOS Sierra 10.12.6 aae0c4c 04Aug17 Used the James bond theme MIDI file Set snap to seconds selected 30-34 seconds Pressed Shift+Play button Result - pefect looped playback So I will mark this as ok on Mac. I can't test on Windows as there are still no Windows nightlies! ------------------------------------ One oddity this testing has uncovered - which will probably need to be logged as a separate bug: pressing Shift+Space does not invoke the loop play (it shows in the prefs as the shortcut and it works with auudio tracks), Happend on Windows as well as Mac.
This has the test_single_OS keyword and was tested on Mac by Peter; Therefore RESOLVED FIXED (I tested on Windows as part of fixing it, but that does not count as fixer does not close)