Back Forum Reply New

Function to kill segment of audio?

I'm trying to write my first function and I need a little help.
#Script
AVISource(quot;C:\WINDOWS\Desktop\Scripts\Dream12.aviquot;)
Function KillPartofAudio (int a,int b){Trim(0,a-1)+Trim.killaudio(a,b)+trim(a,0)
}
KillPartofAudio(20,200)

I don't think it's possible for one part of the video not to have audio while the others do. You should probably add a silent dummy audio track to the part where you want to have silence, use BlankClip for that.

EDIT: This might be helpful:

function AddAudio(clip v1) { v2 = Blankclip() v1 = AudioDub(v1,v2) return v1
}@ Boulder Thanks I'll switch to dubbing audio from Blankclip() to the section I want to kill the audio on.

That solves half the problem. I thought I'd test the trim part of the function before removing the audio from the middle clip so the script now reads

[
#Script
AVISource(quot;C:\WINDOWS\Desktop\Scripts\Dream12.aviquot;)
Function KillPartofAudio (clip last,int a,int b){Trim(0,a-1)+Trim(a,b)+trim(a,0)
}
KillPartofAudio(20,200)
#I get a message stating illegal arguments to Trim. Where did I go wrong?

I get a message stating illegal arguments to Trim. Where did I go wrong?

Is your script exactly as you posted it?  It's possible you neglected to give Trim a clip to operate on (although the trick of naming the input clip quot;lastquot; should have worked).

Also, you should be careful about using Trim that way.

It might be easier to use my JDL_Silence function with ApplyRange:
Code:
ApplyRange(20, 200, quot;JDL_Silencequot;)Originally posted by stickboy
[B]Is your script exactly as you posted it?

You were right. I was working on a different computer before so I can't swear to it, but I pasted from the post into a new script and it worked.
Of course the one you've already made is more concise. Maybe in about 15 years I'll be able to write close to that well
¥
Back Forum Reply New