PDA

View Full Version : killing audio in *part* of a clip?


davidlallen
7th February 2004, 17:50
Folks,

How do I kill the audio from one part of a clip? I am using
avisynth 2.5.4 on a Win98SE 700 MHz P3. Suppose I have a 300
frame clip, and I want to have silence from 100-199 and the
normal audio in the rest of the clip. I tried:

c = DirectShowSource("c:\my video\test.mpg")
Trim(c,0,99) + \
KillAudio(Trim(c,100,199)) + \
Trim(c,200,300)

This gives an error, "Splice: one clip has audio and the other
doesn't (not allowed)". Then I tried:

c = DirectShowSource("c:\my video\test.mpg")
v1 = Trim(c,100,199)
a1 = Tone(Audiolength(v1), 0, Audiorate(v1), Audiochannels(v1), "silence")
Trim(c,0,99) + \
AudioDub(v1,a1) + \
Trim(c,200,300)

This plays the correct video but the whole thing is silent, instead
of having normal sound at the beginning and end. Oddly, changing
the audio line to this still results in complete silence:

a1 = Tone(Audiolength(v1), 440, Audiorate(v1), Audiochannels(v1), "sine")

Is there some simple method which I have overlooked?

Thanks in advance,
- Dave Allen: dave@jendaveallen.com

sh0dan
7th February 2004, 19:54
Simply use:

amplify(0.0) to kill the audio in that part.

KillAudio will remove the audio from a clip. amplify will just make it silent.

stickboy
7th February 2004, 20:44
And you may wish to use Amplify in conjunction with ApplyRange. e.g.:
ApplyRange(100, 199, "Amplify", 0.0)

davidlallen
7th February 2004, 21:08
Sh0dan,

> Simply use:
> amplify(0.0) to kill the audio in that part.

Works great, thanks. Out of curiosity, what did I do wrong
with the second example:

> v1 = Trim(c,100,199)
> a1 = Tone(Audiolength(v1), 0, Audiorate(v1), Audiochannels(v1), "silence")
> Trim(c,0,99) + AudioDub(v1,a1) + Trim(c,200,300)

- Dave Allen: dave@jendaveallen.com

sh0dan
7th February 2004, 22:47
AudioLength is in samples, and Tone takes seconds as parameter.

You cound also you unalignedsplice (++ instead of +). This will adjust the audiolength to the length of the video. Otherwise it will use the length of the sample in a1, and play the second part after sample a1 is finished.