Skip to content

fix(speechmatics): resample audio to the 16 kHz Agent STT accepts - #5719

Open
omChauhanDev wants to merge 1 commit into
pipecat-ai:mainfrom
omChauhanDev:fix/speechmatics-agent-stt-sample-rate
Open

fix(speechmatics): resample audio to the 16 kHz Agent STT accepts#5719
omChauhanDev wants to merge 1 commit into
pipecat-ai:mainfrom
omChauhanDev:fix/speechmatics-agent-stt-sample-rate

Conversation

@omChauhanDev

Copy link
Copy Markdown
Contributor

Fixes #5717

Problem

Since 1.10.0 SpeechmaticsSTTService targets Agent STT (/v2/agent), which accepts 16 kHz only. The service still declared the pipeline's input rate in audio_format, so any pipeline not running at 16 kHz opens a session the server rejects with audio_format.sample_rate does not match: 16000. That includes the 8 kHz telephony setup pipecat init generates. The rejection is permanent, so the service is left unusable, and a Speechmatics instance sitting behind a ServiceSwitcher as a backup dies at pipeline start before it is ever selected.

Passing sample_rate=16000 to the service did not help: it changed the declared rate without converting the audio, so 8 kHz PCM went out labelled as 16 kHz.

Changes

run_stt now resamples audio to 16 kHz before sending it, and audio_format declares that fixed rate instead of the pipeline's, so the declared rate and the bytes cannot disagree. The conversion reads the rate recorded in setup(), which means a sample_rate override cannot declare a rate the audio does not have. Pipelines already running at 16 kHz are unaffected.

@omChauhanDev
omChauhanDev force-pushed the fix/speechmatics-agent-stt-sample-rate branch from dbeb0fe to 4760430 Compare September 12, 2026 13:21
@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pipecat/services/speechmatics/stt.py 85.71% 2 Missing ⚠️
Files with missing lines Coverage Δ
src/pipecat/services/speechmatics/stt.py 73.39% <85.71%> (+2.16%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Speechmatics Agent STT in 1.10.0 inherits unsupported 8 kHz input; sample_rate=16000 relabels PCM without resampling

1 participant