utils

DTMF audio utilities.

This module provides functionality to load DTMF (Dual-Tone Multi-Frequency) audio files corresponding to phone keypad entries. Audio data is cached in-memory after first load to improve performance on subsequent accesses.

async pipecat.audio.dtmf.utils.load_dtmf_audio(button: KeypadEntry, *, sample_rate: int = 8000) bytes[source]

Load audio for DTMF tones associated with the given button.

Parameters:
  • button (KeypadEntry) – The button for which the DTMF audio is to be loaded.

  • sample_rate (int, optional) – The sample rate for the audio. Defaults to 8000.

Returns:

The audio data for the DTMF tone as bytes.

Return type:

bytes