Skip to content

Commit

Permalink
Adding mulaw streaming support to ElevenLabs
Browse files Browse the repository at this point in the history
  • Loading branch information
skirdey committed Dec 1, 2023
1 parent 6ac6da8 commit 3061cfd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions playground/streaming/synthesizer/synthesize.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ async def main():
synthesizer = ElevenLabsSynthesizer(
synthesizer_config=ElevenLabsSynthesizerConfig(
experimental_streaming=False,
stability=0.0,
similarity_boost=0.0,
model_id="nova",
optimize_streaming_latency=0,
sampling_rate=8000,
audio_encoding=AudioEncoding.MULAW,
Expand Down
6 changes: 4 additions & 2 deletions vocode/streaming/synthesizer/eleven_labs_synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ async def create_speech(

base_url = urljoin(ELEVEN_LABS_BASE_URL, f"text-to-speech/{self.voice_id}")

print(base_url)

if self.experimental_streaming:
base_url = urljoin(base_url + "/", "stream")

Expand Down Expand Up @@ -195,6 +193,10 @@ async def create_speech(
message, seconds, self.words_per_minute
),
)
else:
raise RuntimeError(
f"Unsupported ElevenLabs configuration: {self.synthesizer_config.sampling_rate}, {self.synthesizer_config.audio_encoding}, {self.output_format}"
)

def _get_eleven_labs_format(self):
sampling_rate = self.synthesizer_config.sampling_rate
Expand Down

0 comments on commit 3061cfd

Please sign in to comment.