SAF
Loading...
Searching...
No Matches
ambi_drc.c File Reference

A frequency-dependent Ambisonic sound scene dynamic range compressor (DRC) More...

#include "ambi_drc.h"
#include "ambi_drc_internal.h"

Go to the source code of this file.

Functions

void ambi_drc_create (void **const phAmbi)
 Creates an instance of the ambi_drc.
 
void ambi_drc_destroy (void **const phAmbi)
 Destroys an instance of the ambi_drc.
 
void ambi_drc_init (void *const hAmbi, int sampleRate)
 Initialises an instance of ambi_drc with default settings.
 
void ambi_drc_process (void *const hAmbi, const float *const *inputs, float *const *const outputs, int nCh, int nSamples)
 Applies the frequency-dependent dynamic range compression to the input spherical harmonic signals.
 
void ambi_drc_refreshSettings (void *const hAmbi)
 Sets all intialisation flags to 1; re-initialising all settings/variables as ambi_drc is currently configured, at next available opportunity.
 
void ambi_drc_setThreshold (void *const hAmbi, float newValue)
 Sets the compressor threshold value in DECIBELS.
 
void ambi_drc_setRatio (void *const hAmbi, float newValue)
 Sets the compression ratio.
 
void ambi_drc_setKnee (void *const hAmbi, float newValue)
 Sets the compressor knee value; 0: hard knee, >0: soft knee, in DECIBELS.
 
void ambi_drc_setInGain (void *const hAmbi, float newValue)
 Sets the compressor input gain value, in DECIBELS.
 
void ambi_drc_setOutGain (void *const hAmbi, float newValue)
 Sets the compressor output gain value, in DECIBELS.
 
void ambi_drc_setAttack (void *const hAmbi, float newValue)
 Sets the compressor envelope attack time, in miliseconds.
 
void ambi_drc_setRelease (void *const hAmbi, float newValue)
 Sets the compressor envelope release time, in miliseconds.
 
void ambi_drc_setChOrder (void *const hAmbi, int newOrder)
 Sets the Ambisonic channel ordering convention to decode with, in order to match the convention employed by the input signals (see CH_ORDER enum)
 
void ambi_drc_setNormType (void *const hAmbi, int newType)
 Sets the Ambisonic normalisation convention to decode with, in order to match with the convention employed by the input signals (see NORM_TYPES enum)
 
void ambi_drc_setInputPreset (void *const hAmbi, SH_ORDERS newPreset)
 Sets processing order.
 
int ambi_drc_getFrameSize (void)
 Returns the processing framesize (i.e., number of samples processed with every _process() call )
 
float ambi_drc_getThreshold (void *const hAmbi)
 Returns the compressor threshold value, in DECIBELS.
 
float ambi_drc_getRatio (void *const hAmbi)
 Returns the compression ratio.
 
float ambi_drc_getKnee (void *const hAmbi)
 Returns the compressor knee value 0: hard knee, >0: soft knee, in DECIBELS.
 
float ambi_drc_getInGain (void *const hAmbi)
 Returns the compressor input gain value, in DECIBELS.
 
float ambi_drc_getOutGain (void *const hAmbi)
 Returns the compressor output gain value, in DECIBELS.
 
float ambi_drc_getAttack (void *const hAmbi)
 Returns the compressor envelope attack time, in miliseconds.
 
float ambi_drc_getRelease (void *const hAmbi)
 Returns the compressor envelope release time, in miliseconds.
 
int ambi_drc_getChOrder (void *const hAmbi)
 Returns the Ambisonic channel ordering convention currently being used to decode with, which should match the convention employed by the input signals (see CH_ORDER enum)
 
int ambi_drc_getNormType (void *const hAmbi)
 Returns the Ambisonic normalisation convention currently being usedto decode with, which should match the convention employed by the input signals (see NORM_TYPES enum)
 
SH_ORDERS ambi_drc_getInputPreset (void *const hAmbi)
 Returns the current processing order (see SH_ORDERS enum)
 
int ambi_drc_getNSHrequired (void *const hAmbi)
 Returns the number of spherical harmonic signals required by the current decoding order: (current_order+1)^2.
 
int ambi_drc_getSamplerate (void *const hAmbi)
 Returns the DAW/Host sample rate.
 
int ambi_drc_getProcessingDelay ()
 Returns the processing delay in samples; may be used for delay compensation features.
 

Detailed Description

A frequency-dependent Ambisonic sound scene dynamic range compressor (DRC)

The implementation can also keep track of the frequency-dependent gain factors for the omnidirectional component over time (for optional plotting). The design is based on the algorithm presented in [1].

The DRC gain factors per band are determined based on the omnidirectional component, which are then applied to all of the higher-order components; thus, the spatial information of the Ambisonic sound scene is retained (although, your perception of them may change due to the DRC).

See also
[1] McCormack, L., & Välimäki, V. (2017). "FFT-Based Dynamic Range Compression". in Proceedings of the 14th Sound and Music Computing Conference, July 5-8, Espoo, Finland.
Author
Leo McCormack
Date
07.01.2017
License
ISC

Definition in file ambi_drc.c.

Function Documentation

◆ ambi_drc_create()

void ambi_drc_create ( void **const phAmbi)

Creates an instance of the ambi_drc.

Parameters
[in]phAmbi(&) address of ambi_drc handle

Definition at line 43 of file ambi_drc.c.

◆ ambi_drc_destroy()

void ambi_drc_destroy ( void **const phAmbi)

Destroys an instance of the ambi_drc.

Parameters
[in]phAmbi(&) address of ambi_drc handle

Definition at line 82 of file ambi_drc.c.

◆ ambi_drc_getAttack()

float ambi_drc_getAttack ( void *const hAmbi)

Returns the compressor envelope attack time, in miliseconds.

Definition at line 383 of file ambi_drc.c.

◆ ambi_drc_getChOrder()

int ambi_drc_getChOrder ( void *const hAmbi)

Returns the Ambisonic channel ordering convention currently being used to decode with, which should match the convention employed by the input signals (see CH_ORDER enum)

Definition at line 395 of file ambi_drc.c.

◆ ambi_drc_getFrameSize()

int ambi_drc_getFrameSize ( void )

Returns the processing framesize (i.e., number of samples processed with every _process() call )

Definition at line 318 of file ambi_drc.c.

◆ ambi_drc_getInGain()

float ambi_drc_getInGain ( void *const hAmbi)

Returns the compressor input gain value, in DECIBELS.

Definition at line 371 of file ambi_drc.c.

◆ ambi_drc_getInputPreset()

SH_ORDERS ambi_drc_getInputPreset ( void *const hAmbi)

Returns the current processing order (see SH_ORDERS enum)

Definition at line 407 of file ambi_drc.c.

◆ ambi_drc_getKnee()

float ambi_drc_getKnee ( void *const hAmbi)

Returns the compressor knee value 0: hard knee, >0: soft knee, in DECIBELS.

Definition at line 365 of file ambi_drc.c.

◆ ambi_drc_getNormType()

int ambi_drc_getNormType ( void *const hAmbi)

Returns the Ambisonic normalisation convention currently being usedto decode with, which should match the convention employed by the input signals (see NORM_TYPES enum)

Definition at line 401 of file ambi_drc.c.

◆ ambi_drc_getNSHrequired()

int ambi_drc_getNSHrequired ( void *const hAmbi)

Returns the number of spherical harmonic signals required by the current decoding order: (current_order+1)^2.

Definition at line 413 of file ambi_drc.c.

◆ ambi_drc_getOutGain()

float ambi_drc_getOutGain ( void *const hAmbi)

Returns the compressor output gain value, in DECIBELS.

Definition at line 377 of file ambi_drc.c.

◆ ambi_drc_getProcessingDelay()

int ambi_drc_getProcessingDelay ( void )

Returns the processing delay in samples; may be used for delay compensation features.

Definition at line 425 of file ambi_drc.c.

◆ ambi_drc_getRatio()

float ambi_drc_getRatio ( void *const hAmbi)

Returns the compression ratio.

Definition at line 359 of file ambi_drc.c.

◆ ambi_drc_getRelease()

float ambi_drc_getRelease ( void *const hAmbi)

Returns the compressor envelope release time, in miliseconds.

Definition at line 389 of file ambi_drc.c.

◆ ambi_drc_getSamplerate()

int ambi_drc_getSamplerate ( void *const hAmbi)

Returns the DAW/Host sample rate.

Definition at line 419 of file ambi_drc.c.

◆ ambi_drc_getThreshold()

float ambi_drc_getThreshold ( void *const hAmbi)

Returns the compressor threshold value, in DECIBELS.

Definition at line 353 of file ambi_drc.c.

◆ ambi_drc_init()

void ambi_drc_init ( void *const hAmbi,
int samplerate )

Initialises an instance of ambi_drc with default settings.

Parameters
[in]hAmbiambi_drc handle
[in]samplerateHost samplerate.

Definition at line 105 of file ambi_drc.c.

◆ ambi_drc_process()

void ambi_drc_process ( void *const hAmbi,
const float *const * inputs,
float *const * outputs,
int nCH,
int nSamples )

Applies the frequency-dependent dynamic range compression to the input spherical harmonic signals.

Parameters
[in]hAmbiambi_drc handle
[in]inputsInput channel buffers; 2-D array: nCH x nSamples
[in]outputsOutput channel buffers; 2-D array: nCH x nSamples
[in]nCHNumber of input/output channels
[in]nSamplesNumber of samples in 'inputs'/'output' matrices

Definition at line 136 of file ambi_drc.c.

◆ ambi_drc_refreshSettings()

void ambi_drc_refreshSettings ( void *const hAmbi)

Sets all intialisation flags to 1; re-initialising all settings/variables as ambi_drc is currently configured, at next available opportunity.

Definition at line 239 of file ambi_drc.c.

◆ ambi_drc_setAttack()

void ambi_drc_setAttack ( void *const hAmbi,
float newValue )

Sets the compressor envelope attack time, in miliseconds.

Definition at line 275 of file ambi_drc.c.

◆ ambi_drc_setChOrder()

void ambi_drc_setChOrder ( void *const hAmbi,
int newOrder )

Sets the Ambisonic channel ordering convention to decode with, in order to match the convention employed by the input signals (see CH_ORDER enum)

Definition at line 287 of file ambi_drc.c.

◆ ambi_drc_setInGain()

void ambi_drc_setInGain ( void *const hAmbi,
float newValue )

Sets the compressor input gain value, in DECIBELS.

Definition at line 263 of file ambi_drc.c.

◆ ambi_drc_setInputPreset()

void ambi_drc_setInputPreset ( void *const hAmbi,
SH_ORDERS newPreset )

Sets processing order.

If input order is set higher than the input signal order, the extra required channels are filled with zeros. If the input order is set lower than the input signal order, the number input signals are truncated accordingly (see SH_ORDERS enum)

Definition at line 301 of file ambi_drc.c.

◆ ambi_drc_setKnee()

void ambi_drc_setKnee ( void *const hAmbi,
float newValue )

Sets the compressor knee value; 0: hard knee, >0: soft knee, in DECIBELS.

Definition at line 257 of file ambi_drc.c.

◆ ambi_drc_setNormType()

void ambi_drc_setNormType ( void *const hAmbi,
int newType )

Sets the Ambisonic normalisation convention to decode with, in order to match with the convention employed by the input signals (see NORM_TYPES enum)

Definition at line 294 of file ambi_drc.c.

◆ ambi_drc_setOutGain()

void ambi_drc_setOutGain ( void *const hAmbi,
float newValue )

Sets the compressor output gain value, in DECIBELS.

Definition at line 269 of file ambi_drc.c.

◆ ambi_drc_setRatio()

void ambi_drc_setRatio ( void *const hAmbi,
float newValue )

Sets the compression ratio.

Definition at line 251 of file ambi_drc.c.

◆ ambi_drc_setRelease()

void ambi_drc_setRelease ( void *const hAmbi,
float newValue )

Sets the compressor envelope release time, in miliseconds.

Definition at line 281 of file ambi_drc.c.

◆ ambi_drc_setThreshold()

void ambi_drc_setThreshold ( void *const hAmbi,
float newValue )

Sets the compressor threshold value in DECIBELS.

Definition at line 245 of file ambi_drc.c.