AudioGraph

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (External Links)
(v0.0.2 update)
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
{{FilterCat|External_filters|Plugins|Audio_filters}}
+
{{FilterCat4|External_filters|Plugins|Plugins_x64|Audio_filters}}
 
{{Filter3
 
{{Filter3
| Richard Ling, {{Author/Sh0dan}}
+
| 1=Richard Ling, {{Author/Sh0dan}}, [https://sourceforge.net/u/ibobalo/profile/ ibobalo]
| 20040318
+
| 2=v0.0.2
| 3=[http://web.archive.org/web/20060517015407/http://beta.zenaria.com/kpo/avisynth/AudGraph_25.zip AudGraph_25.zip]
+
| 3=[https://github.com/Asd-g/AviSynth-AudioGraph/releases AudioGraph-v0.0.2.7z ]
 
| 4=Audio filters
 
| 4=Audio filters
 
| 5=[http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
 
| 5=[http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
Line 15: Line 15:
 
<br>
 
<br>
 
== Requirements ==
 
== Requirements ==
* AviSynth 2.5.8 or later
+
* [x86]: [[AviSynth+]] or [https://sourceforge.net/projects/avisynth2/ AviSynth 2.6]
* Supported color formats: [[RGB24]], [[RGB32]], [[YUY2]]
+
* [x64]: [[AviSynth+]]
 +
* Supported color formats: [[RGB24]], [[RGB32]], [[YUY2]], [[YV24]], 8-bit [[Planar]] RGB
 
<br>
 
<br>
 
== [[Script variables|Syntax and Parameters]] ==
 
== [[Script variables|Syntax and Parameters]] ==
  
:{{Template:FuncDef|AudioGraph (clip, int)}}
+
:{{Template:FuncDef|AudioGraph (clip, int "frames_either_side", int "graph_scale", int "middle_colour", int "side_colour")}}
 
<br>
 
<br>
 
::{{Par2| |clip| }}
 
::{{Par2| |clip| }}
:::The source clip. YUY2, RGB24 or RGB32 video, with 8-bit or 16-bit mono or stereo audio.
+
:::The source clip. YUY2, YV24, RGB24, RGB32 or planar RGB video, with 8-bit or 16-bit mono or stereo audio. Float audio will be internally converted to 16-bit and back to float.
 
<br>
 
<br>
::{{Par2| |int| }}
+
::{{Par2|frames_either_side|int|25}}
:::<tt>'''frames_either_side'''</tt>: The number of frames, either side of the current frame, which should be graphed.
+
:::<code>'''frames_either_side'''</code>: The number of frames, either side of the current frame, which should be graphed.
 
:::The effect of the frames_either_side parameter is perhaps better explained by this table:
 
:::The effect of the frames_either_side parameter is perhaps better explained by this table:
 
:::value effect:
 
:::value effect:
Line 34: Line 35:
 
:::*...and so on.
 
:::*...and so on.
 
:::The current frame's audio is displayed in the centre of the video frame in bright green, while audio for preceding and following frames is displayed in darker green.
 
:::The current frame's audio is displayed in the centre of the video frame in bright green, while audio for preceding and following frames is displayed in darker green.
 +
<br>
 +
::{{Par2|graph_scale|int|0}}
 +
:::<code>'''graph_scale'''</code>: The vertical scale factor. Set to 0 to enable auto-scale
 +
<br>
 +
::{{Par2|middle_colour|int|$00FF00}}
 +
:::<code>'''middle_colour'''</code>: The graph colour for the current frame.  Colors are expressed as hex values: [[Color_presets]]
 +
<br>
 +
::{{Par2|side_colour|int|$7F7F7F}}
 +
:::<code>'''side_colour'''</code>: The graph colour for the frames on either side of the current. Colors are expressed as hex values: [[Color_presets]]
 
<br>
 
<br>
 
===How this filter works:===
 
===How this filter works:===
Line 44: Line 54:
 
== Examples ==
 
== Examples ==
 
The following script creates a video from just an audio file. The video length is automatically adjusted based on the duration of the audio and the desired frame rate. The output clip will be RGB32, 512x256, 59.94 FPS, and <tt>'''frames_either_side'''</tt>=5, of course this is all adjustable.
 
The following script creates a video from just an audio file. The video length is automatically adjusted based on the duration of the audio and the desired frame rate. The output clip will be RGB32, 512x256, 59.94 FPS, and <tt>'''frames_either_side'''</tt>=5, of course this is all adjustable.
  [[WavSource]]("sample.wav") # for other types of files you can use [[FFmpegSource|FFAudioSource]] or [[LSMASHSource|LWLibavAudioSource]] or any other suitable audio source filter
+
  [[WavSource]]("sample.wav") # for other types of files use [[FFmpegSource|FFAudioSource]] or [[LSMASHSource|LWLibavAudioSource]] or another suitable audio source filter
 
  audio = last<br>
 
  audio = last<br>
 
  fps = 60000
 
  fps = 60000
Line 51: Line 61:
 
  [[BlankClip]](length, width=512, height=256, fps=fps, fps_denominator=den, pixel_type="RGB32", color=$000000)
 
  [[BlankClip]](length, width=512, height=256, fps=fps, fps_denominator=den, pixel_type="RGB32", color=$000000)
 
  [[AudioDub]](last, audio)<br>
 
  [[AudioDub]](last, audio)<br>
  AudioGraph(5) # <tt>'''frames_either_side'''</tt> - change to desired value
+
  AudioGraph(frames_either_side=20, graph_scale=0, middle_colour=$00FF00, side_colour=$7F7F7F) # change to desired values
 
<br>
 
<br>
 
== Changelog ==
 
== Changelog ==
 
  Version      Date            Changes<br>
 
  Version      Date            Changes<br>
 +
v0.0.2        2023/05/16      - Update by Asd-g
 +
                              - Fixed undefined behavior - uninitialized optional parameters.
 +
                              - Fixed undefined behavior - uninitialized allocated memory.
 +
                              - Fixed undefined behavior (float input audio) (CPUs with SSE/SSE2)
 +
                                by reenabling the internal conversion from/to audio float.
 +
                              - Fixed upside down graph. (YUY2)
 +
                              - Added support for YV24 and planar RGB/RGBA (8-bit).
 +
                              - Added support for frame properties passthrough.<br>
 +
v0.0.1        2020/06/21      - Update by [https://forum.doom9.org/showthread.php?t=173259 Groucho2004]
 +
                              - Added version resource
 +
                              - Provided default values for:
 +
                                * frames_either_side (25),
 +
                                * graph_scale (0),
 +
                                * middle_colour ($00FF00),
 +
                                * side_colour ($7F7F7F)
 +
                              - Please note that the parameters now don't have a underscore prefix.<br>
 +
v0.0.0        2020/06/20      - Update by [https://forum.doom9.org/showthread.php?t=173259 Groucho2004]
 +
                              - Update to AviSynth 2.6 api
 +
                              - x86 and x64 binaries<br>
 +
20080928      2008/09/28      - Update by Ihor Bobalo
 +
                              - Includes new parameters "<code>_graph_scale</code>", "<code>_middle_colour</code>", and "<code>_side_colour</code>"
 +
                              - Only source code provided<br>
 
  20040318      03/18/2004      - AviSynth 2.5 version by Sh0dan
 
  20040318      03/18/2004      - AviSynth 2.5 version by Sh0dan
 
                               - No YV12 support.
 
                               - No YV12 support.
Line 65: Line 97:
 
<br>
 
<br>
 
== Archived Downloads ==
 
== Archived Downloads ==
{| class="wikitable" border="1"; width="800px"
+
{| class="wikitable" border="1"; width="600px"
 
|-
 
|-
 
!!width="100px"| Version
 
!!width="100px"| Version
 
!!width="150px"| Download
 
!!width="150px"| Download
 
!!width="150px"| Mirror
 
!!width="150px"| Mirror
!!width="150px"| Mirror 2
+
|-
 +
!v0.0.1
 +
|[http://www.mediafire.com/file/qkmr7r3e4m8ieva/AudioGraph001.7z/file AudioGraph001.7z]
 +
|[https://web.archive.org/web/20200806192214if_/https://files.videohelp.com/u/223002/AudioGraph001.7z AudioGraph001.7z]
 +
|-
 +
!v0.0.0
 +
|[https://web.archive.org/web/20200620205259if_/https://files.videohelp.com/u/223002/AudioGraph000.7z AudioGraph000.7z]
 +
|
 
|-
 
|-
 
!20040318
 
!20040318
 
|[http://web.archive.org/web/20060517015407/http://beta.zenaria.com/kpo/avisynth/AudGraph_25.zip AudGraph_25.zip]
 
|[http://web.archive.org/web/20060517015407/http://beta.zenaria.com/kpo/avisynth/AudGraph_25.zip AudGraph_25.zip]
|[http://www.avisynth.nl/users/warpenterprises/files/audgraph_5F25_dll_20040318.zip audgraph_25_20040318.zip]
+
|[http://www.avisynth.nl/users/warpenterprises/files/audgraph_5F25_dll_20040318.zip audgraph_25_20040318.zip]<br>[http://web.archive.org/web/20140724142044/http://www.avisynth.nl/users/warpenterprises/files/audgraph_5F25_dll_20040318.zip audgraph_25_20040318.zip]
|[http://web.archive.org/web/20140724142044/http://www.avisynth.nl/users/warpenterprises/files/audgraph_5F25_dll_20040318.zip audgraph_25_20040318.zip]
+
 
|-
 
|-
 
!20030808
 
!20030808
Line 83: Line 121:
 
<br>
 
<br>
 
==TO DO==
 
==TO DO==
 +
The update by Ihor Bobalo includes some of the following features in the to-do list.
 
* Allow the colour of the graph to be passed as a parameter.
 
* Allow the colour of the graph to be passed as a parameter.
 
* Allow separate graphing of left or right channels of stereo audio (using different colours).
 
* Allow separate graphing of left or right channels of stereo audio (using different colours).
Line 90: Line 129:
 
==External Links ==
 
==External Links ==
 
*[http://avisynth.org.ru/docs/english/externalfilters/audiograph.htm avisynth.org.ru] - Original documentation, [http://avisynth.org.ru/docs/russian/externalfilters/audiograph.htm Russian documentation]  
 
*[http://avisynth.org.ru/docs/english/externalfilters/audiograph.htm avisynth.org.ru] - Original documentation, [http://avisynth.org.ru/docs/russian/externalfilters/audiograph.htm Russian documentation]  
*[http://sourceforge.net/projects/audiograph/ SourceForge] - AudioGraph update by Ihor Bobalo; only source code provided. Includes new parameters "<code>_graph_scale</code>", "<code>_middle_colour</code>", and "<code>_side_colour</code>"
+
*[http://sourceforge.net/projects/audiograph/ SourceForge] - AudioGraph update by Ihor Bobalo; only source code provided.
 
<br>
 
<br>
 
<br>
 
<br>
 
-----------------------------------------------
 
-----------------------------------------------
 
'''Back to [[External_filters#Audio_Filters|External Filters]] &larr;'''
 
'''Back to [[External_filters#Audio_Filters|External Filters]] &larr;'''

Latest revision as of 18:04, 16 May 2023

Abstract
Author Richard Ling, sh0dan, ibobalo
Version v0.0.2
Download AudioGraph-v0.0.2.7z
Category Audio filters
License GPLv2
Discussion Doom9 Thread


Contents

[edit] Description

This filter displays the audio waveform for a video, superimposed on the video. It is mainly intended to help during editing rather than for final output. It can be useful for finding and isolating specific sequences of dialogue or sound, and for checking that overdubbed audio (especially speech) is in sync with video.

The audio is displayed as a green waveform stretching from left to right across the frame. The filter can graph the audio for the currently visible frame only; or it can include the audio for several successive frames on either side of the current frame. Graphing several frames makes it easier to find a sound of interest. It is also really cool to watch the waveform scrolling across the video as the video plays :-).

[edit] Requirements


[edit] Syntax and Parameters

AudioGraph (clip, int "frames_either_side", int "graph_scale", int "middle_colour", int "side_colour")


clip   =
The source clip. YUY2, YV24, RGB24, RGB32 or planar RGB video, with 8-bit or 16-bit mono or stereo audio. Float audio will be internally converted to 16-bit and back to float.


int  frames_either_side = 25
frames_either_side: The number of frames, either side of the current frame, which should be graphed.
The effect of the frames_either_side parameter is perhaps better explained by this table:
value effect:
  • 0 : only audio for the currently visible frame is graphed.
  • 1 : audio for the preceding, current, and following frames are graphed.
  • 2 : audio for the preceding 2 frames, current frame, and following 2 frames are graphed.
  • ...and so on.
The current frame's audio is displayed in the centre of the video frame in bright green, while audio for preceding and following frames is displayed in darker green.


int  graph_scale = 0
graph_scale: The vertical scale factor. Set to 0 to enable auto-scale


int  middle_colour = $00FF00
middle_colour: The graph colour for the current frame. Colors are expressed as hex values: Color_presets


int  side_colour = $7F7F7F
side_colour: The graph colour for the frames on either side of the current. Colors are expressed as hex values: Color_presets


[edit] How this filter works:

An "audioframe" is the audio data corresponding to a video frame, converted into an internal form that can be quickly drawn. A total of (1 + 2 * frames_either_side) audioframes are drawn onto each video frame. Each audioframe is thus (video frame width) / (1 + 2 * frames_either_side) pixels wide. An audioframe simply consists of a Y pixel coordinate for each X pixel coordinate, so drawing an audioframe is very fast.

When frames_either_side is nonzero, the same audioframe will be drawn several times on several successive video frames. So it makes sense to cache audioframes. The filter uses a cache of "audioframe buffers" to store recently used audioframes. Audioframes are generated from raw audio data on demand, and stored in the cache. The caching system is such that a specific audioframe is only ever cached in a specific audioframe buffer, so that cache lookup is very fast. This caching also improves performance when seeking back and forth in a video.

  • The included source code is very well documented, check it out for full details!


[edit] Examples

The following script creates a video from just an audio file. The video length is automatically adjusted based on the duration of the audio and the desired frame rate. The output clip will be RGB32, 512x256, 59.94 FPS, and frames_either_side=5, of course this is all adjustable.

WavSource("sample.wav") # for other types of files use FFAudioSource or LWLibavAudioSource or another suitable audio source filter
audio = last
fps = 60000 den = 1001 length = Round((AudioDuration(audio)*fps)/den) BlankClip(length, width=512, height=256, fps=fps, fps_denominator=den, pixel_type="RGB32", color=$000000) AudioDub(last, audio)
AudioGraph(frames_either_side=20, graph_scale=0, middle_colour=$00FF00, side_colour=$7F7F7F) # change to desired values


[edit] Changelog

Version       Date            Changes
v0.0.2 2023/05/16 - Update by Asd-g - Fixed undefined behavior - uninitialized optional parameters. - Fixed undefined behavior - uninitialized allocated memory. - Fixed undefined behavior (float input audio) (CPUs with SSE/SSE2) by reenabling the internal conversion from/to audio float. - Fixed upside down graph. (YUY2) - Added support for YV24 and planar RGB/RGBA (8-bit). - Added support for frame properties passthrough.
v0.0.1 2020/06/21 - Update by Groucho2004 - Added version resource - Provided default values for: * frames_either_side (25), * graph_scale (0), * middle_colour ($00FF00), * side_colour ($7F7F7F) - Please note that the parameters now don't have a underscore prefix.
v0.0.0 2020/06/20 - Update by Groucho2004 - Update to AviSynth 2.6 api - x86 and x64 binaries
20080928 2008/09/28 - Update by Ihor Bobalo - Includes new parameters "_graph_scale", "_middle_colour", and "_side_colour" - Only source code provided
20040318 03/18/2004 - AviSynth 2.5 version by Sh0dan - 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.
20030808 08/08/2003 - initial release; AviSynth 2.0 plugin by Richard Ling


[edit] Archived Downloads

Version Download Mirror
v0.0.1 AudioGraph001.7z AudioGraph001.7z
v0.0.0 AudioGraph000.7z
20040318 AudGraph_25.zip audgraph_25_20040318.zip
audgraph_25_20040318.zip
20030808 audgraph_20_dll_20030808.zip audgraph_20_dll_20030808.zip


[edit] TO DO

The update by Ihor Bobalo includes some of the following features in the to-do list.

  • Allow the colour of the graph to be passed as a parameter.
  • Allow separate graphing of left or right channels of stereo audio (using different colours).
  • Allow a vertical scale factor to be passed as a parameter, so that quiet waveforms can be seen in more detail.
  • Fix the "feature" that the current frame's audio is not always centered on the display. It can be offset quite far to the right, depending on the relationship between video frame width and frames_either_side.


[edit] External Links




Back to External Filters

Personal tools