effects_delayed_streams_demo Application#

This application demonstrates the use case for handling delayed streams. (For more information, refer to Run an Audio Effect on Delayed Audio Streams on Linux.) In this sample, each of the input streams falls under one of the following categories:

one_step_delay_streams

These streams have a delay of one frame. For example, if the frame size is 10ms, these streams will have a delay of 10ms. This means that these streams will be active every alternate iteration. When active, it will receive data for both frames (20ms). As a result, when data from these streams arrive, NvAFX_Run should be called two times, once with the delayed data and once with the current data.

two_step_delay_streams

These streams have a delay of two frames. For example, if the frame size is 10ms, these streams will have a delay of 20ms. This means that these streams will be active after every two iterations, and when active, will receive data for three iterations (30ms). As a result, when data from these streams arrive, NvAFX_Run should be called three times, twice with the delayed data and once with the current data.

always_active_streams

These streams have no delay and are always active, with one NvAFX_Run call per iteration.

NvAFX_Run() calls are made based on the description above to generate processed audio output. The configuration files provide a parameter to specify one_step_delay_streams and two_step_delay_streams. (For more information, refer to Run the Application.) These values and the batch size are used to infer the list of always_active_streams.

Build the Application#

  1. Navigate to the samples/effects_delayed_streams_demo directory.

  2. To compile the application, run the following command:

    :/Audio Effects SDK/samples/effects_delayed_streams_demo$ ./build.sh
    

Run the Application#

You can run the sample application by using the run_effect.sh helper script or directly by using the effects_delayed_streams_demo executable located in builds.

Use the Helper Script to Run the Sample Application#

The run_effect.sh helper script is a wrapper around the effects_delayed_streams_demo application and runs like the helper script for effects_demo <use-helper-script-to-run-effects-demo-application>.

This script supports ten streams that are always pre-configured into active streams, streams with a one-step delay, and streams with a two-step delay. In addition to the parameters available in run_effects.sh that were specified, this script also supports the -t/--all_streams_active parameter, which specifies that all ten streams are always active. If this parameter is not specified, several streams are configured with a one-step or two-step delay.

For example, to run the sample application on T4 with the 16k denoiser effect, a batch size of 10, and with all streams active, run the following command:

./run_effect.sh -g t4 -s 16 -b 10 -e denoiser -a

Run the Sample Application Directly#

To directly run the sample application after it is built, run the following command:

build/effects_delayed_streams_demo -c <config-file>

<config-file> specifies the path of the config file, such as t4_denoise48k_10_cfg.txt.

For example:

build/effects_delayed_streams_demo -c t4_denoise48k_10_cfg.txt

Sample config files are provided with the application.

Like effects_demo, the configuration files contain pairs of parameters and their values, with one pair per line. In addition to the configuration parameters used by effects_demo, effects_delayed_streams_demo requires the following parameters:

  • one_step_delay_streams <list-of-stream-id>

    Specifies the stream identifiers that belong to the one_step_delay_streams category as mentioned in the previous section. If none of the streams are in this category, this value should be set to none.

  • two_step_delay_streams <list-of-stream-id>

    Specifies the stream identifiers that belong to the two_step_delay_streams category as mentioned in the previous section. If none of the streams are in this category, this value should be set to none.

Chain Multiple Effects#

This sample application also supports chaining multiple effects. (For more information, refer to Create a Chained Audio Effect.)

To run the application in chaining mode, use run_effect_chained.sh:

./run_effect_chained.sh -g <gpu> -e1 <effect1> -s1 <input_sample_rate_1> -o1 <output_sample_rate_1> -e2 <effect2> -s2 <input_sample_rate_2> -o2 <output_sample_rate_2> [-c <path_to_save_config_file>]

This script generates a config file at /tmp/tmp_cfg.txt and runs the effects_delayed_streams_demo sample with this config.

The configuration used for this script is the same as the configuration used for effects_demo. (For more information, refer to Chaining Effects.) The script also uses the same parameters that are used by effects_delayed_streams_demo. (For more information, refer to Run the Application.)