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 28th January 2018, 03:33   #1  |  Link
XBlade
Registered User
 
Join Date: Jul 2013
Posts: 7
Good Waveform Display Plugin?

Hello.

First of all, I just want to say, I have AviSynth+, and have tried 3 different audio plugins. Waveform, ViewAudio, and AudioGraph. Only Waveform worked.

Now then, I am curious is there is some sort of plugin that would allow me to display waveforms similar to the Waveform plugin, except be able to do more with it, such as scale it to a certain size and arrange several waveforms across the video screen where I please.

For example, lets say I have 6 stereo .wav files, and 4 mono .wav files, and I want to arrange the 6 stereo waveforms to the left side of a video, and the 4 mono ones to the right side. How would I go about that?

As an aside, I also tried out Histogram("AudioLevels") which was interesting. Is there anything I can do with that at all, such as place it to the right, rather than the left of the video, or change the colors of it?

Kind regards.
XBlade is offline   Reply With Quote
Old 28th January 2018, 12:42   #2  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,914
Inside AviSynth only one audio track can be managed at same time, "with an arbitrary number of channels" but only one track.
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 28th January 2018, 18:00   #3  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
Waveform allows you to adjust how much of the video is overlaid by waveforms, and also lets you scale up the values if the audio is quiet.

With various usage of crop, stackhorizontal/stackvertical, audiodub and so on you should be able to get what you want.

With histogram, you can fliphorizontal the video, apply histogram, and flip it back to put it on the left. But these are all really meant to be diagnostic plugins, so they're not really designed to be so customisable.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 28th January 2018, 22:25   #4  |  Link
XBlade
Registered User
 
Join Date: Jul 2013
Posts: 7
I see. So Avisynth is simply not so good with audio related tasks :\
Oh well, thanks anyway then.
XBlade is offline   Reply With Quote
Old 28th January 2018, 22:59   #5  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
and VapourSynth has no audio support
MysteryX is offline   Reply With Quote
Old 28th January 2018, 23:29   #6  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
Quote:
Originally Posted by XBlade View Post
I see. So Avisynth is simply not so good with audio related tasks :\
Oh well, thanks anyway then.
It's not good with any exceedingly specific task, but it's not designed to be, by itself. By applying several filters you should be able to achieve something close to what you've described.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 29th January 2018, 00:53   #7  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
Quote:
Originally Posted by XBlade View Post
I see. So Avisynth is simply not so good with audio related tasks :\
Oh well, thanks anyway then.
I just wrote a script that does what you want. It works great.

raffriff42 is offline   Reply With Quote
Old 29th January 2018, 01:43   #8  |  Link
XBlade
Registered User
 
Join Date: Jul 2013
Posts: 7
raffriff42, that is very interesting. I am sorry that you've gone out of your way to mess with something like that, especially since I wasn't as specific as I could've been.
Here is a good example of what I mean.
https://www.youtube.com/watch?v=4Ksd3paqF68
If you were wondering why my 6 stereo channels on the left/4 mono channels on the right was specific, here you go.

What I have in mind isn't exactly what is shown in that video, but very similar. I'd like to place 6 FM stereo channels sitting to the right side of the video, and 4 PSG mono channels to the left, with some transparency as it does normally with waveform.dll (not outside of the video as you show there, though that is very interesting as well).

Since I am very inexperienced with AviSynth, I have no idea how I'd even begin to do that myself, though. My current script is so basic, it's painful. It's nothing more than an Imagesource, followed by Wavsource, an Audiodub, and lastly, a slight audio delay, and a simple fade in.
XBlade is offline   Reply With Quote
Old 29th January 2018, 01:57   #9  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
Well, I'll post what I have if you want to study it. As-is (except for typos)
Code:
LoadPlugin(p + "Waveform\waveform.dll") 

## 'C' = main video clip
C=Colorbars(width=380, height=240).AudioTrim(0.0, length=30.0)


## 'Axx' = audio clips

## NOTE audio formats - channel count, sample rate etc - do NOT need to match 

## in this demo, we have 4 stereo clips...
pcc="E:\Data\Media\ccmixter\temp"
A21=DirectShowSource(pcc+"admiralbob77_-_Slinky_Blues.mp3")
A22=DirectShowSource(pcc+"soma_-_Imagine.mp3")
A23=DirectShowSource(pcc+"Xaphoid_-_Black_is_the_Color.mp3")
A24=DirectShowSource(pcc+"snowflake_-_MusiKaba_(ft_spinningmerkaba).mp3")
## (DirectShowSource for demo purposes; would prefer LWLibavAudioSource, etc)

## ...and 2 mono clips
ptt="E:\Data\VideoAuxdata\test-patterns\audio"
A11=WavSource(ptt+"pinknoise1.wav").ConvertToMono
A12=WavSource(ptt+"Sweep 2Hz-24kHz PCM.wav").ConvertToMono

## 'A' = main audio, sent to output (can be 'C' or any of the audio clips, or a mix)
A=A21 

## 'CW' sets width of waveform sidebars; height MUST match main clip 'C'
CW=C.PointResize(C.Width/2, C.Height)

## left sidebar - 4 stereo (could be mixed mono/stereo)
VL=StackVertical(
\   WaveformSlice(CW, A21, "A21")
\ , WaveformSlice(CW, A22, "A22")
\ , WaveformSlice(CW, A23, "A23")
\ , WaveformSlice(CW, A24, "A24")
\ ).QCropEx(CW.Width, C.Height)

## right sidebar - 2 mono (could be mixed mono/stereo)
VR=StackVertical(
\   WaveformSlice(CW, A11, "A11")
\ , WaveformSlice(CW, A12, "A12")
\ ).QCropEx(CW.Width, C.Height)

## add sidebars and audio to main clip
StackHorizontal(VL, C, VR)
AudioDub(A)
return Last

##################################
### audio waveform, cropped to height and added label
##
function WaveformSlice(clip C, clip A, string label, int "text_color")
{
    ch  = A.AudioChannels
    hgt = m4(C.Height/8.0)
    tc  = Default(text_color, $808080)
    
    R = BlankClip(C, channels=0)
    \   .AudioDub(A)
    \   .WaveForm(window=3, height=hgt)
    \   .Crop(0, Round(C.Height-(ch*hgt)), 0, 0)
    \   .Subtitle(label, text_color=tc, size=0.7*hgt, y=2*ch*hgt/8)
    return R
}

##################################
### symmetrically crop or expand a clip to ensure it is a certain size, 
### with size forced to mod-4, mod-8 etc
##
## cf. [[CropEx]] for a version with more features
##
## @ wid, hgt - new desired width & height (no mod requirement)
## @ mod      - mod value; one of (1|2|4|8|16|32); default 4
##
function QCropEx(clip C, float wid, float hgt, int "mod")
{
    mod = Max(1, Default(mod, 4))

    Assert((mod==1||mod==2||mod==4||mod==8||mod==16||mod==32), 
    \  "QCropEx: 'mod' argument not one of (1|2|4|8|16|32)")

    wid = Round(wid)
    hgt = Round(hgt)
    out_wid = wid - (wid % mod)
    out_hgt = hgt - (hgt % mod)

    C ## Last==C
    bdrX  = out_wid - Width
    bdrY  = out_hgt - Height
    bdrLt = Ceil(Float(bdrX) / 2.0)
    bdrTp = Ceil(Float(bdrY) / 2.0)
    bdrLt = bdrLt - (bdrLt % 2)
    bdrTp = bdrTp - (bdrTp % 2)
    bdrRt = (bdrX - bdrLt) 
    bdrBt = (bdrY - bdrTp)

    (bdrLt<=0 && bdrRt<=0 && bdrTp<=0 && bdrBt<=0) 
    \ ? Last 
    \ : AddBorders(
    \       Max(0, bdrLt), Max(0, bdrTp), 
    \       Max(0, bdrRt), Max(0, bdrBt)) 

    (bdrLt>=0 && bdrRt>=0 && bdrTp>=0 && bdrBt>=0) 
    \ ? Last 
    \ : Crop(
    \       ((bdrLt<0) ? -bdrLt : 0), 
    \       ((bdrTp<0) ? -bdrTp : 0), 
    \       ((bdrRt<0) ?  bdrRt : out_wid), 
    \       ((bdrBt<0) ?  bdrBt : out_hgt))
    return Last
}

##################################
### MOD-4-and-at-least-16 helper function
## (round to nearest)
## @ Didée
function m4(float f) 
{
    (f<16) ? 16 : Int(Round(f/4.0)*4)
}
raffriff42 is offline   Reply With Quote
Old 29th January 2018, 02:02   #10  |  Link
XBlade
Registered User
 
Join Date: Jul 2013
Posts: 7
Thank you. I will have a look at it, though I must say, it appears to be quite intimidating.
XBlade 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 06:47.


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