Skip to content

SCNRv4GainCalculator

Overview

DSP Concepts proprietary Single-Channel Noise Reduction Gain Calculator. For version 4

Discussion

This module calculates gain coefficients for single-channel noise reduction. It is part of the SCNRv4 design.

The module works in conjunction with the WOLA filterbank modules.

The Yk input pin expects the squared-magnitude of the WOLA-domain noisy signal.

The Pn input pin expects a signal with noise levels per subband. This signal should be in dBs, and typically comes directly from the output of the NoiseTracking module.

The output pin provides the gain coefficients per subband, which can then be applied to the WOLA-domain samples of the input signal. These are real numbers and represent magnitude only.

The module is single channel, expects real data, and operates on any block size and any sampling rate.

The minGaindB parameter is the lower clipping threshold of gain for each frequency bin. The value for minGaindB is a negative number in dB, and it corresponds to the maximum attenuation allowed for each subband.

Before being output, the gain signal is smoothed out using cross-bin averaging in logarithmic groupings. The smoothOctave parameter defines how many octaves the averaging should span. Smoothing can be disabled by setting smoothOctave to 0.

The timeAlphaPrioriMs parameter controls the recursive averaging parameter in the SNR calculation. The default value is 250ms. Higher values mean more smoothing, resulting in a lower risk of musical noise, but a higher risk of distorting onset transients.

Module Pack

awe-mod-dspc-vui

ClassID

classID = 15303

Type Definition

typedef struct _ModuleSCNRv4GainCalculator
{
ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
FLOAT32 prioriSnrScaler1Gain;                 // Scaler gain.
FLOAT32 prioriSnrScaler2Gain;                 // Scaler gain.
FLOAT32 timeAlphaPrioriMs;                    // Averaging time for a-priori SNR computation, in ms.
FLOAT32 minGaindB;                            // Minimum gain (maximum reduction) per subband, in dB.
FLOAT32 smoothOctave;                         // Number of octaves for cross-bin logarithmic smoothing.
FLOAT32 postSnrClipAsymUpper;                 // Asymmetric-clip upper limit.
FLOAT32 prioriSnrClipAsymUpper;               // Asymmetric-clip upper limit.
FLOAT32 gainCalcLogScaleGain;                 // Scale Offset gain.
FLOAT32 smoothStartFreq;                      // Start frequency for cross-bin smoothing.
FLOAT32* aAPrioriFb;                          // A-priori SNR estimation feedback line.
FLOAT32* aPrioriSnrDelay;                     // Block Delay single-block delay buffer.
INT32* aSmoothStartIdx;                       // Starting index for the averaging process.
INT32* aSmoothEndIdx;                         // Ending index for the averaging process.
FLOAT32* aSmoothOneOverN;                     // Precomputed 1/N for averaging.
} ModuleSCNRv4GainCalculatorClass;

Variables

Properties

Name Type Usage isHidden Default Value Range Units
prioriSnrScaler1Gain float derived 0 0.9999 Unrestricted
prioriSnrScaler2Gain float derived 0 8.333e-05 Unrestricted
timeAlphaPrioriMs float parameter 0 250 0:1000000 ms
minGaindB float parameter 0 -12 -30:0 dB
smoothOctave float parameter 0 0.1 0:1
postSnrClipAsymUpper float const 1 1000000 Unrestricted
prioriSnrClipAsymUpper float const 1 10000 Unrestricted
gainCalcLogScaleGain float const 1 0.03333 Unrestricted
smoothStartFreq float const 1 0 Unrestricted
aAPrioriFb float* state 1 [1 x 33] Unrestricted
aPrioriSnrDelay float* state 1 [1 x 33] Unrestricted
aSmoothStartIdx int* derived 1 [33 x 1] Unrestricted
aSmoothEndIdx int* derived 1 [33 x 1] Unrestricted
aSmoothOneOverN float* derived 1 [33 x 1] Unrestricted

Pins

Input Pins

Name Yk
Description Input signal power
Data type float
Channel range 1
Block size range Unrestricted
Sample rate range Unrestricted
Complex support Real
Name Pn
Description Input noise power
Data type float
Channel range 1
Block size range Unrestricted
Sample rate range Unrestricted
Complex support Real

Output Pins

Name gain
Description Output signal
Data Type float

Scratch Pins

Channel Count 1
Block size 34
Sample rate 48000

Matlab Usage

File Name: scnrv4_gain_calculator_module.m 
 M = scnrv4_gain_calculator_module(NAME) 
 Single-channel noise-reduction gain calculator. This module 
 takes a noise-level estimate and calculates gain coefficients to be used 
 in noise reduction. 

 Arguments: 
 NAME - name of the module 

Copyright (c) 2026 DSP Concepts, Inc.