Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 6th September 2015, 02:15   #1  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,377
Audio Spectrum Analyzer [avisynth gone wrong]

Do you need an 18 band audio spectrum analyzer (or analyser)? Of course you do.



What is it worth to you? Oh, nothing, huh? Well okay, here you go.
No plugins needed, just vanilla Avisynth...

(It's just for fun, and to demonstrate SuperEQ)
(Only tested on Avisynth 2.60 at the moment; AVS+ has a problem)
(EDIT April 2016 - fixed! But SuperEQ is not supported on AVS+ ?)

Code:
V=ColorBarsHD ## any video
A=V ## any audio

Z=Analyzer18(V, A)
\  .ChangeFPS(V) ## return to original framerate
Overlay(V, Z, 
\   x=V.Width/2-Z.Width/2, 
\   y=V.Height-Z.Height, 
\   opacity=1.0, 
\   mode="blend")
AudioDub(A)
ConvertAudioTo16bit ## optional, rq'd for VirtualDub
return Last

# http://forum.doom9.org/showthread.php?t=172569
##################################
### 18 Band Audio Spectrum Analyzer
##
## @ updatefps - set according to available compute power; default 5
##
## @ return YV12, 640x334, fps=(updatefps)
## 
function Analyzer18(clip V, clip A, int "updatefps")
{
    updatefps = Default(updatefps, 5)

    BlankClip(V, width=640, height=480, pixel_type="YV12")
    AudioDub(A)

    ConvertToMono
    ConvertAudioToFloat
    ##           1   2  3   4   5   6   7   8   9   10  11  12  13  14  15  16  17 18
    B01=SuperEQ( 0,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99)
    B02=SuperEQ(-99, 0,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99)
    B03=SuperEQ(-99,-99, 0,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99)
    B04=SuperEQ(-99,-99,-99, 0,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99)
    B05=SuperEQ(-99,-99,-99,-99, 0,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99)
    B06=SuperEQ(-99,-99,-99,-99,-99, 0,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99)
    B07=SuperEQ(-99,-99,-99,-99,-99,-99, 0,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99)
    B08=SuperEQ(-99,-99,-99,-99,-99,-99,-99, 0,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99)
    B09=SuperEQ(-99,-99,-99,-99,-99,-99,-99,-99, 0,-99,-99,-99,-99,-99,-99,-99,-99,-99)
    B10=SuperEQ(-99,-99,-99,-99,-99,-99,-99,-99,-99, 0,-99,-99,-99,-99,-99,-99,-99,-99)
    B11=SuperEQ(-99,-99,-99,-99,-99,-99,-99,-99,-99,-99, 0,-99,-99,-99,-99,-99,-99,-99)
    B12=SuperEQ(-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99, 0,-99,-99,-99,-99,-99,-99)
    B13=SuperEQ(-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99, 0,-99,-99,-99,-99,-99)
    B14=SuperEQ(-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99, 0,-99,-99,-99,-99)
    B15=SuperEQ(-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99, 0,-99,-99,-99)
    B16=SuperEQ(-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99, 0,-99,-99)
    B17=SuperEQ(-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99, 0,-99)
    B18=SuperEQ(-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99,-99, 0)
    MergeChannels(B01, B02, B03, B04, B05, B06, B07, B08, B09, B10, B11, B12, B13, B14, B15, B16, B17, B18)

    ChangeFPS(updatefps)
    Histogram("audiolevels") ## the magic happens
    Crop(0, 0, 640, 326) ## crop off some crud
    AddBorders(0, 8, 0, 0) ## top border

    yy = Height-8
    cc = color_yellow
    Subtitle("0 - 65",    x=16,  y=yy, font_angle=90, text_color=cc)
    Subtitle("65 - 93",   x=48,  y=yy, font_angle=90, text_color=cc)
    Subtitle("93 - 131",  x=78,  y=yy, font_angle=90, text_color=cc)
    Subtitle("131 -185",  x=108, y=yy, font_angle=90, text_color=cc)
    Subtitle("185 -262",  x=142, y=yy, font_angle=90, text_color=cc)
    Subtitle("262 -370",  x=172, y=yy, font_angle=90, text_color=cc)
    Subtitle("370 -523",  x=206, y=yy, font_angle=90, text_color=cc)
    Subtitle("523 -740",  x=238, y=yy, font_angle=90, text_color=cc)
    Subtitle("740 -1047", x=268, y=yy, font_angle=90, text_color=cc)
    Subtitle("1047-1480", x=300, y=yy, font_angle=90, text_color=cc)
    Subtitle("1480-2093", x=332, y=yy, font_angle=90, text_color=cc)
    Subtitle("2093-2960", x=366, y=yy, font_angle=90, text_color=cc)
    Subtitle("2960-4186", x=396, y=yy, font_angle=90, text_color=cc)
    Subtitle("4186-5920", x=426, y=yy, font_angle=90, text_color=cc)
    Subtitle("5920-8372", x=456, y=yy, font_angle=90, text_color=cc)
    Subtitle("8372-11k8", x=490, y=yy, font_angle=90, text_color=cc)
    Subtitle("11k8-16k7", x=526, y=yy, font_angle=90, text_color=cc)
    Subtitle("16k7-22ką", x=558, y=yy, font_angle=90, text_color=cc)

    return Last
}

Last edited by raffriff42; 17th March 2017 at 00:08. Reason: (fixed image link)
raffriff42 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 19:59.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.