Why is ulaw_8000 format not supported for ElevenLabsTTSService
Problem Statement
Currently the tts.py in ElevenLabs supports only below formats
ElevenLabsOutputFormat = Literal["pcm_16000", "pcm_22050", "pcm_24000", "pcm_44100"]
Whereas ElevenLabs supports mp3_22050_32 mp3_44100_32 mp3_44100_64 mp3_44100_96 mp3_44100_128 mp3_44100_192 pcm_8000 pcm_16000 pcm_22050 pcm_24000 pcm_44100 ulaw_8000 alaw_8000 opus_48000_32 opus_48000_64 opus_48000_96 opus_48000_128 opus_48000_192
Can we support all formats? At the very least ulaw_8000 because it is popular with dialers (VoIP)
Proposed Solution
Add support for ulaw_8000
Alternative Solutions
No response
Additional Context
No response
Would you be willing to help implement this feature?
- [x] Yes, I'd like to contribute
- [ ] No, I'm just suggesting
Hi,
You are correct, ulaw_8000 is popular with VoIP and telephone providers. We actually currently do support outputting to as ulaw_8000. We keep ElevenLabs output as PCM and then we only convert it to ulaw inside the transport module when needed (right before it is sent to the phone provider). For example you can take a look at line 69 here: https://github.com/pipecat-ai/pipecat/blob/main/src/pipecat/serializers/telnyx.py
There are functions called ulaw_to_pcm and pcm_to_ulaw which facilitate the conversion.