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 Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th August 2005, 00:23   #1  |  Link
mg262
Clouded
 
mg262's Avatar
 
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
AudioConvolution filter

I was in the mood to code something, but a bit too wiped out to try anything hard... so I built a very simple audio plug-in.
Quote:
Originally Posted by Mug Funky
a convolver plugin would be very cool.

that would handle reverbs, frequency filters and phase filters all in 1 go.

just use an audio app to generate an impulse (make a 1-sample click and filter it), and point the avs plugin to that wave file.
AudioConvolution, 25Aug05

AudioConvolution(clip input, clip kernel)

You must pass in clips with video; audio must be 16-bit; kernel must have mono audio. kernel should only have a single figure number of nonzero points. (Or else it becomes very slow) I've only tested it once, with a mono input.

Incidentally, this makes no attempt to be fast whatsoever. This is a throwaway thing and I don't plan to add features to it (though I will fix bugs!). I might speed it up a bit though...

Edit:


A slightly faster version...

AudioConvolution, 26Aug05

So you should be able to feed it larger kernels. By the way, when I said very slow above, I meant slower than real-time ... if you don't mind waiting to encode the audio larger kernels should work fine... but try on kernels with < 30 nonzero values first, to check whether it's working.

I know whats slowing it down, and it can be fixed to allow yet larger kernels. I can deal with it if anyone actually has an interest in using this thing.
__________________
a.k.a. Clouded. Come and help by making sure your favourite AVISynth filters and scripts are listed.

Last edited by mg262; 26th August 2005 at 10:03.
mg262 is offline   Reply With Quote
Old 26th August 2005, 11:19   #2  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
haha! you rock!

it's not really usable yet (i was thinking kernels in the region of 512-1024 points), but it's definitely a start. a convolver in avisynth means all possible kinds of passive filters can be made in avisynth now (so long as you have another program capable of making the impulses...).

i gather it's faster to export audio through virtualdub, then use something like foobar's convolver to do the dirty work?

still, it's a very good start. i can see a lot of impulse files being posted here to get rid of certain problems (pilot tones! yaaaah!) with audio.
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 26th August 2005, 11:56   #3  |  Link
mg262
Clouded
 
mg262's Avatar
 
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148


Quote:
Originally Posted by Mug Funky
i was thinking kernels in the region of 512-1024 points
Tell you what, send me one in a WAV file and I'll try to poke things until it works in real-time. It may even work now... the only kernels I understand are echoes and setting up a 512 point echo is just not a good idea...

I don't think it is intrinsically slow... AVISynth requests about 2000 samples at a time, but the filter needs to look back maybe on the order of 20,000 (depending on the kernel). So it requests 10 times as many source samples as needed. Can be fixed with a buffer of one kind or another.

Scratch the comment about the second clip requiring video... this works fine with the 26th August version:

AudioConvolution(wavsource("echo.wav"))
__________________
a.k.a. Clouded. Come and help by making sure your favourite AVISynth filters and scripts are listed.
mg262 is offline   Reply With Quote
Old 26th August 2005, 13:14   #4  |  Link
MfA
Registered User
 
Join Date: Mar 2002
Posts: 1,075
If you are feeling ambitiuous you could port the code from BruteFIR.
MfA is offline   Reply With Quote
Old 26th August 2005, 15:30   #5  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
are you using fftw for this filter?
tsp is offline   Reply With Quote
Old 26th August 2005, 15:37   #6  |  Link
mg262
Clouded
 
mg262's Avatar
 
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
Guys, guys,
Quote:
I was in the mood to code something, but a bit too wiped out to try anything hard... so I built a very simple audio plug-in.
Quote:
Incidentally, this makes no attempt to be fast whatsoever.
I just felt like throwing something together last night. It's not sophisticated at all. It doesn't apply a DFT because it's set up to deal with sparse kernels (cf echoes)... I don't/didn't know enough about audio to know whether that was the right way to go, but it sounds like it isn't...

Edit: @tsp, if I do modify it to use fftw, is it as simple as calling one function on source chunk and kernel, multiplying, and calling that function again? (Probably with size rounded up to multiple of two.) Or does it take a lot more work to use the library? Thanks!
__________________
a.k.a. Clouded. Come and help by making sure your favourite AVISynth filters and scripts are listed.

Last edited by mg262; 26th August 2005 at 17:54.
mg262 is offline   Reply With Quote
Old 26th August 2005, 20:30   #7  |  Link
MfA
Registered User
 
Join Date: Mar 2002
Posts: 1,075
Essentially yes, but you also have to deal with overlap add/save technique ... and really large FFTs are inefficient. Brutefir uses partitioned FFTs to sidestep that.
MfA is offline   Reply With Quote
Old 26th August 2005, 20:40   #8  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
well as long as the partionsize is a power of 2 the slowdown shouldn't be that inefficient. I mean on a modern computer there should be more than enough proccesing power to do the fft in realtime. Have a look at my variableblur sourcecode (gaussian.cpp/.h) for how it is possible to use fftw to do a 2d convolution (of course with audio it is only 1d=faster)
tsp 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 12:28.


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