Convolve
Overview
Vector convolution
Discussion
This module convolves the signals on its input pins a block at a time. It differs from the FIR module because it doesn't maintain any history between blocks. The output is computed by $s[n] = \sum_{k=0}^{M-1} x[n-k] y[k]$, where $x[n]$ is on pin 1 with length $M$ and $y[n]$ is on pin 2, also of length $M$. This operation could be generalized to allow different block sizes if needed.
The parameters shape, skip and length allows control of the range of $n$ that gets calculated. Shape is for quick setting of common ranges. shape = 0: sets skip=0, olen=2*M-1 to compute the full convolution shape = 1: sets skip=M/2, olen=M to compute the center part that has the same length as the inputs. shape = 2: leaves skip and olen to be user-defined. skip: starts storing output at $n = \mathit{skip}$ olen: writes only this many output samples, so $\mathit{skip} <= n < \mathit{skip} + \mathit{olen}$.
Type Definition
typedef struct _ModuleConvolve
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 shape; // Shape of subsection
INT32 skip; // Number of samples of full convolution to skip at output
INT32 olen; // Length of output
} ModuleConvolveClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
shape | int | parameter | 0 | 0 | 0:2 | |
skip | int | parameter | 0 | 0 | 0:63 | samples |
olen | int | parameter | 0 | 63 | 0:63 | samples |
Pins
Input Pins
Name: in0
Description: Input signal 0
Data type: float
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Name: in1
Description: Input signal 1
Data type: float
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: Convolution output
Data type: float
MATLAB Usage
File Name: convolve_module.m
M = convolve_module(NAME, SHAPE)
This module implements a partial convolution of the two signals on its
input pins. How much of the convolution to write can be controlled by
the parameters. Also see correlate_module, which is very similar.
Arguments:
NAME - name of the module
SHAPE - enum of standard subset to calculate