Document toolboxDocument toolbox

(8.D.2.5) VolumeControlFract32

Overview

Volume control with Fletcher-Munson loudness compensation

Discussion

Volume control subsystem with built in loudness compensation. The system has one multichannel input pin and one multichannel output pin. Input and output pins must have the same dimensions. The System consists of a biquad_smoothed_module plus algorithms for dynamically adjusting the biquad coefficients. System has one interface variable: SYS.gain with a range of 0 to -90 dB. As gain is adjusted it is automatically translated to new target values for the biquad coefficients. The new coefficient values give 2 results: i.)Lower overall system volume by gain dB. ii.)Boost system bass according to Fletcher Munson nonlinear model. The center frequency for bass boost is specified by the constant SYS.centerFreq. .centerFreq is specified at instantiation time and be default equals 62. Hz. Theory of operation: 1.)At system creation a 5 coefficient biquad filter is created. The biquad frequency response is designed with a center frequency of SYS.centerFreq and a shape which closely fits Fletcher Munson difference curves. 2.)At system creation polynomial coefficients are calculated such that the polynomial: p(SYS.gain) will evaluate to the amount of bass boost in dB needed at SYS.centerFreq when overall system volume is cut by SYS.gain dB. 3.)When SYS.gain is changed p(SYS.gain) is evaluated. Two linear gains are then calculated: i.)passThruGain, (=undb20(SYS.gain)) and ii.)b which is equal to gain to be applied to the biquad. Desired system output = passThruGain*dataIn + b*(biquad output) (biquad output with dataIn for input). 4.)Intead of using a seperate biquad and mixer we dyanmically vary biquad coefficients so its transfer function implements the combined mixer biquad system described above. We need the original biquad numerator coefficients for calculation each time SYS.gain is varied thus we keep them in the constants: SYS.b0_LPF, SYS.b1_LPF, SYS.b2_LPF.

Type Definition

typedef struct _ModuleVolumeControlFract32 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure FLOAT32 gain; // Gain through the volume control FLOAT32 centerFreq; // Center frequency of the low frequency resonance FLOAT32 c2; // X^2 coefficient FLOAT32 c1; // X^1 coefficient FLOAT32 c0; // X^0 coefficient FLOAT32 b0_LPF; // First numerator coefficient FLOAT32 b1_LPF; // Second numerator coefficient FLOAT32 b2_LPF; // Third numerator coefficient awe_modBiquadSmoothedFract32Instance *mixerFilt; // 2nd order smoothly updating IIR filter } ModuleVolumeControlFract32Class;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

gain

float

parameter

0

0

-90:0.1:0

dB

centerFreq

float

const

0

62.5

30:120

Hz

c2

float

const

0

0.001904

Unrestricted

 

c1

float

const

0

-0.09575

Unrestricted

 

c0

float

const

0

-0.2614

Unrestricted

 

b0_LPF

float

const

0

0.004074

Unrestricted

 

b1_LPF

float

const

0

-6.224e-12

Unrestricted

 

b2_LPF

float

const

0

-0.004074

Unrestricted

 

Pins

Input Pins

Name: in

Description: Audio Input

Data type: fract32

Channel range: Unrestricted

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: volume_control_fract32_module.m

SYS=volume_control_fract32_module(NAME, CENTERFREQ) Creates a volume control module with built-in loudness compensation. This module can operate on multiple channels. Arguments: NAME - name of the module. CENTERFREQ - frequency of the low frequency gain boost, in Hz. By default equals 62.5 Hz.

Â