BlockExtract
Overview
Extracts a range of samples from a block of data. Can also zero pad the signal at the start or end.
Discussion
This module outputs a range of samples between the STARTINDEX and ENDINDEX arguments to the function. The module can be used to output a subset of the samples of a signal or to zero pad at the start or end of the buffer.
Typically, STARTINDEX and ENDINDEX are in the range [0 blockSize-1], where blockSize represents the number of samples on the input pin. The module outputs samples in the range STARTINDEX to ENDINDEX exclusively. The output pin has a blockSize of ENDINDEX-STARTINDEX+1 samples.
If you set STARTINDEX < 0, then the module will prepend a total of -STARTINDEX zeros to the buffer. Similarly, if you set ENDINDEX > blockSize-1, then the module will append ENDINDEX-blockSize+1 zeros to the end of the buffer. In all cases, the blockSize of the output pin is ENDINDEX-STARTINDEX+1 samples.
The module works on multichannel signals and supports real or complex data.
Module Pack
Advanced
ClassID
classID = 1223
Type Definition
typedef struct _ModuleBlockExtract
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 startIndex; // Start index of the data to extract.
INT32 endIndex; // End index of the data to extract.
} ModuleBlockExtractClass;
Variables
Properties
| Name | Type | Usage | isHidden | Default Value | Range | Units |
|---|---|---|---|---|---|---|
| startIndex | int | const | 0 | 0 | Unrestricted | |
| endIndex | int | const | 0 | 0 | Unrestricted |
Pins
Input Pins
| Name | in |
| Description | Input signal |
| 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 | Output signal |
| Data Type | {float, int, fract32} |
Matlab Usage
File Name: block_extract_module.m
M=block_extract_module(NAME, STARTINDEX, ENDINDEX)
Creates a block extract module for use in the Audio Weaver environment.
The module outputs the subset of samples between STARTINDEX and ENDINDEX
to the output pin. The module works with mono or multichannel signals and
supports time domain and complex frequency domain buffers. The output of
the module will contain a total of ENDINDEX-STARTINDEX+1 samples.
Let blockSize represent the number of samples per channel on the input
wire. Typically, STARTINDEX and ENDINDEX are in the range [0 blockSize-1]
and the module outputs a subset of samples. If you set STARTINDEX < 0,
then the module prepends -STARTINDEX samples to the start of the buffer.
Similarly, if you set ENDINDEX > (blockSize-1), then the module appends
ENDINDEX-blockSize+1 samples at the end of the buffer.
Arguments:
NAME - name of the module.
STARTINDEX - start index (zero based) of the data to extract.
ENDINDEX - end index (zero based) of the data to extract.
The output pin will have the same number of channels as the input pin.
Copyright (c) 2026 DSP Concepts, Inc.