Spectrogram
From Avisynth wiki
(Difference between revisions)
(→Examples: add picture) |
(minor touchup) |
||
(16 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{FilterCat4|External_filters|Plugins|Plugins_x64|Audio_filters}} |
{{Filter3 | {{Filter3 | ||
− | | [http://github.com/innocenat innocenat] | + | | [http://github.com/innocenat innocenat], Erazortt |
− | | | + | | r7 |
− | | 3=[ | + | | 3=[https://drive.google.com/open?id=1HPxU8J6udAs_1VEWhdKvKFWdWncTCGXs Spectrogram_r7.7z] |
| 4=Audio filters | | 4=Audio filters | ||
− | | 5= | + | | 5=Open source |
| 6=}} | | 6=}} | ||
<br> | <br> | ||
Line 13: | Line 13: | ||
<br> | <br> | ||
== Requirements == | == Requirements == | ||
− | * AviSynth 2.6 | + | * [x86]: [[AviSynth+]] or [https://sourceforge.net/projects/avisynth2/ AviSynth 2.6] |
+ | * [x64]: [[AviSynth+]] | ||
* Supported color formats: all colorspaces are supported but output clip will always be [[Y8]]. | * Supported color formats: all colorspaces are supported but output clip will always be [[Y8]]. | ||
<br> | <br> | ||
− | * [http://www.fftw.org/install/windows.html FFTW 3.3. | + | ===Runtime dependencies=== |
− | :<span style="color:red">***</span> 32-bit <tt>libfftw3f-3.dll</tt> needs to be in the search path (<tt>C:\Windows\SysWOW64</tt> 64-bit OS or <tt>C:\windows\system32</tt> 32-bit OS) | + | The following are required, [[Spectrogram]] will not run or load without them. |
− | :<span style="color:red">***</span> | + | |
+ | * [https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads Microsoft Visual C++ 2017 Redistributable Package (x86 / x64)] | ||
+ | :<span style="color:red">***</span> <tt>vcredist_x86.exe</tt> is required for <tt>Spectrogram-x86</tt> | ||
+ | :<span style="color:red">***</span> <tt>vcredist_x64.exe</tt> is required for <tt>Spectrogram-x64</tt> | ||
+ | |||
+ | * [http://www.fftw.org/install/windows.html FFTW 3.3.5] (<code>'''fftw-3.3.5-dll32.zip'''</code> or <code>'''fftw-3.3.5-dll64.zip'''</code>) | ||
+ | :<span style="color:red">***</span> 32-bit <tt>[[libfftw3f-3.dll]]</tt> needs to be in the search path (<tt>C:\Windows\SysWOW64</tt> 64-bit OS or <tt>C:\windows\system32</tt> 32-bit OS) | ||
+ | :<span style="color:red">***</span> 64-bit <tt>[[libfftw3f-3.dll]]</tt> needs to be in the search path (<tt>C:\windows\system32</tt> 64-bit OS) | ||
<br> | <br> | ||
+ | |||
== [[Script variables|Syntax and Parameters]] == | == [[Script variables|Syntax and Parameters]] == | ||
− | :{{Template:FuncDef|Spectrogram (clip, int, int)}} | + | :{{Template:FuncDef|Spectrogram (clip, int width, int height, bool "transpose")}} |
<br> | <br> | ||
::{{Par2| |clip| }} | ::{{Par2| |clip| }} | ||
− | :::Input clip; audio must be float so use [[ConvertAudio|ConvertAudioToFloat()]] if needed. If the input clip | + | :::Input clip; audio must be float so use [[ConvertAudio|ConvertAudioToFloat()]] if needed. Video can be any colorspace but the output will always be [[Y8]]. |
+ | :::Frame rate of the spectrogram will always default to the frame rate of the input clip. If the input clip does not contain video then the frame rate will default to 24FPS. | ||
<br> | <br> | ||
::{{Par2| |int| }} | ::{{Par2| |int| }} | ||
Line 33: | Line 43: | ||
:::Height of the spectrogram. For best performance it's recommended that the height is a value of [http://en.wikipedia.org/wiki/Power_of_two 2^n]. | :::Height of the spectrogram. For best performance it's recommended that the height is a value of [http://en.wikipedia.org/wiki/Power_of_two 2^n]. | ||
<br> | <br> | ||
− | ::*'''Note:''' | + | ::{{Par2|transpose|bool|false}} |
+ | :::When set to true the spectrogram will be rendered vertically; recommended for larger dimensions. | ||
+ | :::<code>Spectrogram(x, y, transpose=true).[[TurnLeft|TurnLeft()]]</code> is identical to <code>Spectrogram(x, y, transpose=false)</code> but faster. For better performance use the optimized <code>FTurnLeft()</code> function from the [[FTurn]] plugin. | ||
+ | <br> | ||
+ | ::*'''Note:''' the first 3 parameters are unnamed and do not have a default so they must be specified. | ||
<br> | <br> | ||
== Examples == | == Examples == | ||
− | The following script creates a | + | The following script creates a scrolling spectrogram from just an audio file. The length is automatically adjusted based on the duration of the audio and the desired frame rate. The output clip will be Y8, 512x256, and 59.94 FPS, 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 you can use [[FFmpegSource|FFAudioSource]] or [[LSMASHSource|LWLibavAudioSource]] or any other suitable audio source filter | ||
audio = last<br> | audio = last<br> | ||
Line 45: | Line 59: | ||
[[AudioDub]](last, audio) | [[AudioDub]](last, audio) | ||
[[ConvertAudio|ConvertAudioToFloat()]] # if needed<br> | [[ConvertAudio|ConvertAudioToFloat()]] # if needed<br> | ||
− | + | Spectrogram(512, 256, transpose=true) | |
+ | TurnLeft()<br> | ||
[[File:Spectrogram.png]] | [[File:Spectrogram.png]] | ||
<br> | <br> | ||
Line 51: | Line 66: | ||
== Changelog == | == Changelog == | ||
Version Date Changes<br> | Version Date Changes<br> | ||
− | r4 2015/03/11 - fix a bug; the cache was actually completely broken | + | r7 2018/12/19 - order channels like [http://avisynth.nl/index.php/Waveform Waveform] does<br> |
+ | r6 2018/12/13 - add x64 bit build and a VS2017 solution to the archive<br> | ||
+ | r5 2015/07/04 - increase cache sizes to accommodate larger dimensions<br> | ||
+ | - add "transpose" parameter for better performance<br> | ||
+ | r4 2015/03/11 - fix a bug; the cache was actually completely broken<br> | ||
r3 2015/03/10 - fix a bug that caused a crash | r3 2015/03/10 - fix a bug that caused a crash | ||
− | - it's now ~40-50% faster; more profiling and fixing a hot spot | + | - it's now ~40-50% faster; more profiling and fixing a hot spot<br> |
− | r2 2015/03/09 - implement cache; increase speed by profiling | + | r2 2015/03/09 - implement cache; increase speed by profiling<br> |
r1 2015/03/08 - initial release | r1 2015/03/08 - initial release | ||
− | + | <br> | |
+ | |||
== Archived Downloads == | == Archived Downloads == | ||
− | {| class="wikitable" border="1"; width=" | + | Source code is included. |
+ | {| class="wikitable" border="1"; width="500px" | ||
|- | |- | ||
!!width="100px"| Version | !!width="100px"| Version | ||
− | !!width=" | + | !!width="200px"| Download |
− | !!width=" | + | !!width="200px"| Mirror |
|- | |- | ||
− | ! | + | !r7 |
− | |[] | + | |[https://drive.google.com/open?id=1HPxU8J6udAs_1VEWhdKvKFWdWncTCGXs Spectrogram_r7.7z] |
− | |[] | + | |[https://web.archive.org/web/20200524010641if_/https://files.videohelp.com/u/223002/Spectrogram_r7.7z Spectrogram_r7.7z] |
|- | |- | ||
− | ! | + | !r6 |
− | |[] | + | |[https://drive.google.com/open?id=13wjmBlqHqYXEMWf30vPvMXNqHoPIj4ML Spectrogram_r6.7z] |
− | |[] | + | |[https://web.archive.org/web/20200524010721if_/https://files.videohelp.com/u/223002/Spectrogram_r6.7z Spectrogram_r6.7z] |
+ | |- | ||
+ | !r5 | ||
+ | |[https://www.dropbox.com/s/9p2t1mv5t5yjpgd/Spectrogram_r5.7z?dl=1 Spectrogram_r5.7z] | ||
+ | |[https://web.archive.org/web/20200524010813if_/https://files.videohelp.com/u/223002/Spectrogram_r5.7z Spectrogram_r5.7z] | ||
+ | |- | ||
+ | !r4 | ||
+ | |[https://www.dropbox.com/s/ivh3o1wglw7un0g/Spectrogram.7z?dl=1 Spectrogram.7z] | ||
+ | | | ||
|} | |} | ||
− | |||
− | |||
<br> | <br> | ||
<br> | <br> | ||
----------------------------------------------- | ----------------------------------------------- | ||
'''Back to [[External_filters#Audio_Filters|External Filters]] ←''' | '''Back to [[External_filters#Audio_Filters|External Filters]] ←''' |
Latest revision as of 00:00, 18 June 2020
Abstract | |
---|---|
Author | innocenat, Erazortt |
Version | r7 |
Download | Spectrogram_r7.7z |
Category | Audio filters |
License | Open source |
Discussion |
Contents |
[edit] Description
Linear spectrogram for AviSynth 2.6.
[edit] Requirements
- [x86]: AviSynth+ or AviSynth 2.6
- [x64]: AviSynth+
- Supported color formats: all colorspaces are supported but output clip will always be Y8.
[edit] Runtime dependencies
The following are required, Spectrogram will not run or load without them.
- *** vcredist_x86.exe is required for Spectrogram-x86
- *** vcredist_x64.exe is required for Spectrogram-x64
- FFTW 3.3.5 (
fftw-3.3.5-dll32.zip
orfftw-3.3.5-dll64.zip
)
- *** 32-bit libfftw3f-3.dll needs to be in the search path (C:\Windows\SysWOW64 64-bit OS or C:\windows\system32 32-bit OS)
- *** 64-bit libfftw3f-3.dll needs to be in the search path (C:\windows\system32 64-bit OS)
[edit] Syntax and Parameters
- Spectrogram (clip, int width, int height, bool "transpose")
- clip =
- Input clip; audio must be float so use ConvertAudioToFloat() if needed. Video can be any colorspace but the output will always be Y8.
- Frame rate of the spectrogram will always default to the frame rate of the input clip. If the input clip does not contain video then the frame rate will default to 24FPS.
- clip =
- int =
- Width of the spectrogram.
- int =
- int =
- Height of the spectrogram. For best performance it's recommended that the height is a value of 2^n.
- int =
- bool transpose = false
- When set to true the spectrogram will be rendered vertically; recommended for larger dimensions.
Spectrogram(x, y, transpose=true).TurnLeft()
is identical toSpectrogram(x, y, transpose=false)
but faster. For better performance use the optimizedFTurnLeft()
function from the FTurn plugin.
- bool transpose = false
- Note: the first 3 parameters are unnamed and do not have a default so they must be specified.
[edit] Examples
The following script creates a scrolling spectrogram from just an audio file. The length is automatically adjusted based on the duration of the audio and the desired frame rate. The output clip will be Y8, 512x256, and 59.94 FPS, of course this is all adjustable.
WavSource("sample.wav") # for other types of files you can use FFAudioSource or LWLibavAudioSource or any other 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="Y8") AudioDub(last, audio) ConvertAudioToFloat() # if needed
Spectrogram(512, 256, transpose=true) TurnLeft()
[edit] Changelog
Version Date Changes
r7 2018/12/19 - order channels like Waveform does
r6 2018/12/13 - add x64 bit build and a VS2017 solution to the archive
r5 2015/07/04 - increase cache sizes to accommodate larger dimensions
- add "transpose" parameter for better performance
r4 2015/03/11 - fix a bug; the cache was actually completely broken
r3 2015/03/10 - fix a bug that caused a crash - it's now ~40-50% faster; more profiling and fixing a hot spot
r2 2015/03/09 - implement cache; increase speed by profiling
r1 2015/03/08 - initial release
[edit] Archived Downloads
Source code is included.
Version | Download | Mirror |
---|---|---|
r7 | Spectrogram_r7.7z | Spectrogram_r7.7z |
r6 | Spectrogram_r6.7z | Spectrogram_r6.7z |
r5 | Spectrogram_r5.7z | Spectrogram_r5.7z |
r4 | Spectrogram.7z |
Back to External Filters ←