Skip to main content
Skip table of contents

SbSmoothV2

Overview

Subband smoothing across frequency bins

Discussion

This module performs smoothing across frequency bins. Smoothing is done by averaging multiple bins to the left and right of a particular frequency sample. The smoothing only operates on real data. To smooth complex data it must first be decomposed into real and imaginary components.

The module supports two different forms of smoothing. In linear smoothing (type = 0), N bins to the left and N bins to the right of each bin are averaged, where N is a fixed number. The number of bins N is specified by the parameter .width, and .width is specified in Hz. If a bin is centered at frequency F, then the bins in the range [F-width F+width] are averaged.

In logarithmic smoothing (type = 1), M samples to the left and N samples to the right are averaged. .width then equals the number of octaves to the left and right that are averaged. If a bin is centered at frequency F, then the bins in the range [F*2^(-width) F*2^(width)] are averaged.

The module also checks to make sure that all of the bins to average are within the valid range. That is, the lower bin index is never less than 0 and the upper bin index never exceeds blockSize - 1.

Internally, the module uses a cumulative sum of values to reduce computation time. With this approach, the execution time is always a fixed constant independent of the smoothing width. Several hidden arrays are computed by the set function and used by the process function. startIndex[] and endIndex[] specify the starting and ending index of the cumulative sum to use. oneOverN[k] = 1 / (endIndex[k] - startIndex[k] + 1) and is used to speed up calculation of the average without requiring a divide. The module's process function computes (cumSum[endIndex[k]] - cumSum[startIndex[k]]) * oneOverN[k].

The module also supports a custom smoothing (type = 2). When custom smoothing is engaged, you have to manually set the 3 arrays startIndex[], endIndex[], and oneOverN[].

The parameter .startFreq allows you to specify that certain low frequency bins should not be smoothed. Only bins above .startFreq Hz are smoothed.

The module is designed to work with the wola_analysis_subsystem.m and the sample rate specified equals the decimated subband sample rate. Alternate sample rates must use a SetWireProperties module, the sampleRate input is ignored. The bin spacing will be the incoming wire sample rate / 2

Type Definition

CODE
typedef struct _ModuleSbSmoothV2
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    INT32 type;                                   // Determines which type of smoothing is applied: Linear=0, Logarithmic=1, Custom=2
    FLOAT32 startFreq;                            // Starting frequency for the smoothing operation
    FLOAT32 width;                                // Amount of smoothing
    INT32* startIndex;                            // Starting index for the averaging process.
    INT32* endIndex;                              // Ending index for the averaging process.
    FLOAT32* oneOverN;                            // Precomputed 1/N for averaging.
} ModuleSbSmoothV2Class;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

type

int

parameter

0

1

0:2

startFreq

float

parameter

0

0

0:3072000

Hz

width

float

parameter

0

0.1667

0:2400

startIndex

int*

derived

1

[257 x 1]

Unrestricted

endIndex

int*

derived

1

[257 x 1]

Unrestricted

oneOverN

float*

derived

1

[257 x 1]

Unrestricted

Pins

Input Pins

Name: in

Description: audio input

Data type: float

Channel range: 1

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: audio output

Data type: float

Scratch Pins

Channel count: 1

Block size: 258

Sample rate: 48000

MATLAB Usage

File Name: sb_smooth_v2_module.m

CODE
 M=sb_smooth_module_v2(NAME, BLOCKSIZE, SAMPLERATE)
 Subband smoothing module which performs averaging across frequency
 bands.  The module supports linear or logarithmic smoothing across
 bands.  Arguments:
    NAME - name of the module.
    BLOCKSIZE - initial BLOCKSIZE (the final BLOCKSIZE is taken from the
                input wire).
    SAMPLERATE - sample rate of the corresponding time domain signal.  If
                 this is empty (the default), then the module assumes that
                 it is being used with 2x oversampling WOLA filterbank.
                 You can manually override this time setting this, for
                 example, to 16000.
 Copyright 2011-2020.  DSP Concepts, Inc.  All Rights Reserved.

JavaScript errors detected

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

If this problem persists, please contact our support.