classdef FastConvolver< audioPlugin & matlab.System
%FastConvolver Convolve input with large impulse responses and low latency.
%Time-domain convolution of an input frame with a long impulse response
%adds latency equal to the length of the impulse response. The algorithm in
%this plugin uses frequency-domain partitioned convolution to reduce the
%latency to the partition size. The efficiency of this algorithm enables
%real-time convolution with long impulse responses.
%
%   FC = audiopluginexample.FastConvolver() returns an object FC with
%   properties set to their default values.
%
%   process method syntax:
%
%   Y = process(FC, X) convolves the audio input X based on the properties
%   specified in the object FC and returns the output Y. Each column of X
%   is treated as an individual input channel.
%
%   FastConvolver methods:
%   
%   process   - See above description for use of this method
%   <a href="matlab:help matlab.System/reset   ">reset</a>     - Reset the internal states to initial conditions
%
%   FastConvolver properties:
%
%   ImpulseResponse  - Impulse response convolved with input
%   PartitionSize    - Length of each partition of the impulse response
%
%   In order to generate the plugin for a different impulse response or a
%   different partition size, edit the assignment to the ImpulseResponse
%   or PartitionSize property in the class definition. Open the class 
%   file by typing in the MATLAB Command Window: 
%   edit audiopluginexample.FastConvolver
%
%   Reference: 
%   
%   Armelloni, Enrico, Christian Giottoli, and Angelo Farina.
%   "Implementation of real-time partitioned convolution on a DSP board."
%   In Applications of Signal Processing to Audio and Acoustics, 2003 IEEE
%   Workshop on., pp. 71-74. IEEE, 2003.
%
%   % Example 1: Construct and use a fast convolver with the impulse
%   % response of a large church.
%   reader = dsp.AudioFileReader('FunkyDrums-44p1-stereo-25secs.mp3', ...
%                 'SamplesPerFrame', 1024);
%
%   player = audioDeviceWriter('SampleRate', reader.SampleRate);
%
%   convolver = audiopluginexample.FastConvolver;
%
%   while ~isDone(reader)
%       x = reader();
%       y = convolver(x(:,1));
%       player(y);
%   end
%   release(reader)
%   release(player)
%
%   % Example 2: Launch a test bench for the FastConvolver object
%   convolver = audiopluginexample.FastConvolver;
%   audioTestBench(convolver);
%
%   % If you hear glitches in the audio played from audioTestBench, change
%   % 'Run As' mode to 'VST plugin'.
%
%   See also: dsp.FrequencyDomainFIRFilter, conv, fftfilt

 
%   Copyright 2016-2022 The MathWorks, Inc.

    methods
        function out=FastConvolver
        end

        function out=getOutputDataTypeImpl(~) %#ok<STOUT>
        end

        function out=getOutputSizeImpl(~) %#ok<STOUT>
        end

        function out=isInputSizeMutableImpl(~) %#ok<STOUT>
        end

        function out=isOutputComplexImpl(~) %#ok<STOUT>
        end

        function out=isOutputFixedSizeImpl(~) %#ok<STOUT>
        end

        function out=loadObjectImpl(~) %#ok<STOUT>
        end

        function out=resetImpl(~) %#ok<STOUT>
            % Initialize / reset discrete-state properties
        end

        function out=saveObjectImpl(~) %#ok<STOUT>
        end

        function out=setupImpl(~) %#ok<STOUT>
        end

        function out=stepImpl(~) %#ok<STOUT>
        end

    end
    properties
        % ImpulseResponse Impulse response
        %   Specify the impulse response for convolution, as a vector. The
        %   default value of this property is a 5 second impulse response
        %   of a church loaded from
        %   ChurchImpulseResponse-16-44p1-mono-5secs.wav file.
        ImpulseResponse;

        % PartitionSize Length of each partition of the impulse response
        %   Specify the length of each partition of the impulse response,
        %   as a finite positive integer scalar. The default value of this
        %   property is 1024.
        PartitionSize;

    end
end
