Skip to content

RebufferedSink

Discussion

The Rebuffered Sink module is a memory effective combination of a Rebuffer and a Sink module. Rebuffer and Sink modules are often used in combination for audio signal analysis which can become delicate on systems with a small memory available. Using a rebuffer and a sink module separately allocates memory multiple times: In the rebuffer, in the wire and in the sink. This rebuffered sink has an assignable FIFO which allows the user to feed the sink with any block size. The rebuffering - with the length defined as an argument - would only take place in the sink. The module converts from a smaller to a larger block size, with overlap and supports an arbitrary number of channels. An internal buffer holds the overlap between samples.

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

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

The module supports floating-point values and handles both real and complex data. The inspector window shows the data using a plot. In the inspector window, there are two edit boxes for maximum(Ymax) and minimum(Ymin) limits for plotting amplitude. If the user gives Ymax less than Ymin then the range [Ymax Ymin] will be automatically set by MATLAB.

Module Pack

Advanced

ClassID

classID = 1444

Type Definition

typedef struct _ModuleRebufferedSink
{
ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
INT32 bufferBlockSize;                        // Specifies the size of the buffer block. Positive values indicate a specific block size, in samples. Negative values specify a multiplicative factor between the input and buffer block sizes.
INT32 overlap;                                // Number of samples of overlap between blocks. Set by the prebuild function.
INT32 stateHeap;                              // Heap in which to allocate memory.
FLOAT32* value;                               // Captured values.
} ModuleRebufferedSinkClass;

Variables

Properties

Name Type Usage isHidden Default Value Range Units
bufferBlockSize int const 0 64 Unrestricted
overlap int const 1 32 Unrestricted
stateHeap int const 1 2 Unrestricted
value float* state 1 [64 x 1] Unrestricted

Pins

Input Pins

Name in
Description audio input
Data type float
Channel range Unrestricted
Block size range Unrestricted
Sample rate range Unrestricted
Complex support Real and Complex

Matlab Usage

File Name: rebuffered_sink_module.m 
 M = rebuffered_sink_module(NAME, BUFFERBLOCKSIZE, MEMHEAP) 
 Creates a rebuffering sink (capture) module for use with the Audio Weaver 
 environment. The module captures a block of input data and stores it into 
 an internal buffer. The module performs buffering and generates buffer  
 blocks that overlap in time. The buffer blocks are generated at the same  
 rate as the input blocks.   

 Arguments: 
    NAME - name of the module. 
    BUFFERBLOCKSIZE - number of samples in each buffer block. 
    MEMHEAP - specifies the memory heap to use to allocate the main 
         state buffer. This is a string and follows the memory allocation 
         enumeration in Framework.h. Allowable values are: 
            'AWE_HEAP_FAST' - always use internal DM memory. 
            'AWE_HEAP_FASTB' - always use internal PM memory. 
            'AWE_HEAP_SLOW' - always use external memory (the default). 
            'AWE_HEAP_FAST2SLOW' - use internal memory. If this fails 
               then use external memory. 
            'AWE_HEAP_FASTB2SLOW' - use internal memory. If this fails 
               then use external memory. 

 The amount of overlap equals BUFFERBLOCKSIZE - M.inputPin{1}.type.blockSize. 
 That is, the difference between the buffer and input block sizes. 

 The module supports an arbitrary number of channels. Each channel is 
 processed independently. 

 If BUFFERBLOCKSIZE is positive, then it is treated as the specific size of 
 the buffer block (as in the above discussion). If BUFFERBLOCKSIZE is 
 negative, then it is treated as an integer multiplicative factor between 
 the input and buffer block sizes. For example, if BUFFERBLOCKSIZE = -3, then 
 the buffer block size equals 3 times the input block size. 

Copyright (c) 2026 DSP Concepts, Inc.