PDA

View Full Version : New Filter: AudioGraph


WarpEnterprises
13th August 2003, 11:21
Richard Ling sent me this filter (2.0x), which will display the audio waveform on top of the video.

Give it a try.

http://www.avisynth.org/users/warpenterprises/files/audgraph_20_dll_20030808.zip

(very well documented source included!)

sh0dan
13th August 2003, 15:10
Nice filter - good for syncing sound!

I had a little time, so I made a AudGraph for AviSynth 2.5 (http://beta.zenaria.com/kpo/audgraph_25.zip). My additional notes:


- No YV12 support.
- Should support multiple channels.
- YUY2 mode made a bit more eyepleasing, IMO.
- - It makes the graph a bit more blocky.
- - YUY2 mode is converted to greyscale.


Not that well tested - provided without any kind of warranty. Source is of course included.

Wilbert
14th August 2003, 16:34
Very nice! Could you adjust it, so that the channels are shown separately (for example, on top of each other)?

stickboy
17th August 2003, 02:11
I too would like to be able to see the channels separated.

In the meantime, though:
# AudioGraphWrapper
#
# Wrapper function to AudioGraph. Displays each channel separately
# below the video. Each channel is displayed below the preceding
# channel.
#
# PARAMETERS:
# frameRadius
# channelHeight - the height to add to the bottom of the clip for each
# channel;
# (default: 100)
#
function AudioGraphWrapper(clip c, int frameRadius, int "channelHeight",
\ int "curChannel")
{
assert(c.AudioChannels() > 0, "AudioGraphWrapper: clip has no audio")

channelHeight = default(channelHeight, 100)
curChannel = default(curChannel, 1)

bottom = AudioDub(c.BlankClip(height=channelHeight), c.GetChannel(curChannel))
bottom = bottom.AudioGraph(frameRadius)

c = StackVertical(c, bottom)

return (curChannel == c.AudioChannels())
\ ? c
\ : c.AudioGraphWrapper(frameRadius, channelHeight,
\ curChannel=(curChannel + 1))
}

stickboy
17th March 2004, 22:04
When I try to use AudioGraph in conjunction with Tone, I get an access violation.AudioDub(BlankClip(pixel_type="yuy2"), Tone())
AudioGraph(1)leads to:Avisynth read error: caught an access violation at 0x01531159, attempting to write to 0x055d6000.
Some interesting quirks:
seems to happen only in YUY2
seems to happen only with Tone; if I use AVISource/WAVSource for the audio, it's fine. (I can even remove the AudioGraph line, save the audio track as a WAV file with VirtualDub, replace Tone() with that WAV file, and AudioGraph works fine again.)Anyone have any idea what's going on here?

WarpEnterprises
18th March 2004, 08:31
which AviSynth version? There are some recent changes in the audio handling...

stickboy
18th March 2004, 09:57
Oops. I should know better. :)

AviSynth 2.5.5 alpha (2004-03-14 build).

sh0dan
18th March 2004, 11:23
Redownload the file - I fixed the filter.

Or use ConvertAudioTo16bit() before Audiograph. Bug was a simple underscore (_) too much.

stickboy
18th March 2004, 20:57
Wow, that was really fast. Thanks!

lark
29th November 2004, 13:56
looks like an old thread, but does anyone have that fixed audgraph available?
i'd appreciate if it would be also changed in warpenterprises' collection...

regards
t :)

Wilbert
29th November 2004, 14:06
I have it. I will post it if my internet connection at home works again.

Wilbert
24th August 2007, 23:59
Just wanted to say that some japanese guy added YV12 support. It's based on the original version, thus not on Sh0dan's modifications: Viewaudio (http://nullinfo.s21.xrea.com/). Yes, it's from 2003 :)

LoadPlugin("ViewAudio.dll")
ViewAudio(clip, int frames, int top, int height, bool fill, int channel)

frames : ‘OŒã‚Ì•\ަƒtƒŒ[ƒ€”‚ðŽw’è (default : 2)
top : •`‰æŠJŽn y À•W (-1 ‚̂Ƃ« clip ‚̉º‚É•\ަ, default : -1)
height : •`‰æ—̈æ‚Ì‚‚³ (default : 80)
fill : •`‰æ—̈æ‚ð“h‚è‚‚Ԃ·‚©? (default : true)
channel : •`‰æ‚·‚鉹ºƒ`ƒƒƒ“ƒlƒ‹ (-1 ‚̂Ƃ«‘Sƒ`ƒƒƒ“ƒlƒ‹•\ަ, default : -1)

channel=-1 all channels are drawn, i think :)

mikeytown2
23rd March 2008, 22:56
Posting in here, in order to follow advice from IanB. Deleted my original post from this thread http://forum.doom9.org/showthread.php?t=123195

Bug Found:
This code fails after 30 seconds of playback
colorbars()
BilinearResize(720,480)
AudioGraph(10)
AviSynth give me this
CAVIStreamSynth: System exception - Access Violation at 0x0, reading from 0x0

How To Reproduce:
Open script MPC

VirtualDub doesn't fail, or maybe i didn't wait long enough; over 5 min worked.

AviSynth Version: 2.58 build sept 19 2007
MPC Version: 6.4.9.1


This code works in MPC
colorbars()
AudioGraph(10)



Computer Specs Below

mikeytown2
15th May 2008, 20:53
Feature Request:
Display Audio Spectrogram.
http://en.wikipedia.org/wiki/Spectrogram

My current way of doing this, which is not perfect at all.

Gram (http://www.visualizationsoftware.com/gram/gramdl.html) to output a jpg
ImmaRead (http://forum.doom9.org/showthread.php?t=135928) to read jpg (seems to work better with high res images)
KenBurnsEffect (http://forum.doom9.org/showthread.php?t=135776) to animate the jpg


Example Code

Global W = 640
Global H = 480
Global F = 29.97
Global D = 0
Global R = 48000
Global PicLen = Round(F*5)
Global Resizer = "BlackmanResize"
Global BlankPic = BlankClip(1, W, H, "RGB32", F, stereo=true, audio_rate=R).Loop()

NewTone()

Function NewTone()
{
sound = WavSource("Before-After.wav").SSRC(R) #305 Frames

pic = ImmaRead("spectrogram3300.jpg").AssumeFPS(F).ConvertToRGB32()
a = pic.ZoomBox(-1, 0, 0, 0, W, H, IgnoreAR=1, ResizeMethod=Resizer).Subtitle("Before After",align=2, size=48).Loop(PicLen)
a = a.AudioDub(BlankPic.Trim(0, a.Framecount()-1).KillVideo())
b = pic.Loop(Round(PicLen/3)).KenBurnsEffect(-1, 0, 0, 0, -567, 200, 757, -95, W, H, 4, useZoomBox=2, ResizeMethod=Resizer, endPZframe=Round(PicLen/3)-Round(PicLen/4))
b = b.AudioDub(BlankPic.Trim(0, b.Framecount()-1).KillVideo())
c = pic.Loop(305).KenBurnsEffect(-567, 200, 757, -95, 2461, 200, 3927, -95, W, H, 4, useZoomBox=2, ResizeMethod=Resizer)
c = c.AudioDub(sound)
d = pic.Loop(Round(PicLen/3)).KenBurnsEffect(2461, 200, 3927, -95, -1, 0, 0, 0, W, H, 4, useZoomBox=2, ResizeMethod=Resizer, startPZframe=Round(PicLen/4))
d = d.AudioDub(BlankPic.Trim(0, d.Framecount()-1).KillVideo())
e = pic.ZoomBox(-1, 0, 0, 0, W, H, IgnoreAR=1, ResizeMethod=Resizer).Subtitle("Before After",align=2, size=48).Loop(PicLen*2)
e = e.AudioDub(BlankPic.Trim(0, e.Framecount()-1).KillVideo())
a+b+c+d+e
}

http://img508.imageshack.us/img508/352/spectrogram3300lqox8.th.jpg (http://img508.imageshack.us/my.php?image=spectrogram3300lqox8.jpg)

Also, does anyone have a better way to add the audio, other then blankclips with audiodub?

AlanHK
28th January 2010, 00:57
Just wanted to say that some japanese guy added YV12 support. It's based on the original version, thus not on Sh0dan's modifications: Viewaudio (http://nullinfo.s21.xrea.com/). Yes, it's from 2003 :)


Google gives an intelligible translation (except for "Tokino Tamotsu View Channel"):
And CacheAudio in the same dll might be useful.

ViewAudio.dll v0.3.01 Copyright (C) 2002, 2003 minamina
http://nullinfo.s21.xrea.com/
================================================== ==============================
Avisynth Plugin - View Audio (YUY2 and YV12 Only)

- Description

Speech display filter for Avisynth
Modes for YUY2 and YV12 mode
Avisynth 2.5 only

Richard Ling's work AudioGraph add voice capabilities to the reference frame around the display capabilities
Thanks to Mr. Richard Ling

- How

LoadPlugin ( "ViewAudio.dll")
ViewAudio (clip, frames, top, height, fill, channel)

frames: before and after the specified number of frames displayed (default: 2)
top: start drawing y coordinate (-1, then at the bottom of the clip, default: -1)
height: The height of the drawing area (default: 80)
fill: you fill the drawing area? (default: true)
channel: Channel voice to draw (-1 Tokino Tamotsu View Channel, default: -1)

- Examples

ViewAudio ()
ViewAudio (1, 0)
ViewAudio (height = 200)

================================================== ==============================
Avisynth Plugin - Cache Audio

- Description

Audio cache filter for Avisynth
Avisynth 2.5 only

AudioSource random access are weak when used as an aid to edit

- How

LoadPlugin ( "ViewAudio.dll")
CacheAudio (clip, MaxFrame, BlockFrame)

Specify the maximum number of frames MaxFrame cache (default: 1000)
-1: For all frames (need lots of memory. Time-consuming at first view)
BlockFrame specify the number of frames read at once (default: 100)
-1: MaxFrame use the same value (requires a lot of memory. Time-consuming at first view)

- Examples

CacheAudio ()
CacheAudio (10000, 300)
CacheAudio (MaxFrame = 20000)

================================================== ==============================

- History

2003/11/03 v0.3.01 CacheAudio added
2003/10/06 v0.2.02 is wrong, correct the problem check the maximum number of frames displayed
2003/09/22 v0.2.01 also change the voice frame can be displayed around
2003/03/16 v0.1.01 Avisynth 2.5 support
YV12-mode
Born 2002/12/15 v0.0.01

Midzuki
26th February 2010, 06:49
Well, I've just discovered that the waveform generated by AudioGraph() can be made "more visible" (or "more annoying", depending on the point-of-view) by using «PointResize()». Example script:

LoadPlugin("C:\AVSplugins\AudGraph.dll")
vid=BlankClip(width=32, height=32, fps=15, \
length=3254).KillAudio()
aud00=WavSource("filename.wav")
aud01=WavSource("filename.wav").GetChannel(1)
aud02=WavSource("filename.wav").GetChannel(2)
left_ch=AudioGraph(AudioDub(vid,aud01),0).PointResize(256, \
256).AddBorders(16,16,16,16)
rite_ch=AudioGraph(AudioDub(vid,aud02),0).PointResize(256, \
256).AddBorders(16,16,16,16)
AudioDub(StackHorizontal(left_ch,rite_ch), aud00)
SelectEvery(1,0,0)

Example video:

http://cid-5acf098e0ebae8d5.skydrive.live.com/self.aspx/.Public/Time-Tunnel-Theme.avi