From 48603de0a3dca99029ec72451c19d5b52df592f0 Mon Sep 17 00:00:00 2001 From: Ajay Raj Date: Sun, 5 Mar 2023 14:01:15 -0800 Subject: [PATCH] add azure configs --- vocode/models/synthesizer.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/vocode/models/synthesizer.py b/vocode/models/synthesizer.py index f796e60..d92ac0d 100644 --- a/vocode/models/synthesizer.py +++ b/vocode/models/synthesizer.py @@ -1,4 +1,5 @@ from enum import Enum +from typing import Optional from .model import TypedModel from .audio_encoding import AudioEncoding from ..output_device.base_output_device import BaseOutputDevice @@ -18,10 +19,26 @@ class SynthesizerConfig(TypedModel, type=SynthesizerType.BASE): return cls(sampling_rate=output_device.sampling_rate, audio_encoding=output_device.audio_encoding) class AzureSynthesizerConfig(SynthesizerConfig, type=SynthesizerType.AZURE): + voice_name: Optional[str] = None + pitch: Optional[int] = None + rate: Optional[int] = None + + @classmethod + def from_output_device( + cls, + output_device: BaseOutputDevice, + voice_name: Optional[str] = None, + pitch: Optional[int] = None, + rate: Optional[int] = None, + ): + return cls( + sampling_rate=output_device.sampling_rate, + audio_encoding=output_device.audio_encoding, + voice_name=voice_name, + pitch=pitch, + rate=rate, + ) pass class GoogleSynthesizerConfig(SynthesizerConfig, type=SynthesizerType.GOOGLE): pass - -class ElevenLabsSynthesizerConfig(SynthesizerConfig, type=SynthesizerType.ELEVEN_LABS): - pass