Convolution with audio system toolbox
조회 수: 14 (최근 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?
답변 (3개)
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
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
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
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
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
2020년 1월 29일
anyone please help me . I have two audio file so how can i convolution my audio signals?
댓글 수: 2
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.
참고 항목
카테고리
Help Center 및 File 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!