Truncate Silence doesn't work properly [SOLVED]

Hi all,
I’m trying to implement truncate silence through the audacity script api in python. I followed the github and i’m working with that py as base.
I’m trying to delete silence (-35dB) from an audio file with bare minimum “duration” and “truncate to” (0.001).
These are my instructions:

audacity_pipe.do_command("TruncateSilence: Threshold={-35dB} Duration={0.001} Truncate={0.001}")
audacity_pipe.do_command("Export2: Filename={}".format(OutputPath+'DURATION_'+FileList[0]))

But all i got is the “noise” part and not the part i was trying to obtain. I’m pretty sure parameters are ok, if i try to do such thing with the gui of Audacity i get the desired effect.
I also tried a lot of different things and formats of output (dB-35, 0,001, 0.001, 0001, -35…) but i can’t get an error explaining why it didn’t work.

This works for me (using Audacity 3.1.0)

do_command('TruncateSilence:Action="Truncate Detected Silence" Compress="50" Independent="0" Minimum="0.001" Threshold="-20" Truncate="0"')

Worked on 3.0.5 too thank you very much. Apparently every parameter had to be explicit, dumb me for not trying such a thing before asking :angry: .

Yes, that appears to be the case with the Truncate Silence effect, though many of the other commands just fall back on default values when not specified.
The safe option is to make every parameter explicit.

Tip: Test scripting commands in the Macro editor (, then export the macro as a .txt file to see the exact syntax used.

Another tip: Quotes around values are not necessary for numeric values, but are required for string values that include spaces. When generating commands programmatically, it’s a good idea to ensure that all string values are quoted so that you can reuse the same code whether the value contains space or not.
(Depending on implementation, it may be necessary to escape the quote characters).

Enum values are always case sensitive.