Skip to main content
Skip table of contents

Rebuffer

Overview

Overlaps data into larger block sizes. The underlying time base is preserved.

Discussion

A rebuffer module converts from a smaller to a larger block size, with overlap. The module can support an artibrary number of channels and also supports any 32-bit data type (integer and floating-point). An internal buffer holds the overlap between samples.

At instantiation time, the output block size is specified by the variable OUTBLOCKSIZE. If OUTBLOCKSIZE is positive (e.g., 64), then a specific output block size (64) is set. If OUTBLOCKSIZE is negative (e.g., -4), then this specifies that the output block size is 4 times greater than the input block size.

Note that the rate of output blocks equals the rate of the input blocks. That is, this module does not change the fundamental block time.

Type Definition

CODE
typedef struct _ModuleRebuffer
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    INT32 outBlockSize;                           // Specifies the size of the output block. Positive values indicate a specific block size, in samples. Negative values specify a multiplicative factor between the input and output block sizes.
    INT32 overlap;                                // Number of samples of overlap between blocks. Set by the prebuild function.
    INT32 stateIndex;                             // Index of the oldest state variable in the array of state variables.
    FLOAT32* state;                               // State variable array.
} ModuleRebufferClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

outBlockSize

int

const

0

-2

-32:100000

overlap

int

const

1

32

Unrestricted

stateIndex

int

state

1

0

Unrestricted

state

float*

state

1

[32 x 1]

Unrestricted

Pins

Input Pins

Name: in

Description: audio input

Data type: {float, int, fract32}

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real and Complex

Output Pins

Name: out

Description: audio output

Data type: {float, int, fract32}

MATLAB Usage

File Name: rebuffer_module.m

CODE
 M=rebuffer_module(NAME, OUTBLOCKSIZE)
 Creates a rebuffering module which changes the output block size. The
 module performs buffering and generates output blocks that overlap in
 time. The output blocks are generated at the same rate as the input
 blocks.  
 
 Arguments:
    NAME - name of the module.
    OUTBLOCKSIZE - number of samples in each output block.
 The amount of overlap equals OUTBLOCKSIZE - M.inputPin{1}.type.blockSize.
 That is, the difference between the output and input block sizes.
 The module supports an arbitrary number of channels. Each channel is
 processed independently.
 If OUTBLOCKSIZE is positive, then it is treated as the specific size of
 the output block (as in the above discussion). If OUTBLOCKSIZE is
 negative, then it is treated as an integer multiplicative factor between
 the input and output block sizes. For example, if OUTBLOCKSIZE = -3, then
 the output block size equals 3 times the input block size.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.