Skip to content

BinToBand

Overview

Groups frequency domain bins into larger bands

Discussion

The Bin to Band Module is a module that combines frequency bins into fewer bands, usually for the purpose of doing processing over larger groups of frequencies. The input number of bins is defined by the block size of the input wire and cannot be changed, while the number of output bands is user defined. However, they cannot exceed the number of input bins, and only accepts real numbers as inputs. There are three different methods to combine bins - maximum, minimum, and mean. Use the .mapping variable to control the processing mode, and set each band's bins with the .bandSize array. If the total number of bins in .bandSize is smaller than the input number of bins, the module will ignore the missing bins. If the total number of bins in .bandSize is greater than the input number of bins, the module will limit the band that is larger than the last bin to the last bin. Any following bands will then output zeros, since there are no more input bins to combine. This module is meant to be used in conjunction with the Band to Bin Module to expand the bands back to the original number of bins. The module supports multichannel inputs and separately combines the bins for each channel. That is, if the input has N channels then the output will also have N channels.

Example: We have a 12 bin system that we want to combine into 4 bands. We would start off by using the Bin to Band module with 4 output bands, setting each element of the bandSize array to 3 to combine 3 bins each. If the input x[n] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], then the output would be (if using the maximum value processing mode) y[n] = [2, 5, 8, 11]. At this point you could do processing over these 4 bands. But if you sent this as an input to the Band to Bin module and set it to expand to 12 bins, with each band expanding to 3 bins, then for an input x[n] = [2, 5, 8, 11] you would get an output of y[n] = [2, 2, 2, 5, 5, 5, 8, 8, 8, 11, 11, 11].

Module Pack

Advanced

ClassID

classID = 1424

Type Definition

typedef struct _ModuleBinToBand
{
ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
INT32 mapping;                                // Manner in which bins are combined.
INT32 numBands;                               // Number of output bands.
INT32* bandSize;                              // Number of input bins to combine per output band.
INT32* startIndex;                            // Starting bin index for each band.
INT32* endIndex;                              // Ending bin index for each band.
FLOAT32* divisor;                             // Divisor per bin when computing the average.
} ModuleBinToBandClass;

Variables

Properties

Name Type Usage isHidden Default Value Range Units
mapping int parameter 0 0 0:2
numBands int const 1 10 Unrestricted
bandSize int* parameter 0 [10 x 1] Unrestricted
startIndex int* derived 1 [10 x 1] Unrestricted
endIndex int* derived 1 [10 x 1] Unrestricted
divisor float* derived 1 [10 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

Output Pins

Name out
Description audio output
Data Type float

Matlab Usage

File Name: bin_to_band_module.m 
 M = bin_to_band_module(NAME, NUMBANDS) 
 Creates a module which groups frequency bins together into 
 non-overlapping bands.   Arguments: 
    NAME - name of the module. 
    NUMBANDS - number of output bands 

Copyright (c) 2026 DSP Concepts, Inc.