File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929
3030# Azure Parameters
3131AZURE_SPEECH_VOICE = "en-GB-OliverNeural"
32+ DEVICE_ID = None
3233
3334# Speech Recognition Parameters
3435ENERGY_THRESHOLD = 1000 # Energy level for mic to detect
@@ -157,10 +158,14 @@ def __init__(self, azure_speech_config):
157158 self .do_mouth_movement = False
158159 self ._mouth_thread = threading .Thread (target = self .move_mouth , daemon = True )
159160 self ._mouth_thread .start ()
160-
161+ if DEVICE_ID is None :
162+ audio_config = speechsdk .audio .AudioOutputConfig (use_default_speaker = True )
163+ else :
164+ audio_config = speechsdk .audio .AudioOutputConfig (device_name = DEVICE_ID )
161165 self ._speech_synthesizer = speechsdk .SpeechSynthesizer (
162- speech_config = azure_speech_config
166+ speech_config = azure_speech_config , audio_config = audio_config
163167 )
168+
164169 self ._speech_synthesizer .synthesizing .connect (self .start_moving_mouth )
165170 self ._speech_synthesizer .synthesis_completed .connect (self .stop_moving_mouth )
166171
You can’t perform that action at this time.
0 commit comments