From Avisynth wiki
Jump to: navigation, search
Author martin53
Version v0.5.4
Category Audio filters
License GPLv3
Discussion Doom9 Thread


[edit] Description

AudioTimeline adds an audio level graph to the bottom of a clip. When used in combination with a thumbsheet generator, the output looks similar to a vertically stacked set of 'optical audio' film strips, except that the audio is not center- but bottom aligned.

The audio level is displayed in dB RMS (green) and dB peak (blue). The first audio sample in the frame is displayed at the left edge of the frame, as it is with usual timeline representations. The number of samples to display can be chosen by setting the number of corresponding video frames. Settings with several hundred frames are OK.

Further, the display can be customized by choosing one mixed down frack for all audio tracks in the clip or single display tracks, the dB range and headroom, and the anti-alias low frequency.

The purpose of this plugin is to provide an intuitive audio display especially for clip thumbsheets, i.e. to give a quick indication of silent or loud clip parts together with the thumbnails.

[edit] Requirements

[edit] Syntax and Parameters

The AudioTimeline function returns a clip with hopefully source audio - but I don't know, and an audio display track at the bottom of the input clip. The background of the audio display is black. The rms and peak audio levels are displayed in green and blue as with the Histogram() function, and in yellow and red if the peak level exceeds the headroom level. If the pixel format is RGB32, then the background is transparent, the level display is 50% transparent.

AudioTimeline (clip, int "frames", float "mixdown", int "height", int "dBHeadroom", int "dBRange", int "loFreq")

clip   =
Input clip; must contain audio and video.

int  window = 1
This is the time scale measured in frames to display the audio for. The RMS and peak audio levels are calculated for each column of the frame. I.e. if clip.Width() is 640, all audio samples of the given frames range are grouped into 640 groups. The higher frames is, the more audio samples are averaged into one of the 640 level bars.
If the resulting audio averaging time per bar is lower than a half wave of loFreq (see below), then the RMS and peak sampling window is extended to both sides to the minimum of a half wave of loFreq. This avoids ugly level display aliasing. For RMS and peak calculation, the same sampling window is used.
The x axis of the audio display always starts with the frame start time, as it is standard for timeline display. I.e. the first level bar starts with frame start time, and all visible audio is in the future with respect to frame start time. If the sampling window is extended, it is extended symmetrically.
  • Range: 1 ... no upper limit

float  mixdown = 1.0
If >0, all audio channels are mixed down into one display track. If false, one display track per audio channel is displayed.
If -1 and stereo: as with >0, but maximum and rms from 2nd channel are subtracted from maximum and rms of 1st channel. Is useful with signal in 1st channel and noise in 2nd channel, which can be prepared with audio processing before calling AudioTimeline.

int  height = 0
This is the height of each audio display track (in pixels). If height is 0, 10% of clip.Height() is used (always even). If clip.IsYV12() is true, the next lower even number is used.
  • Range: 0 to 255

int  dBHeadroom = 6
dBHeadroom controls the peak indicator. If the measured peak level exceeds -dBHeadroom, the audio bar is displayed in yellow+red instead of green+blue. This is similar to the Histogram() function, but can be chosen freely here.
  • Range: >=0

int  dBRange = 66
dbRange controls the y scale bottom of the level display. Please note that the plugin uses 16 bit integer sampling, what makes extreme dBRange values useless. Often, only a 40 dB range may be desirable to have more display amplitude at higher levels.
  • Range: >=0

int  loFreq = 20
This controls the averaging window. A half wave of a 20Hz oscillation is 25ms long. With loFreq=20, the plugin extends the sampling window to at least 25ms, in order to avoid display aliasing because too few audio samples are averaged into the level bars. set this value accordingly to the lowest audio frequencies in the clip, or experiment.
The response time is affected by this setting: The lower this frequency, the less steep is the response of the display level when audio changes, because the sample windows overlap.
  • Range: >=10

[edit] Examples

Displays 10 seconds of audio of a 30fps clip as one channel. The height of the added audio track display is 10% of the original frame height, and the y axis bottom dB level is minus 40dB, so higher loudness is somewhat magnified.

AudioTimeline(clip, frames=300, dBRange=40)

Returns e.g. 0.5.4, 2017/03/10


[edit] Changelog

Version      Date            Changes
v0.5.4 2017/03/10 - recompile with new AviSynth+ header, VersionNumber replaced by VersionInfo, removed audio display gaps caused by integer calculation v0.500020 2015/12/16 - Works with AviSynth+ (SetCacheHints() removed, throws Division by 0 error with AviSynth+), small cleanup v0.500010 2015/02/20 - initial release

[edit] Archived Downloads

Version Download Mirror

[edit] External Links

Back to External Filters

Personal tools