Audacity Bug Summary
••• Introduction •••
••• Keywords •••
    Audacity 3.0.3 development began 19th April 2021

Audacity Bugzilla



Bug 2288 - Audio clips may overlap
Audio clips may overlap
Status: REOPENED
Product: Audacity
Classification: Unclassified
Component: Other
2.4.0
Per OS All
: P4 RepeatableAll
Assigned To: Default Assignee for New Bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-01-18 13:49 UTC by Steve Daulton
Modified: 2021-08-30 14:47 UTC (History)
7 users (show)

See Also:
Steps To Reproduce:
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. Observe: A: That the end of the first audio clip is now inside the start of the second audio clip.
Release Note:
First Git SHA:
Group: ---
Workaround:
Closed: 2020-03-12 00:00:00
james.k.crook: Must‑Test‑All‑OS-
petersampsonaudacity: Test‑OK‑Win+
petersampsonaudacity: Test‑OK‑Mac+
stevethefiddle: Test‑OK‑Lin+


Attachments
minimal example project (264.48 KB, application/zip)
2020-01-18 13:49 UTC, Steve Daulton
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Daulton 2020-01-18 13:49:00 UTC
Created attachment 898 [details]
minimal example project

In the attached project, the two audio clips overlap.
I believe this should never happen.
Comment 1 Peter Sampson 2020-01-20 04:19:24 UTC
There are no Steps to reproduce - indicating how this overlapping clips state was achieved
Comment 2 Steve Daulton 2020-01-20 05:33:11 UTC
(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.
Comment 3 James Crook 2020-03-02 13:14:23 UTC
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.
Comment 4 Peter Sampson 2020-03-03 07:11:44 UTC
(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.
Comment 5 Peter Sampson 2020-03-03 07:14:05 UTC
(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.
Comment 6 Peter Sampson 2020-03-03 07:20:46 UTC
OOPS sorry - retesting on latest 2.4.0 shows that Mac and Win behaviors are identical - no clip mark is inserted
Comment 7 Steve Daulton 2020-03-12 19:03:28 UTC
Tests good on Linux.

Also, I've not been able to reproduce the problem with Truncate silence, so looks all good.
Comment 8 James Crook 2020-03-22 15:26:28 UTC
Had to revert the fix because of unintended consequences.
Comment 9 James Crook 2020-04-08 17:04:35 UTC
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.
Comment 10 Peter Sampson 2021-08-30 14:47:30 UTC
Downgrading this as Muse are planning for oberlapping clips