Log in

View Full Version : Mute audio function


Floatingshed
6th May 2011, 14:12
Occasionally I need to be able to mute the first or last few frames of a video. Usually I do this by modifying the soundtrack but that seems rather a convoluted way of doing it.

Can somebody please point me in the right direction to make a function which will mute the audio for a pre-settable number of frames? I seem to be having a mental block about how to set the range of frames to be affected!

Thanks.

Gavino
6th May 2011, 14:39
For example, to mute the first n frames:
Trim(0, -n).Amplify(0.0) ++ Trim(n, 0)

It would be nice to use ApplyRange for this, but unfortunately it does not change the audio track.

Floatingshed
6th May 2011, 17:05
This is what I had considered but thought it a bit crude but clearly it is the only option.
Shame ApplyRange isn't useful here. Thanks Gavino.

Gavino
6th May 2011, 17:35
Actually, I spoke too soon.
Just checked the docs (and the source code) and ApplyRange does process the audio (since v2.53), so the previous example could be done as
ApplyRange(0, n-1, "Amplify", 0.0)

Sorry for misleading you.

Floatingshed
13th May 2011, 21:58
This works perfectly but how about if I want to mute n number of frames from the end of a clip?
Thanks.

J_Darnley
13th May 2011, 22:40
Use almost exactly the same thing:
applyrange( framecount-n, framecount, "amplify", 0 )

Floatingshed
14th May 2011, 10:05
Simple, thanks. I don't know why my brain won't work!