Skip to content

"Truncate Silence" fails to work on any gaps between Clips #3988

Open

Description

@SteveDaulton

Bug description

"Truncate Silence" fails to remove silences.

Steps to reproduce

  1. Generate 30 second "Chirp".
  2. Make 5 splits are approximately regular intervals
  3. Move the clips so that there is a couple of seconds gap between the clips.
  4. Select All
  5. Apply "Truncate Silence" with these settings:
    Screenshot_2022-11-27_19-30-56

Expected behavior

The gaps to be reduced to 0.5 seconds.

Actual behavior

The selection gets smaller, but the clips don't move.

Audacity Version

current master / alpha / nightly build

Operating system

Any

Activity

  1. added
    AU3-bug
    regression
    and removed
    regression
    on Nov 27, 2022
  2. SteveDaulton commented on Nov 27, 2022

    @SteveDaulton
    MemberAuthor

    Also happens in 3.2.1 with default Preferences.

  3. DavidBailes commented on Nov 28, 2022

    @DavidBailes
    Collaborator

    Looks like the behaviour of truncate silence has always depended on the setting preferences > track behaviors > editing a clip can move other clips. Since this setting has been disabled by default, then with default settings, the behaviour of truncate silence is as described in this issue.

  4. petersampsonaudacity commented on Nov 28, 2022

    @petersampsonaudacity

    The other fundamental issue is that gaps between audio are not true Audacity "Silence" - if they were they would show as a flat line,

    They can be rendered to silence of course.

  5. petersampsonaudacity commented on Nov 28, 2022

    @petersampsonaudacity

    It also leads to this rather odd effect of changing the selection as though the pseudo-silence gap had been removed:

    Before Truncate Silence with default settings

    image

    After Truncate Silence with default settings

    image

  6. petersampsonaudacity commented on Nov 28, 2022

    @petersampsonaudacity

    Testing this also begs another question about a (to me somewhat odd) design decision.

    Just why is the default "Truncate to" set to be 0.5 seconds? Surely most users who want silence truncated want it truncated to zero?
    image

  7. SteveDaulton commented on Nov 28, 2022

    @SteveDaulton
    MemberAuthor

    Just why is the default "Truncate to" set to be 0.5 seconds?

    I believe that was chosen for reducing pauses in speech recordings. (Very handy for listening to lecture notes when there may be long pauses).

  8. petersampsonaudacity commented on Nov 28, 2022

    @petersampsonaudacity

    Looks like the behaviour of truncate silence has always depended on the setting preferences > track behaviors > editing a clip can move other clips. Since this setting has been disabled by default, then with default settings, the behaviour of truncate silence is as described in this issue.

    @DavidBailes I will later add a note to the Truncate Silence page of the Manual warning the reader about this.

  9. LWinterberg commented on Nov 28, 2022

    @LWinterberg
    Member

    How about this:

    1. Truncate Silence is moved to Edit > Remove Special
    2. A new option is added to Edit > Audio Clips called "Remove Gaps" which removes gaps between clips (Remove space between clips #3924)
    3. Truncate Silence is given permission to move clips around again if clips live within its selection
  10. SteveDaulton commented on Nov 28, 2022

    @SteveDaulton
    MemberAuthor
    1. Truncate Silence is moved to Edit > Remove Special

    That may be easier for people to find (now that it is no longer visible by default in the Effect menu), but technically "Truncate Silence" is an "Effect" (it processes the selected audio) rather than an "Edit". While this may seem a bit pedantic, there are some important differences in how effects behave compared to edits, for example when applied to a 16-bit track, an effect will resample the audio to 32-bit float and back to 16-bit (with dither by default), whereas edits do not modify the underlying data.

    2. A new option is added to Edit > Audio Clips called "Remove Gaps" which removes gaps between clips (

    I'm not a fan of duplicating functionality unless it is adding a new, unique benefit. As was (imo) previously the case with so many ways to zoom in and out, duplicate functionality increases clutter.

    3. Truncate Silence is given permission to move clips around again if clips live within its selection

    I think that's the correct solution.

  11. LWinterberg commented on Nov 28, 2022

    @LWinterberg
    Member

    I'm not a fan of duplicating functionality unless it is adding a new, unique benefit.

    The unique benefit would be that you could truncate silences between gaps while leaving the clips themselves intact with any silences that may be in them.

  12. SteveDaulton commented on Nov 28, 2022

    @SteveDaulton
    MemberAuthor

    The unique benefit would be that you could truncate silences between gaps while leaving the clips themselves intact with any silences that may be in them.

    Considering that can be done more easily than ever now that clips have drag bars (drag handles), what's the common use case that makes it worth developing and adding as a built-in rather than an optional plug-in? (It could be done with a Nyquist Macro).

  13. petersampsonaudacity commented on Nov 28, 2022

    @petersampsonaudacity

    The unique benefit would be that you could truncate silences between gaps while leaving the clips themselves intact with any silences that may be in them.

    That already happens with Edit > Truncate Silence

    Before

    image

    After

    image

  14. 2 remaining items

  15. SteveDaulton commented on Nov 28, 2022

    @SteveDaulton
    MemberAuthor

    Truncate Silence does not leave the clips intact if there's silence within them.

    That's right, but it looks like quite a fringe case. Even the example you gave above can be handled by Truncate Silence (by setting the "Detect Silence > Duration" greater than the flat line silences).

    It could be done with a Nyquist Macro

    I've had a look at this, and yes it can be done, though handling all possible edge cases gets a bit messy. I'm not convinced that there's sufficient demand to justify the development effort even for a Nyquist plug-in (developing in Nyquist is much quicker than C++)

  16. petersampsonaudacity commented on Nov 28, 2022

    @petersampsonaudacity

    No. Truncate Silence does not leave the clips intact if there's silence within them.

    Nor should it, as the silences in you example are part of the two clips.

  17. petersampsonaudacity commented on Nov 29, 2022

    @petersampsonaudacity

    @DavidBailes I will later add a note to the Truncate Silence page of the Manual warning the reader about this.

    I have added an advice div to the Truncate Silence page in the 3.2.2 alpha Manual for this., I added a P2 for the removal of that ednote for if and when this issue gets fixed:

    image

  18. changed the title [-]"Truncate Silence" fails[/-] [+]"Truncate Silence" fails to work on any gaps between Clips[/+] on Nov 29, 2022
  19. petersampsonaudacity commented on Nov 29, 2022

    @petersampsonaudacity

    Note that even if Editing a clip can move other clips is in it's default off setting then subsequent clips do not honor the off setting and can get moved regardless if the preceding clip has "silence" in it that gets deleted by the effect.

    Before

    image

    After

    image

    Note carefully that using Delete to remove the silence does honor the "off" setting

    image

    image

  20. petersampsonaudacity commented on Nov 29, 2022

    @petersampsonaudacity

    I have been thinking about this and it troubles me phiosophically and semantically that we are dealing with two different entities here:

    1. true "silence" flat line (or aproximately close) within a clip
    2. ''Gaps" between clips which play and get rendered as silence BUT which are NOT actually true silence

    image

    So maybe Truncate Silence should have an option added to its dialog for: Treat inter-Clip gaps as silence

    a) I'm not sure whether that should be defaulted "on" or "off" - possibly "on" would be the better choice

    b) It does not remove any of the discussions in this thread with regard to actions of Truncate Silence on the basis of the Editing a clip can move other clips setting.

    Mystery-Shopper reaction

    I did discuss this with my "Mystery-Shopper" and she was most definite that the gap is not the same thing as the silence

  21. LWinterberg commented on Nov 30, 2022

    @LWinterberg
    Member

    That may be easier for people to find (now that it is no longer visible by default in the Effect menu), but technically "Truncate Silence" is an "Effect" (it processes the selected audio) rather than an "Edit". While this may seem a bit pedantic, there are some important differences in how effects behave compared to edits, for example when applied to a 16-bit track, an effect will resample the audio to 32-bit float and back to 16-bit (with dither by default), whereas edits do not modify the underlying data.

    This is a "tail wagging the dog" approach. Menu structures should be made to meet the user expectations, not because of technicalities. Whether or not something might resample the track before execution certainly is not the guiding principle in finding a tool, and even if a user cares about resampling at all, surely the solution is to make truncate silence to not resample the track. Given that both trimming, silencing, splitting and joining are available from the edit menu, it's definitely possible.

    So maybe Truncate Silence should have an option added to its dialog for: Treat inter-Clip gaps as silence

    I mocked up adding such an option to the truncate silence dialog, but it turns an already confusing dialog even more confusing: It would require a tri-state toggle (truncate silence only, truncate gaps only, truncate silence and gaps), where the dB threshold wouldn't have any effect on the gaps. The dialog already is quite cluttered for what it does, and if you do just want to move all clips in the project back-to-back, it creates massive cognitive load for what could be a dialog-free one-click operation.

  22. SteveDaulton commented on Nov 30, 2022

    @SteveDaulton
    MemberAuthor

    Menu structures should be made to meet the user expectations

    Expectations may differ according to knowledge and experience, but I do see your point. "Silence Audio" in the Edit menu is technically an effect (generator), but everyone (including myself) seems to be happy with that. I'm just suggesting caution about implementing things in ways that are not technically correct.

    surely the solution is to make truncate silence to not resample the track

    Processing in Audacity is always done with 32-bit float data. Changing that would likely be a huge refactoring task with hardly any tangible benefits.

    It could be done by rewriting Truncate Silence as an actual "edit" operation, but then it would frequently create clicks at the edit points.

    Personally I think the best solution would be:

    1. Fix the current issue with Truncate Silence changing the selection differently from the actual length reduction.
    2. Add a new Edit menu command to remove gaps between selected clips ("Remove Gaps"?).
      (It may be a good idea to decide how / if Audacity will handle stereo clips that have different start / end times before developing this new command).
    3. In Truncate Silence, remove the -80dB limit for the threshold level, or at least allow it to be set much lower.

    (The reason that it has a -80 dB limit is historic - The effect was originally developed by Lynn Allan in 2007 with the dB level set by a multi-choice menu. The downside of the multi-choice menu was that the number of options has to be limited, but the advantage was that the final option was "Off-Skip" (equivalent to -inf dB). Ideally it would be a true logarithmic slider with a range -inf to 0dB, but Audacity does not currently have a widget like that.)

  23. petersampsonaudacity commented on Nov 30, 2022

    @petersampsonaudacity
    1. Add a new Edit menu command to remove gaps between selected clips ("Remove Gaps"?).

    That sound like a good idea.

    and then

    1. Truncate Silence could/should be made to work just on true "silences" within clips - and should properly honor the setting for Editing a clip can move other clips by only moving clips when this is set on.
  24. petersampsonaudacity commented on Nov 30, 2022

    @petersampsonaudacity

    Another really odd behavior is that if you turn on the Editing a clip can move other clips and then turn it off again the the "off" setting gets ignored.

    1. clear Audacity settings folder
    2. generate a thirty second chirp
    3. split it at 15 seconds
    4. move the second clip to the right
    5. Edit > Preferences >Tracks Behaviors
    6. Observe: Editing a clip can move other clips is "off" - default setting
    7. select all
    8. Truncate Silence
    9. Observe: nothing happens
    10. Edit > Preferences >Tracks Behaviors
    11. Turn Editing a clip can move other clips "on"
    12. select all
    13. Truncate Silence
    14. Observe: the inter-clip gap is removed
    15. Undo
    16. Edit > Preferences >Tracks Behaviors
    17. Turn Editing a clip can move other clips "off"
    18. select all
    19. Truncate Silence
    20. Observe: the inter-clip gap is removed

    But at step 20 I would expect the same behavior as at Steps 8-9 - as we now have the "off" setting so clips should not move.

  25. DavidBailes commented on Nov 30, 2022

    @DavidBailes
    Collaborator

    Another really odd behavior is that if you turn on the Editing a clip can move other clips and then turn it off again the the "off" setting gets ignored.

    I ran into this really confusing bug a short time ago, and I've logged it: #3998

  26. DavidBailes commented on Dec 1, 2022

    @DavidBailes
    Collaborator

    I ran into this really confusing bug a short time ago, and I've logged it: #3998

    And as I've commented on that issue, other settings have the same bug.

  27. self-assigned this
    on Feb 20, 2023
  28. added
    P3
    on Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

AU3-bugP3

Type

Fields

Priority

None yet

Effort

None yet

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions