View Single Post
Old 31st January 2013, 23:04   #9  |  Link
Sir BlunderBrain
Registered User
 
Join Date: Jun 2010
Posts: 11
Ok, this may not be exactly what you're after, but for what it's worth...

This sample uses ConditionalFilter together with the MinMaxAudio plugin to switch from clip a (black) to b (gray) when it encounters silence in the audio (after 4 sec in this case)

Histogram and the AudioGraph plugin (http://avisynth.org/warpenterprises/) are used for visualisation.

The drawback is of course that this operates on a per frame basis and can't take into account the length of the silence etc.

Code:
LoadPlugin("MinMaxAudio.dll")
LoadPlugin("AudGraph.dll")

a=BlankClip(color=color_black, pixel_type="YV12")
b=BlankClip(color=color_gray, pixel_type="YV12")

audio=Tone(type="Sine", frequency=3, level=0.7, length=4)+Tone(type="Silence", length=2)+Tone(type="Sine", frequency=3, level=0.7, length=4)

a=AudioDub(a,audio)
b=AudioDub(b,audio)

ConditionalFilter(a,a,b,"AudioRMS(0)", ">", "-48", show=true)

Histogram(mode="AudioLevels").ConvertToRGB32().AudioGraph(10)
You may also wanna want to check the documentation for the related runtime functions ScriptClip and ConditionalSelect

Another approach may be to find a way to analyze your audio outside of AviSynth and use a combination of ConditionalSelect and ConditionalReader to do the actual mixing in AviSynth.
Sir BlunderBrain is offline   Reply With Quote