# BandToBin

## Overview

Expand frequency domain bands into individual bins

## Discussion

The Band to Bin Module is a module that expands frequency bands into more bins by copying the value of each band into each individual bin. The number of input bands is determined by the input wire block size. It expands each input band into multiple bins as per the user defined bandSize array and this module only accepts real numbers as inputs. If the total number of bins in .bandSize is smaller than the .numBins argument, the module will output zeros for the missing bins. If the total number of bins in .bandSize is greater than the .numBins argument, the module will ignore the value of any band that is larger than the last bin. This module is meant to be used after the Bin to Band module to restore the original number of bins after doing processing a fewer number of bands. The module supports multichannel inputs and separately expands 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].

## Type Definition

CODE
``````typedef struct _ModuleBandToBin
{
ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
INT32* bandSize;                              // Number of output bins to expand per input band.
INT32* startIndex;                            // Starting bin index for each band.
INT32* endIndex;                              // Ending bin index for each band.
} ModuleBandToBinClass;``````

## Variables

### Properties

 Name Type Usage isHidden Default value Range Units bandSize int* parameter 0 [32 x 1] Unrestricted startIndex int* derived 1 [32 x 1] Unrestricted endIndex int* derived 1 [32 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: band_to_bin_module.m

CODE
`````` M = band_to_bin_module(NAME, NUMBINS)
Creates a module which expands frequency bands to individual frequency
bins.  Arguments:
NAME - name of the module.
NUMBINS - number of output bins``````

JavaScript errors detected