how to use Truncate Silence

This section is now closed.
Forum rules
Audacity 1.3.x is now obsolete. Please use the current Audacity 2.1.x version.

The final version of Audacity for Windows 98/ME is the legacy 2.0.0 version.
Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: how to use Truncate Silence

Post by Gale Andrews » Mon Oct 26, 2009 9:52 am

jademan wrote:
Gale Andrews wrote: Imagine 10 seconds of silence in a 30 seconds track:

Settings of min 100, max 5000 give you:
compression 1: 5s
compression 2: 5s
compression 4: 2.5s
compression 10: 1s

Settings of min 2000, max 5000 give you:
compression 1: 6.888s
compression 2: 6.888s
compression 4: 5.416s
compression 10: 4.499s

Settings of min 2001, max 2001 give you:
compression 1: 3.889 seconds

Settings of min 1, max 2001 and min 1000, max 2001 both give you:
compression 1: 2.000 s
compression 4: 529 ms (why not 500)? ...
When I tried sandwiching a 10s silence between two 10s tones, I got in your first case:
4.999s, 4.999s, 2.574, 1.089s
in the second case:
6.888s, 6.888s, 5.416s, 4.499s
In the third case:
3.889
and in the fourth case:
2.000s, 1.279s.
Well, I can see why the maths might make my formula:

Min Silence: 1ms
Max Silence: <your required silence> + 1ms (so if you want 10ms, put 11ms here)
Silence compression: 1

produce the resultant silence you want for every silence, but how many cases in the quote above have you tried where the maths gives the expected result (and fundamentally, why do we get a resultant silence greater than the maximum)?

If I have that 30 seconds tone with a 1 seconds silence from 5s to 6s, and 10 seconds silence from 10s to 20s, then min silence 2000, max 4000 and compression 1, I might expect (ignoring maths) that the first silence will be left untruncated and the second will be 4 seconds long. The first silence is ignored and the second ends up at 5.888 seconds.

jademan wrote:
Gale Andrews wrote: I'm not a mathematician, so I've asked Phil (the author) if he can drop by and comment on the above findings, in particular the 529/500 ms discrepancy in the last example above, and whether the unequal truncation is expected in the scenarios quoted. If it helps, Phil quotes the maths as follows:

(output) = ((min) + (input - min)/compression) with the constraint that output < max
Yes. This helps. So inputs that are shorter in length than min are ignored (left alone). And inputs that are longer than min are compressed but only by the extent that they exceed the minimum (ignore) length. And the output is not to exceed the maximum specified.

However, since it is not intuitively obvious, don't you think this formula should be posted on the Truncate Silence Parameter screen ?
No, that's (possibly) for the Manual. But I think what is going on needs clarifying first.
jademan wrote: Perhaps also because the whole objective of this new algorithm is to compress the spaces, do you think the compression factor should be specified first, then the minimum and maximum?
Probably not.
jademan wrote:This leaves the question of why you get 529ms, I get 1.279s, and why our 30s and 45s DTMF tones silence periods don't match the formula. And there was another case (which is why i sandwiched) where a leading silence interval was unaltered altogether.
I omitted one part of the initial information Phil gave, which was that "If the section starts out with silence, that silence will be truncated to the minimum value."


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

pvanbaren
Posts: 1
Joined: Tue Nov 10, 2009 12:14 am
Operating System: Please select

Re: how to use Truncate Silence

Post by pvanbaren » Tue Nov 10, 2009 12:34 am

I've tracked down the problem here. Turns out that when the silence spanned a block boundary (default I think is processing with 262144 sample blocks) the code to handle the wrapping was messing up the calculation of silence duration. This resulted in erratic lengths in the retained silence.

This has been fixed, so now it should always hold to the formula:

(output) = ((min) + (input - min)/compression) with the constraint that output < max

If you want the previous behavior, without compression, then set min==max. With that setting, any silence <min will be untouched, and any silence >min will be truncated to min.

jademan
Forum Crew
Posts: 1425
Joined: Fri Jul 17, 2009 10:11 pm
Operating System: Windows 10

Re: how to use Truncate Silence

Post by jademan » Tue Nov 10, 2009 9:09 pm

Thanks, Phil.

I downloaded the latest 1.3.10-alpha nightly build at http://wiki.audacityteam.org/index.php? ... tly_Builds. The discrepancy with my DTMF test seems to be corrected. Many thanks.

porphyry5
Posts: 9
Joined: Mon Apr 05, 2010 11:44 pm
Operating System: Please select

Re: how to use Truncate Silence

Post by porphyry5 » Thu Nov 18, 2010 5:16 pm

Using 1.3.12 beta on xp+sp3, I cannot get "Truncate Silence" to work as stated. I searched the forum and obtained this formula for the effect's result.
pvanbaren wrote: This has been fixed, so now it should always hold to the formula:

(output) = ((min) + (input - min)/compression) with the constraint that output < max

If you want the previous behavior, without compression, then set min==max. With that setting, any silence <min will be untouched, and any silence >min will be truncated to min.
I want it to truncate all silences in all selected tracks such that no silence remains > 1 second, which should be the default. To test it I created 3 short tracks and inserted a 30 second silence at a different place in each track, selected all and applied Truncate Silence with the default setting (200, 1000, 4:1). The Compression factor overrode the Maximum and I got 7.5 second silences in place of 30. I repeated Truncate Silence and it did nothing, apparently it works only once on a given selection.

I recreated the 3 tracks with their 30 second silences and applied Truncate Silence again, this time with the Compression factor set to 1:1, in the hope that this might bypass the compression function completely and allow the Maximum silence condition to determine the output. I got exactly the same result as in the first trial, silences reduced to 7.5 seconds.

But the quote states that if min is set equal to max, and without compression, then the longest silence will be no more than max. So I tried again, 3 times, with min = max = 1000, and Compression ratios of 1:1, 4:1 and 10:1. In each case I got exactly the same result as before, 7.5 seconds of silence.

Apparently you cannot change the Compression ratio, and it over-rides any other setting.

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: how to use Truncate Silence

Post by steve » Thu Nov 18, 2010 5:46 pm

porphyry5, I think that the confusion is arising out of how Truncate Silence handles multiple tracks.
The assumption in Truncate Silence is that if you have multiple tracks then they are all meaningful components of the same project. So, for example, if you have a vocal track and a music track one above the other, then when you press play, both tracks will play. There will only be silence when both tracks are silent.

I presume that in your test there was some overlap of the silences on different tracks. The Truncate Silence effect would only be applied in periods where all tracks were silent.

If you wish to apply Truncate Silence so that it acts on silence in an individual track you must select just one track (at a time).
To apply Truncate Silence so that it acts on silence in an individual track, but apply it to multiple tracks, then select one track and apply it, then for each subsequent track you can use Ctrl+R to repeat the last effect.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

porphyry5
Posts: 9
Joined: Mon Apr 05, 2010 11:44 pm
Operating System: Please select

Re: how to use Truncate Silence

Post by porphyry5 » Fri Nov 19, 2010 3:10 pm

Thank you for your help. I'm writing a script to standardize all my mp3s with respect to playback volume and start and end silences. Thought I might speed up the process by doing them en masse, but as that's a nogo, I'll do each file individually.

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: how to use Truncate Silence

Post by steve » Fri Nov 19, 2010 3:42 pm

I'm not sure exactly what you are wanting to do, but it sounds like "Chains" could be useful.
See here: http://manual.audacityteam.org/index.ph ... dit_Chains
and here: http://manual.audacityteam.org/index.ph ... pply_Chain
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Locked