From a76f1f331ca822f8739428e23366ad746c9164ac Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Wed, 18 Mar 2026 16:24:31 -0400 Subject: [PATCH] Add sample rate support for 22050, 44100, 48000 Hz for GradiumSTTService --- changelog/4066.changed.2.md | 2 +- src/pipecat/services/gradium/stt.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/changelog/4066.changed.2.md b/changelog/4066.changed.2.md index 751961f10..7795ba62c 100644 --- a/changelog/4066.changed.2.md +++ b/changelog/4066.changed.2.md @@ -1 +1 @@ -- `GradiumSTTService` now takes both an `encoding` and `sample_rate` constructor argument which is assmebled in the class to form the `input_format`. PCM accepts `8000`, `16000`, and `24000` Hz sample rates. +- `GradiumSTTService` now takes both an `encoding` and `sample_rate` constructor argument which is assmebled in the class to form the `input_format`. PCM accepts `8000`, `16000`, `22050`, `24000`, `44100`, and `48000` Hz sample rates. diff --git a/src/pipecat/services/gradium/stt.py b/src/pipecat/services/gradium/stt.py index 5dea2c824..244a001ad 100644 --- a/src/pipecat/services/gradium/stt.py +++ b/src/pipecat/services/gradium/stt.py @@ -69,8 +69,14 @@ def _input_format_from_encoding(encoding: str, sample_rate: int) -> str: return "pcm_8000" case 16000: return "pcm_16000" + case 22050: + return "pcm_22050" case 24000: return "pcm_24000" + case 44100: + return "pcm_44100" + case 48000: + return "pcm_48000" logger.warning( f"GradiumSTTService: unsupported sample rate {sample_rate} for PCM encoding, using pcm_16000" )