Skip to main content

Overview

The PipelineParams class provides a structured way to configure various aspects of pipeline execution. These parameters control behaviors like audio settings, metrics collection, heartbeat monitoring, and interruption handling.

Basic Usage

Available Parameters

int
default:"16000"
Input audio sample rate in Hz.
Setting the audio_in_sample_rate as a PipelineParam sets the input sample rate for all corresponding services in the pipeline.
int
default:"24000"
Output audio sample rate in Hz.
Setting the audio_out_sample_rate as a PipelineParam sets the output sample rate for all corresponding services in the pipeline.
bool
default:"False"
Whether to enable heartbeat monitoring to detect pipeline stalls. See Heartbeats for details.
float
default:"1.0"
Period between heartbeats in seconds (when heartbeats are enabled).
float
default:"10.0"
Timeout in seconds before warning about missed heartbeats and firing on_heartbeat_timeout.
bool
default:"False"
Whether to enable metrics collection for pipeline performance.
bool
default:"False"
Whether to enable usage metrics tracking.
bool
default:"False"
Whether to report only initial time to first byte metric.
bool
default:"True"
Whether to send initial empty metrics frame at pipeline start. Only applies when enable_metrics is True.
Dict[str, Any]
default:"{}"
Additional metadata to include in the StartFrame.

Common Configurations

Audio Processing Configuration

You can set the audio input and output sample rates in the PipelineParams to set the sample rate for all input and output services in the pipeline. This acts as a convenience to avoid setting the sample rate for each service individually. Note, if services are set individually, they will supersede the values set in PipelineParams.

Performance Monitoring Configuration

Pipeline heartbeats provide a way to monitor the health of your pipeline by sending periodic heartbeat frames through the system. When enabled, the pipeline will send heartbeat frames every heartbeats_period_secs and monitor their progress through the pipeline.

How Parameters Are Used

The parameters you set in PipelineParams are passed to various components of the pipeline:
  1. Processor setup: Many parameters reach processors through the FrameProcessorSetup passed to setup()
  2. Metrics Collection: Metrics settings configure what performance data is gathered
  3. Heartbeat Monitoring: Controls the pipeline’s health monitoring system
  4. Audio Processing: Sample rates affect how audio is processed throughout the pipeline

Complete Example

Additional Information

  • Set parameters before the worker starts: most are read only at startup
  • For metrics collection to work properly, enable_metrics must be set to True