Log in

View Full Version : Problem normalizing audio


boshreek
16th April 2010, 12:17
hi
i have clip that have variable sound i mean some times its let say -10db and during the clip it jumps to let say 3db what i am trying to do is to make the whole clip has a db of -6
so i tried this (because the normalize plugin effects the entire waveform what i did is trim each frame and normalize it separately)


loadplugin("C:\Program Files\AviSynth 2.5\plugins\GScript.dll")
vid=DirectShowSource("01.avi")
current_frame = 0
end = vid.FrameCount()
global vid3 = vid.trim(0,0)

GScript("
while (current_frame < end ) {
vid3 = vid3 ++ vid.trim(current_frame,current_frame+1).Normalize(-0.6)
current_frame = current_frame + 1
}
")

return vid3


but the normalize did not affect the clip , i do not know why.

so is there a way to have the entire clip has a -6db
using avisynth

thanks

Gavino
16th April 2010, 13:13
global vid3 = vid.trim(0,0)
trim(0, 0) selects the entire clip; to select the first frame, use trim(0, -1).
No need for global either.
Also, there are other errors in the script. Try this:
loadplugin("C:\Program Files\AviSynth 2.5\plugins\GScript.dll")
vid=DirectShowSource("01.avi")
current_frame = 1
end = vid.FrameCount()
vid3 = vid.trim(0,-1).Normalise(0.5)

GScript("
while (current_frame < end ) {
vid3 = vid3 ++ vid.trim(current_frame,current_frame).Normalize(0.5)
current_frame = current_frame + 1
}
")

return vid3
With this sort of processing, it's possible in practice you will run into problems with excessive time or memory, depending on the size of your clip.

Edit: For a level of -6dB, I think you need to use Normalise(0.5), not Normalise(-0.6).

boshreek
16th April 2010, 19:03
hi
simple and perfect solution
thanks a lot friend