Convolution with audio system toolbox

15 次查看(过去 30 天)
Hi all, i'm trying to use the audio system toolbox to turn one of my scripts into a VST. The plugin needs to take an impulse response in the form of an array and convolve it with the given input samples. When I implement this with conv(a,b) I get an output frame size larger than the input frame size (2). Do I need to implement a circular buffer to fix this, if so how could this be done?
  1 个评论
Peter Rowland-Jones
Just found the Fast Convolution example on the AudioSystemstToolbox page!! :)

请先登录,再进行评论。

回答(3 个)

Gabriele Bunkheila
Gabriele Bunkheila 2017-11-1
Hello,
I thought I'd capture a quick update on this topic as R2017b has already been out there for a few weeks. With the latest release, DSP System Toolbox now includes a new dsp.FrequencyDomainFIRFilter System object, which audiopluginexample.FastConvolver is now using under the hood. If you need fast convolution using partitioned frequency-domain filtering you can now use dsp.FrequencyDomainFIRFilter directly.
The new object includes both overlap-add and overlap-save methods, it has a property to report algorithmic latency as a function of the partition length used, and it comes with a block equivalent to use with Simulink.
Give it a try if you get a chance and let us know what you think!
Thanks,
Gabriele.
  3 个评论
Gabriele Bunkheila
Gabriele Bunkheila 2018-11-20
Hello ridgerider,
Indeed, dsp.FrequencyDomainFIRFilter currently only supports a single filter per object and it reserves 2D coefficients for partitioned frequency-domain filter coefficients.
However, to implement a multi-filter fast convolution all you need to do is augmenting audiopluginexample.FastConvolver by creating one instance of dsp.FrequencyDomainFIRFilter per required filter (and then running each separately within the process or stepImpl method of your new audioPlugin class).
You can do that by either adding as many private properties as needed (similarly to pFIR in the baseline version of audiopluginexample.FastConvolver) or by using a cell array with one object instance per cell.
I hope this helps.
Thanks,
Gabriele.
ridgerider
ridgerider 2018-11-20
Thanks, Gabriele!
The only problem is that I have a lot of channels and a lot of IRs and would like to safe unnecessary mulitple FFTs of the same input signal block, if convolved with several filters... That's what would happen when subsequently filtering with multiple instances of dsp.FrequencyDomainFIRFilter, right?

请先登录,再进行评论。


Gabriele Bunkheila
Gabriele Bunkheila 2018-11-21
Hi ridgerider,
You are right indeed - currently I see no plug-and-play solution to share the FFT of the input signal across many instances of dsp.FrequencyDomainFIRFilter. Yours is good feedback and we'll take into account for enhancements in future releases.
For the time being, I suggest:
  • Using multiple separate instances of dsp.FrequencyDomainFIRFIilter first and quantify how big of a performance problem you really have. Beyond the built-in tools like tic, toc , timeit, or and the MATLAB Profiler, I also suggest taking a look at the approach used in the example Measure Performance of Streaming Real-Time Audio Algorithms
  • If needed, take a look inside dsp.FrequencyDomainFIRFilter to inspire yourself for an improved version. All the code should be open and visible, so hopefully it shouldn't take long if you only need one specific operating mode
Thanks,
Gabriele.
  1 个评论
Tom111
Tom111 2020-7-17
Gabriele you say it's possible to use a cell array with one object instance of dsp.FrequencyDomainFIRFilter per cell, when I try to do this the plugin compiles but doesn't run, giving the error (in audioTestBench) 'Conversion to cell from dsp.FrequencyDomainFIRFilter is not possible'. Any ideas? Where should I initialise the cell array, in the properties? (as would have been for pFIR in the Fast Convolver example)?
Many thanks

请先登录,再进行评论。


SHIFFA MEMON
SHIFFA MEMON 2020-1-29
anyone please help me . I have two audio file so how can i convolution my audio signals?
  2 个评论
Gabriele Bunkheila
Gabriele Bunkheila 2020-1-29
Hi Shiffa, this conversation is about fast convolution. If you have doubts about the basics of convolution, you may find it useful to take a look at this page first.
Use audioread to open your two audio files (say one for x and one for h) then use either of conv(h,x) or filter(h,1,x). The former will generate the full convolved sequence, while the latter will return a sequence of the same length of x.
SHIFFA MEMON
SHIFFA MEMON 2020-1-30
can you guide me? how can I get fft of my convolution output?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Audio Plugin Creation and Hosting 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by