Document toolboxDocument toolbox

(8.D.2.2 ) AGCCoreFract32

Overview

Automatic Gain Control gain calculator module

Type Definition

typedef struct _ModuleAGCCoreFract32 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure FLOAT32 targetLevel; // Target audio level FLOAT32 maxAttenuation; // Maximum attenuation of the AGC FLOAT32 maxGain; // Maximum gain of the AGC FLOAT32 ratio; // Slope of the output attenuation when the signal is above threshold FLOAT32 activationThreshold; // Activation threshold of the AGC. The AGC stops updating its gain when the instantaneous input level is below this value FLOAT32 smoothingTime; // Response time of the AGC. This controls the RMS smoothing interval and the time constant of the smoothly updating gain INT32 enableRecovery; // Boolean which enables the AGC's gain recovery. If enabled, the AGC slows returns 0 dB gain when the input is below the activation threshold FLOAT32 recoveryRate; // Rate at which the gain is adjusted when the input is below the activation threshold FLOAT32 currentGain; // Instantaneous gain of the smoothing operation. fract32 smoothingCoeffSampleFract32; // Sample-by-sample smoothing coefficient for the output gain adjustment. Set via smoothingTime. fract32 smoothingCoeffBlockFract32; // Block-by-block smoothing coefficient for the RMS measurement. Set via smoothingTime. fract32 targetGainFract32; // Target gain of the smoothing operation. fract32 energyFract32; // Smoothed energy measurement. fract32 oneOverNumSamplesFract32; // 1 divided by the number of samples in the input pin. Used internally by the algorithm in order to save a divide operation. fract32 oneOverSlopeFract32; // Used by the processing function to compute the amount of cut/boost. Equal to 1-1/ratio. FLOAT32 oneOverSlope; // Used by the processing function to compute the amount of cut/boost. Equal to 1-1/ratio. FLOAT32 smoothingCoeffSample; // Sample-by-sample smoothing coefficient for the output gain adjustment. Set via smoothingTime. FLOAT32 smoothingCoeffBlock; // Block-by-block smoothing coefficient for the RMS measurement. Set via smoothingTime. FLOAT32 recoveryRateUp; // Recovery rate coefficient when increasing the gain (it is always >= 1) FLOAT32 recoveryRateDown; // Recovery rate coefficient when decreasing the gain (it is always <= 1) FLOAT32 targetGain; // Target gain of the smoothing operation. FLOAT32 energy; // Smoothed energy measurement. FLOAT32 oneOverNumSamples; // 1 divided by the number of samples in the input pin. Used internally by the algorithm in order to save a divide operation. fract32 targetLevelFract32; // Target audio level fract32 maxGainFract32; // Maximum gain of the AGC fract32 maxAttenuationFract32; // Maximum attenuation of the AGC fract32 activationThresholdFract32; // Activation threshold of the AGC. The AGC stops updating its gain when the instantaneous input level is below this value fract32 recoveryRateUpFract32; // Recovery rate coefficient when increasing the gain (it is always >= 1) fract32 recoveryRateDownFract32; // Recovery rate coefficient when decreasing the gain (it is always <= 1) fract32 currentGainFract32; // Instantaneous gain of the smoothing operation. } ModuleAGCCoreFract32Class;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

targetLevel

float

parameter

0

-20

-50:0.1:50

dB

maxAttenuation

float

parameter

0

100

0:100

dB

maxGain

float

parameter

0

12

0:50

dB

ratio

float

parameter

0

10

1:100

dB/dB

activationThreshold

float

parameter

0

-50

-100:-20

dB

smoothingTime

float

parameter

0

100

1:5000

msec

enableRecovery

int

parameter

0

1

0:1

 

recoveryRate

float

parameter

0

2.4

1:20

dB/sec

currentGain

float

state

0

0

-12:12

 

smoothingCoeffSampleFract32

fract32

derived

0

0.0002083

Unrestricted

 

smoothingCoeffBlockFract32

fract32

derived

0

0.006644

Unrestricted

 

targetGainFract32

fract32

state

0

0

Unrestricted

 

energyFract32

fract32

state

0

0

Unrestricted

 

oneOverNumSamplesFract32

fract32

derived

0

0.03125

Unrestricted

 

oneOverSlopeFract32

fract32

derived

0

0.9

Unrestricted

 

oneOverSlope

float

derived

1

0.9

Unrestricted

 

smoothingCoeffSample

float

derived

1

0.0002083

Unrestricted

 

smoothingCoeffBlock

float

derived

1

0.006644

Unrestricted

 

recoveryRateUp

float

derived

1

1

Unrestricted

 

recoveryRateDown

float

derived

1

0.9998

Unrestricted

 

targetGain

float

state

1

0

Unrestricted

 

energy

float

state

1

0

Unrestricted

 

oneOverNumSamples

float

derived

1

0.03125

Unrestricted

 

targetLevelFract32

fract32

derived

1

-0.1563

Unrestricted

 

maxGainFract32

fract32

derived

1

0.09375

Unrestricted

 

maxAttenuationFract32

fract32

derived

1

0.7813

Unrestricted

 

activationThresholdFract32

fract32

derived

1

-0.3906

Unrestricted

 

recoveryRateUpFract32

fract32

derived

1

0.25

Unrestricted

 

recoveryRateDownFract32

fract32

derived

1

0.25

Unrestricted

 

currentGainFract32

fract32

state

1

0

Unrestricted

 

Pins

Input Pins

Name: in

Description: Audio input

Data type: fract32

Channel range: 1

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: audio output

Data type: fract32

MATLAB Usage

File Name: agc_core_fract32_module.m

M=agc_core_fract32_module(NAME) Audio Weaver modules which calculates the instantaneous gain needed by an automatic gain control AGC module. This module is used in conjunction with the agc_multiplier_module. The input format for this module is 1.31 and output format is 4.28. NAME - name of the module.

Â