Merge pull request #1423 from pipecat-ai/aleix/elevenlabs-pcm-8000

ElevenLabs: add support for a sample rate of 8000
This commit is contained in:
Aleix Conchillo Flaqué
2025-03-20 19:34:16 -07:00
committed by GitHub
4 changed files with 12 additions and 12 deletions

View File

@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Added
- ElevenLabs TTS services now support a sample rate of 8000.
### Fixed ### Fixed
- Fixed an issue in `UltravoxSTTService` that caused improper audio processing - Fixed an issue in `UltravoxSTTService` that caused improper audio processing

View File

@@ -3,10 +3,10 @@ coverage~=7.6.12
grpcio-tools~=1.67.1 grpcio-tools~=1.67.1
pip-tools~=7.4.1 pip-tools~=7.4.1
pre-commit~=4.0.1 pre-commit~=4.0.1
pyright~=1.1.394 pyright~=1.1.397
pytest~=8.3.4 pytest~=8.3.4
pytest-asyncio~=0.25.3 pytest-asyncio~=0.25.3
ruff~=0.9.7 ruff~=0.11.1
setuptools~=70.0.0 setuptools~=70.0.0
setuptools_scm~=8.1.0 setuptools_scm~=8.1.0
python-dotenv~=1.0.1 python-dotenv~=1.0.1

View File

@@ -102,6 +102,8 @@ def language_to_elevenlabs_language(language: Language) -> Optional[str]:
def output_format_from_sample_rate(sample_rate: int) -> str: def output_format_from_sample_rate(sample_rate: int) -> str:
match sample_rate: match sample_rate:
case 8000:
return "pcm_8000"
case 16000: case 16000:
return "pcm_16000" return "pcm_16000"
case 22050: case 22050:
@@ -113,7 +115,7 @@ def output_format_from_sample_rate(sample_rate: int) -> str:
logger.warning( logger.warning(
f"ElevenLabsTTSService: No output format available for {sample_rate} sample rate" f"ElevenLabsTTSService: No output format available for {sample_rate} sample rate"
) )
return "pcm_16000" return "pcm_24000"
def build_elevenlabs_voice_settings( def build_elevenlabs_voice_settings(

View File

@@ -17,25 +17,19 @@ from loguru import logger
from pipecat.frames.frames import ( from pipecat.frames.frames import (
AudioRawFrame, AudioRawFrame,
LLMFullResponseEndFrame,
LLMFullResponseStartFrame,
LLMTextFrame,
TranscriptionFrame,
TextFrame,
StartFrame,
EndFrame,
CancelFrame, CancelFrame,
EndFrame, EndFrame,
ErrorFrame, ErrorFrame,
Frame, Frame,
LLMFullResponseEndFrame,
LLMFullResponseStartFrame,
LLMTextFrame,
StartFrame, StartFrame,
TranscriptionFrame,
UserStartedSpeakingFrame, UserStartedSpeakingFrame,
UserStoppedSpeakingFrame, UserStoppedSpeakingFrame,
) )
from pipecat.processors.frame_processor import FrameDirection from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.ai_services import AIService from pipecat.services.ai_services import AIService
from pipecat.utils.time import time_now_iso8601
try: try:
from transformers import AutoTokenizer from transformers import AutoTokenizer