Create a Chained Audio Effect#

The SDK supports running multiple effects in a chain where the output from one effect is passed as the input to the second effect without performing unnecessary pre- and post-processing computations. For example, the SDK can chain the denoiser and Superresolution effects, which take in 16-kHz input data, remove the noise from this audio, and upsample it to 48 kHz.

This technique is more efficient than creating two standalone audio effect objects and passing the output of the first object to the next, and also avoids unnecessary device-to-host and host-to-device copies.

The following effect chains are supported by the SDK models:

  • Superresolution effect (8 kHz to 16 kHz) + Background Noise Removal effect (16 kHz).

  • Superresolution effect (8 kHz to 16 kHz) + Room Echo Removal effect (16 kHz).

  • Superresolution effect (8 kHz to 16 kHz) + Combined Background Noise Removal/Room Echo Removal effect (16 kHz).

  • Background Noise Removal effect (16 kHz) + Superresolution effect (16 kHz to 48 kHz).

  • Room Echo Removal effect (16 kHz) + Superresolution effect (16 kHz to 48 kHz).

  • Combined Background Noise Removal/Room Echo Removal effect (16 kHz) + Superresolution effect (16 kHz to 48 kHz).

  • Background Noise Removal effect (16 kHz) + Speaker Focus effect (16 kHz).

  • Background Noise Removal effect (48 kHz) + Speaker Focus effect (48 kHz).

Note

No other effect chains are supported by the SDK models. Using an unsupported chain by manually chaining individual effects together might result in degraded audio quality.

If you combine the Denoiser effect and the Dereverb effect, use the combined Denoiser+Dereverb model. (For more information, see About the Noise Removal/Background Noise Suppression Effect.)

To create a chained effect, call NvAFX_CreateChainedEffect with the following parameters:

  • One of the following effect selectors:

    NVAFX_CHAINED_EFFECT_DENOISER_16k_SUPERRES_16k_TO_48k
    NVAFX_CHAINED_EFFECT_DEREVERB_16k_SUPERRES_16k_TO_48k
    NVAFX_CHAINED_EFFECT_DEREVERB_DENOISER_16k_SUPERRES_16k_TO_48k
    NVAFX_CHAINED_EFFECT_SUPERRES_8k_TO_16k_DENOISER_16k
    NVAFX_CHAINED_EFFECT_SUPERRES_8k_TO_16k_DEREVERB_16k
    NVAFX_CHAINED_EFFECT_SUPERRES_8k_TO_16k_DEREVERB_DENOISER_16k
    NVAFX_CHAINED_EFFECT_DENOISER_16k_SPEAKER_FOCUS_16k
    NVAFX_CHAINED_EFFECT_DENOISER_48k_SPEAKER_FOCUS_48k
    
  • The pointer to the location that stores the handle to the newly created audio effect.

When a chained effect is created, the effect loads the effect DLLs for both effects in the chain. For further details, refer to the section Create an Audio Effect.

The following example creates a chained audio Background Noise Removal effect (16 kHz) + Superresolution effect (16 kHz to 48 kHz) effect:

NvAFX_Status err = NvAFX_CreateChainedEffect(NVAFX_CHAINED_EFFECT_DENOISER_16k_SUPERRES_16k_TO_48k, &handle);

Note

Running effects in a chain might impact the performance and latency of the audio pipeline.