Bugzilla – Bug 2288
Audio clips may overlap
Last modified: 2021-08-30 14:47:30 UTC
Created attachment 898 [details] minimal example project In the attached project, the two audio clips overlap. I believe this should never happen.
There are no Steps to reproduce - indicating how this overlapping clips state was achieved
(In reply to Peter Sampson from comment #1) I have discovered two ways to create a project with overlapping audio clips. Both methods require having two (or more) audio clips that are not sample aligned. The simplest method to create the problem: 1) Launch Audacity 2) Generate 1 second tone 3) Copy the audio 4) Zoom in as far as possible 5) Press "k" to go to the end of the track. Note that the end of the track is visible, and the cursor is one "sample period" beyond the end of the track. 6) Click on the track at 0.999990 (about 2/3rds of the way through the gap between the end of the track and cursor position). 7) Paste. Note that the end of the first audio clip is now inside the start of the second audio clip. The other method I have found uses Truncate Silence to collapse the gap between clips that are not sample aligned. This will sometimes produce overlapping clips. Personally I think that all clips is a track should be aligned to exact sample times according to the sample rate of the track. To fix this bug, it may be sufficient to ensure that neither "WaveTrack::HandleClear" or "WaveTrack::Paste" create overlapping clips.
DEVEL - FIX MADE https://github.com/audacity/audacity/commit/e5dc8928dcc3a26bbd878d85682e9dbc1fd6f492 I have only fixed for the 'steps to reproduce'. IF truncate silence causes a similar bug, then it's a separate bug with a different root cause, possibly moonphase - and any rate needs good clear steps to reproduce. My fix makes the test for a time inside an interval succeed more often than before. The test for overlapping/joined was wrong (IMO). I have tested that a clip removed from a place can be inserted back in the same place, i.e. it still fits. That is the kind of thing that could 'go wrong' with my fix.
(In reply to James Crook from comment #3) I tested the steps to reproduce on W10 and macOS10.15.3 with Audacity 2.4.0 1174875. On both platforms there is now no overlap of the audio clips. Bit the behavior is different on the two platforms a) on W1o Audacity inserts a clip marker b) on Mac there is no clip marker inserted I don't know which of the two is intended behavior - or if differing behavior per platform is intended … But marks as OK for Win and Mac as there is no longer overlap at or near the join.
(In reply to Peter Sampson from comment #4) In spite of James' minus setting for Must Test All OS I think this should be tested on Linux due to the differing Mac/Win behaviors.
OOPS sorry - retesting on latest 2.4.0 shows that Mac and Win behaviors are identical - no clip mark is inserted
Tests good on Linux. Also, I've not been able to reproduce the problem with Truncate silence, so looks all good.
Had to revert the fix because of unintended consequences.
Oops, didn't note the commit. This was where I reverted the fix. https://github.com/audacity/audacity/commit/a0fd0f506c2ed17fd7cd70aacd65217b8ad1e8a8 Since the fix 'works' a version that is just for paste would allow us to close this bug without causing problems elsewhere. However, a review of clip boundaries is needed, so not sticking that sticking plaster on just yet.
Downgrading this as Muse are planning for oberlapping clips