Normalize

From Avisynth wiki
Revision as of 15:00, 23 February 2016 by Raffriff42 (Talk | contribs)

Jump to: navigation, search

Raises (or lowers) the loudest part of the audio track to a given volume, which by default is the loudest possible without clipping.
This process is called audio normalization.

Syntax and Parameters

Normalize(clip clip [, float volume , bool show ] )

float  volume = 1.0
Set the amplitude of the loudest audio peak. Default = 1.0, (or 0dB, the maximum level possible without clipping).
For a particular decibel level, use the equation volume = 10 dB / 20
For example, set a -3dB peak with volume = 10-3/20 or 0.7079.
Where multiple audio channels are present, all channel gains are set in proportion. For example, if the loudest peak on the loudest channel comes to -10dB, by default a gain of +10dB is applied to all channels.
bool  show = false
If true, a text overlay (see image below) will show the maximum amplification possible without distortions.

Examples

  • Normalize signal to 98%
video = AviSource("video.avi")
audio = WavSource("audio.wav").Normalize(0.98)
return AudioDub(video, audio)
  • Normalize each channel separately (eg for separate language tracks)
video = AviSource("video.avi")
audio = WavSource("audio2ch.wav")
left_ch = GetChannel(audio,1).Normalize
right_ch = GetChannel(audio,2).Normalize
return AudioDub(video, MergeChannels(left_ch, right_ch))
LoadPlugin(p + "Waveform\waveform.dll") 
V=BlankClip(pixel_type="YV12", width=480, height=360).Loop
A=WavSource("music.wav")
AudioDub(V, A).AudioTrim(0.0, A.AudioDuration)
ScriptClip(Last, 
\ """Subtitle(Last, "frame "+String(current_frame), align=5)""")
Normalize(volume=1.0, show=true)
Histogram(mode="audiolevels")
Waveform(window=3)
return Last
NormalizeEx2 v1,0.png
(showing frame 2744, where the loudest peak was detected, but Amplify Factor is the same for all frames)
Personal tools