I am synthesising text using Azure Speech Service's TTS. When setting the audio config, I want to disable the playback of the audio. Per the documentation, AudioOutputConfig
's use_default_speaker
keyword is False by default. Hence, the following code should work:
import azure.cognitiveservices.speech as speechsdk
speech_config = speechsdk.SpeechConfig(
subscription=os.environ.get('SPEECH_KEY'),
region=os.environ.get('SPEECH_REGION')
)
audio_config = speechsdk.audio.AudioOutputConfig()
but I get the following error:
ValueError: default speaker needs to be explicitly activated
The same goes if I set use_default_speaker=True
.
The only way I can get the code to run is if I explicitly set use_default_speaker=False
, but this way the audio is spoken to the computer's speakers, which is annoying and time consuming when generating multiple samples.
I also tried experimenting with the stream
keyword, but I can't figure out what to set it to.
I don't want to write the data to a wav file using the filename
kw.
Does anyone know how I can turn off the behaviour of playing back the audio?