View Full Version : Waveform v2.0.2 - anti-aliasing and support for all colourspaces
wonkey_monkey
15th May 2021, 18:49
https://i.imgur.com/EyVi3w6.png
Waveform v2.0.2 (http://horman.net/avisynth/download/waveform2.0.2.zip)
v2.0.2 adds frame property pass-through support
v2.0.1 fixes a minor but potentially crash-causing bug with RGB24/32/48/68 formats
Waveform is a rewrite of my old Waveform plugin with the following improvements:
Support for all Avisynth+ colourspaces
Anti-aliased waveforms
Fewer crashes, hopefully
When using "zoom" it no longer looks like the waveform is clipping if it goes out of bounds
Uses min/max of samples for a more accurate display of sample values
The "window" parameter is no longer restricted to integer values
waveform
========
An Avisynth plugin to display audio waveforms on video clips.
Usage
=====
Waveform(
(clip)
(float) window = 0
(float) height = 1/3
(float) zoom = 1
(bool) under = false
(bool) smooth = false
(bool aa = true
)
Parameters:
-----------
window (0):
The number of frames either side to display a waveform for
height (1/3):
>= 1 : height in pixels of waveform overlay
< 1 : total height of waveform display as a fraction of video height (default: 0.333)
zoom (1):
Scale up waveforms
under (false):
Display the waveform underneath the video instead of superimposed on it
smooth (false):
Smooth out waveforms
aa (true);
Anti-aliasing
This image shows the effect of the "smooth" and "aa" parameters on oversampled (more samples than pixels per frame) and undersampled audio (fewer samples than pixels per frame):
https://i.imgur.com/kxI74Ug.png
Selur
15th May 2021, 19:02
Nice! Thanks!
Cu Selur
StainlessS
15th May 2021, 19:06
Ooh Luvely Jubely, and version on the zip, outstanding. :)
Reel.Deel
15th May 2021, 19:24
Very nice, thanks wonkey :)
StainlessS
2nd March 2022, 20:20
Updated WaveForm_Filmstrip(Bool Under="False") # As Wonkey suggestion,
also removed marks arg as no longer supported in v0.3 x64 or Waveform v2.0.
Works now with older version waveform and newer v2.0
Function WaveForm_FilmStrip(clip c,int "Window",Float "Height",Bool "Under",Float "Zoom",Float "SubSize",Bool "ShowAudio",Int "W",Int "H") {
/* Waveform_FilmStrip:- by StainlessS @ Doom9 ::: https://forum.doom9.org/showthread.php?p=1965005#post1965005
Where ShowAudio=True, Requires WaveForm v2.0 plugin (c) Wonkey_Monkey, https://forum.doom9.org/showthread.php?t=182866
[Wonkey_Monkey, The Prince formerly known as David.]
WARNING - Marks arg no longer a setting in WaveForm v0.3 x64 or v2.0 - so removed from WaveForm_FilmStrip
Also, Made Under default False as Suggested by Wonkey.
WaveForm_FilmStrip(clip c,int "Window"=0,Float "Height"=0.333,Bool "Under"=FALSE,Float "Zoom"=1.0,Float "SubSize"=0.0,Bool "ShowAudio"=True,Int "W"=-1,Int "H"=W_Based)
Window, Default 1 (0 <= Window <=3), Filmstrip thumbnail Images across = 2 * Window + 1.
Height, Default 0.333=1/3 of FilmStrip Height. See Waveform docs for more.
Under, Default False, If True, then audio graph stacked under video, else overlay over video.
Zoom, Default 1.0. Amplify audio signal for viewing (1.0=No Amp).
SubSize, Default 0.0(0.0 <= SubSize <= 1.0). Suggest 0.0(No Frame Number) to about 0.5. : 1.0=biggest size for current clip Height (probably too big).
ShowAudio, Default True. If False, Switches OFF WaveForm Display, Shows FilmStrip Only.
W, Default -1. Governs width of thumbnail images making up the FilmStrip.
-ve) Entire FilmStrip width (multiple thumbnail images based on Window arg) will be about same [smaller or equal] as input clip width.
0) Each FilmStrip thumbnail image is SAME size as input clip, result could be a quite wide clip.
Else) Each FilmStrip thumbnail image Width is set by W (best Mod 2).
H, Default based off W. (Suggest Dont supply H arg, let it default based on W arg. Can call with H=Undefined where will behave as if defaulting).
IF H is Supplied ie not defaulted THEN H = Supplied H # could be -ve, 0, or +ve(explicit height).
else if W <= 0, then H = W, ELSE H = input clip height Aspect Ratio Scaled to match W.
Here, H could be -ve, 0, or +ve, defaulted or non defaulted.
Where H,
-ve) FilmStrip height scaled down to Aspect Ratio match FilmStrip width of individual thumbnail images.
0) Each FilmStrip thumbnail image Height is SAME size as input clip height.
Else) Each FilmStrip thumbnail image Height is set by H (best Mod 2).
*/
Window=Default(Window,0) Height=Max(Default(Height,0.333),0.0) Under=Default(Under,false) SubSize=Default(SubSize,0.0) ShowAudio=Default(ShowAudio,True)
W=Default(W,-1) H=Default(H,W<=0?W:Int(W.Float/c.Width*c.Height)/2*2)
Assert(0 <= window <= 3,"WaveForm_FilmStrip: 0 <= window <= 3")
Assert(0.0 <= SubSize <= 1.0,"WaveForm_FilmStrip: 0.0 <= SubSize <= 1.0")
Frms = 1 + (2*Window) WW=(W<0)?c.Width/(Frms*2)*2:(W==0)?c.width:W HH=(H<0)?c.Height/(Frms*2)*2:(H==0)?c.Height:H
sc=(WW!=c.Width||HH!=c.Height) ?c.BiCubicResize(WW,HH,b=-0.5,c=0.25) :c scSubsSz=Round(sc.Height*SubSize)
SSS="""Subtitle(String(current_frame,"%.0f")""" + String(scSubsSz,",SIZE=%.0f") + String((sc.Height-scSubsSz)/2.0,",Y=%.0f") + """,align=8)"""
sc=(scSubsSz!=0)?sc.ScriptClip(SSS):sc bc=sc.BlankClip(Length=1,Color=$000000)
p1c=bc+sc p2c=bc+p1c p3c=bc+p2c
n1c=sc.FrameCount>1?sc.Trim(1,0)+bc:bc n2c=n1c.FrameCount>1?n1c.Trim(1,0)+bc:bc n3c=n2c.FrameCount>1?n2c.Trim(1,0)+bc:bc
Select(Window,sc,StackHorizontal(p1c,sc,n1c),StackHorizontal(p2c,p1c,sc,n1c,n2c),StackHorizontal(p3c,p2c,p1c,sc,n1c,n2c,n3c))
\ .AudioDubEx(c).Trim(0,-c.FrameCount).DelayAudio(0.0)
return (ShowAudio && HasAudio) ? WaveForm(window=Window,height=Height,under=Under,zoom=Zoom) : Last
}
Test Client
#AviSource("D:\G.avi")
Colorbars.Trim(0,-100)
WINDOW = 3 # Frames Wide = 2 * WINDOW + 1
HEIGHT = 0.33 # Audio graphs height, 0.333 = 1/3 of result filmstrip image height.
UNDER = false # True, then audio graphs stacked under video, else overlay over video.
ZOOM = 1.0 # Amplify audio signal for viewing (1.0=No Amp).
SUBSIZE = 0.5 # Suggest 0.0(off) to about 0.5. (0.0 <= SubSize <= 1.0) : 0.0 = No Frame Number, 1.0=biggest size for current clip Height (probably too big).
SHOWAUDIO = True # Default True. If False, Switches OFF WaveForm Display, Shows FilmStrip Only.
W = 264 # Default -1, (or 0 or +ve). -1 = Normal Downscale behaviour, filmstrip width ~= input clip width.
#H = Undefined # Undefined, Let W govern height of thumbnail images (or just dont use h=H in function call, same as h=Undefined).
###### Can Remove this lot ######
TONE = False # Replace Colorbars tone with selected TONETYPE tone
TONETYPE ="NOISE" # Pick from:- "Silence", "Sine", "Noise", "Square", "Triangle" or "Sawtooth"
TONECHANS = 5 # Tone Channels Count (test channels display)
#
(TONE) ? AudioDub(Tone(Length=FrameCount/FrameRate,Type=TONETYPE,Channels=TONECHANS)) : Last
###### End Of Can Remove ######
WaveForm_FilmStrip(window=WINDOW,Height=HEIGHT,under=UNDER,zoom=ZOOM,subSize=SUBSIZE,ShowAudio=SHOWAUDIO,w=W) #,h=H)
Return Last
[clickme] 1st frame of clip, 7 thumbnails wide (window=3 : thumbs = 2 * Window + 1)
https://i.postimg.cc/Z9jVqxvS/a-01.jpg (https://postimg.cc/Z9jVqxvS)
EDIT:
Or with client settings
WINDOW = 1 # Frames Wide = 2 * WINDOW + 1
HEIGHT = 0.33 # Audio graphs height, 0.333 = 1/3 of result filmstrip image height.
UNDER = false # True, then audio graphs stacked under video, else overlay over video.
[click me] Last frame of clip, 3 thumbnails wide (window=1).
https://i.postimg.cc/xJWy4xb9/a-00.jpg (https://postimg.cc/xJWy4xb9)
EDIT: This posted elsewhere, repost here
And here with SHOWAUDIO=TRUE [but animated gif(via VDub2 export) dont have audio, so silent]
https://i.postimg.cc/6p1FqnD7/Waveform-Filmstrip.gif (https://postimg.cc/xXM6FJjY)
StainlessS
2nd March 2022, 21:20
Wonkey, can you check out whats happening here, [weird horizontal lines] {ALSO: See above post}
#AviSource("D:\G.avi")
Colorbars.Trim(0,-100)
WINDOW = 1 # Frames Wide = 2 * WINDOW + 1
HEIGHT = 0.33 # Audio graphs height, 0.333 = 1/3 of result filmstrip image height.
UNDER = false # True, then audio graphs stacked under video, else overlay over video.
ZOOM = 0.7 # Amplify audio signal for viewing (1.0=No Amp).
SUBSIZE = 0.5 # Suggest 0.0(off) to about 0.5. (0.0 <= SubSize <= 1.0) : 0.0 = No Frame Number, 1.0=biggest size for current clip Height (probably too big).
SHOWAUDIO = True # Default True. If False, Switches OFF WaveForm Display, Shows FilmStrip Only.
W = 264 # Default -1, (or 0 or +ve). -1 = Normal Downscale behaviour, filmstrip width ~= input clip width.
#H = Undefined # Undefined, Let W govern height of thumbnail images (or just dont use h=H in function call, same as h=Undefined).
###### Can Remove this lot ######
TONE = true # Replace Colorbars tone with selected TONETYPE tone
TONETYPE ="SINE" # Pick from:- "Silence", "Sine", "Noise", "Square", "Triangle" or "Sawtooth"
TONECHANS = 5 # Tone Channels Count (test channels display)
#
(TONE) ? AudioDub(Tone(Length=FrameCount/FrameRate,Type=TONETYPE,Channels=TONECHANS)) : Last
###### End Of Can Remove ######
WaveForm_FilmStrip(window=WINDOW,Height=HEIGHT,under=UNDER,zoom=ZOOM,subSize=SUBSIZE,ShowAudio=SHOWAUDIO,w=W) #,h=H)
Return Last
https://i.postimg.cc/02DXtTWx/a-02.jpg (https://postimages.org/)
I'de never used v2.0 as Waveform_Filmstrip did not work because of removed Marks arg.
[old v0.3 x86 did not produce the lines, I think]
EDIT: TONECHANS=4 produces 1 line, 5=2 lines, 6=3 lines.
TONECHANS=9
https://i.postimg.cc/FRnFBdKf/a-03.jpg (https://postimages.org/)
TONECHANS=9 UNDER=TRUE
https://i.postimg.cc/rwzBfnr9/a-04.jpg (https://postimages.org/)
wonkey_monkey
2nd March 2022, 22:47
There was a small bug in the code for drawing lines when applied to interleaved RGB formats (because they're upside-down). Now fixed, link in first post updated.
StainlessS
2nd March 2022, 22:55
Tanks WubbleYou Em,
Seems to have done the trick.
EDIT:
Perhaps I should add an anti-alias aa arg to WaveForm_FilmStrip(Bool "aa"),
and just pass it as named arg to WaveForm(aa=aa),
[without any default in WaveForm_FilmStrip(), just use Waveform default].
Anyways, if anybody wants it do as described in this edit.
mastrboy
15th March 2022, 16:03
Is there a download mirror available? http://horman.net/avisynth/download/waveform2.0.1.zip does not work for me, it just times out...
kedautinh12
15th March 2022, 16:42
Work well for me, but here a ggdrive link
https://drive.google.com/file/d/1RmbZm5ns2_6FW-QYuzLbrfBsyuCkERK3/view?usp=drivesdk
Selur
15th March 2022, 16:43
works here, may be https://easyupload.io/q8g8va works for you,..
(*gig* kedautinh12 was faster)
mastrboy
17th March 2022, 22:04
Thanks for sharing kedautinh12 and Selur, I was able to get the plugin now.
Not sure why I get connection timeout against the original link, I didn't do much troubleshooting other than testing 2 different browsers...
shae
20th March 2022, 15:31
So refreshing to see small DLLs. :)
(Even if there are minor external DLL dependencies.)
Something you barely see today.
gispos
31st July 2022, 17:55
Waveform crashes when window=1 is set. Tested with AvsPmod and VDub. Waveform(window=1)
video YV12, audio 6 channels, 32bit 48000Hz
wonkey_monkey
1st August 2022, 21:52
Coudn't reproduce. What's the source filter? Does adding
Trim(0, framecount - 1)
make any difference?
gispos
2nd August 2022, 00:48
Coudn't reproduce. What's the source filter? Does adding
Trim(0, framecount - 1)
make any difference?
At the moment I can't reproduce it either. I don't know what script I had used. And there were only problems with window=1.
So forget it for now... Sorry. :o
SamKook
13th November 2022, 01:23
Nice to see an updated version, I really like audio displayed in waveform.
I was wondering if it would be possible to add something to make it very obvious when an audio channel is silent, like changing the color of the background or the line or something like that.
When it's near silent, it can take a bit to see when not zoomed in too much and with hd+ width and it's something I do a lot so would be nice to have a faster way to figure it out.
StvG
13th November 2022, 14:52
@wonkey_monkey, can you add support for frame properties passthrough?
wonkey_monkey
13th November 2022, 16:17
Does this work?
https://horman.net/avisynth/download/waveform2.0.2.zip
StvG
13th November 2022, 18:26
Does this work?
https://horman.net/avisynth/download/waveform2.0.2.zip
Yes, thanks.
hello_hello
14th November 2022, 06:28
Thanks!
triple_lei
26th August 2023, 00:33
Hiya. I've been using this plugin for work and it's been invaluable. I even made my own version of Filmstrip with the old version of this plugin before I knew Filmstrip was a thing (still like mine better though :D).
The one fly in the ointment is that this waveform plugin, and maybe all waveform plugins (I tried Audiograph as well) don't display certain sounds at all. I whipped up this comparison between this AviSynth plugin, Audacity, and Virtualdub2. Did my best to get them all zoomed in the same amount:
https://i.imgur.com/GVxqdhh.png
Here, this character is saying "showed up." Only the AviSynth plugins miss the "sh." It's uncomfortable to think we may be missing other sounds.
So, you know, let's squash this bug perhaps? Maybe I'll show off my version of Filmstrip if there's anymore activity in this thread at all...
StainlessS
26th August 2023, 12:13
Why not post your sample and Waveform args, or maybe we are supposed to guess.
My guess (given no sample) is that it is single channel mono and that audacity and VD2 both are showing as dual channel mono.
(Whereas Waveform is showing single channel mono as bottom channel and non exist channel as empty top channel)
[EDIT: Long since I've used Audacity, but I think there is option to show only single channel for mono]
Maybe I'll show off my version of Filmstrip if there's anymore activity in this thread at all...
Yes do.
EDIT: I note that Audacity and VD2 seem to show signals inverted compared to each other, and that Waveform shows similar polarity to audacity.
Also, maybe Waveform is using linear scaling, and the other two logarithmic.
EDIT: Given below post, sample and script is still a very good idea.
wonkey_monkey
26th August 2023, 12:51
The top one looks markedly different from the other two, as well as one of the channels being silent. Maybe whatever Avisynth input plugin/settings you're using is returning different channels, or is out of sync for some reason.
triple_lei
27th August 2023, 20:52
I actually replied yesterday, but 24 hours later and it's still not moderator-approved. Maybe it was too long with the script (which I'll link to instead), or maybe they didn't like the full 1080p image I didn't scale down first. So here goes...
The top waveform wasn't mono; I just chose not to show the other channel. :devil: Thought the image looked better that way, oh well.
And I'm certainly not going to put myself in hot water by including the original sample, so here's a 10-second clip of my local news instead.
Download link for sample: https://www.mediafire.com/file/mranzhjm7yfvmtb/waveform_testing.zip/file
Download link for script: https://www.mediafire.com/file/zhauv8srcsamqqo/filmstrip_triple_lei.txt/file
https://i.imgur.com/Ztj8BIE.jpg
Load this in VirtualDub2 at the 12:35:01:12 mark, go to View > Audio display, and you'll see the missing "sh" in "shut off."
Actually, I think I'll just transcribe the clip and highlight the missing & barely visible sounds in bold and red:
"The lawsuit, filed by the county, claims the utility company was negligent because they failed to shut off power despite extreme winds and dry conditions."
wonkey_monkey
28th August 2023, 20:00
You're using an old version. It averages values over the extent of whichever pixel it's drawing which acts as a low-pass filter. Version 2 (links in first post) doesn't do this unless you specify smooth = true. It does't have a "marks" parameter though so you'll have to take that out.
triple_lei
28th August 2023, 21:06
Excellent, thank you.
I thought I made the switch before by simply overwriting the old one (I remember having to redo my script a bit), but this time I copied the entire contents of the zip and pointed to C:\Program Files (x86)\AviSynth+\plugins64+\waveform\x64\waveform.dll and that works.
I always suspected it was only one tweak away from perfection. Just didn't think it would be on my end! :D
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.