What I’m trying to is :
Azure SST -> Azure TTS -> Sending audio through a virtual cable for Discord
I have the virtual cable installed and everything, but I’m clueless about how to send correctly the audio through the virtual cable.
I’ve tried to change the audio default output in Windows, and it worked but this solution is kinda messy since many software and video games will go through the virtual cable.
speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config="I don't know what to put here")
I would guess that I can change the audio output device in audio_config, but I don’t know what it accepts. The documentation mentions that it’s for changing the audio output device, but no information on what exactly it wants.
import os
from dotenv import load_dotenv
import azure.cognitiveservices.speech as speechsdk
load_dotenv
while 0==0:
def recognize_from_microphone():
speech_config = speechsdk.SpeechConfig(subscription=os.getenv('SPEECH_KEY'), region=os.getenv('SPEECH_REGION'))
speech_config.speech_recognition_language="en-US"
speech_config.speech_synthesis_voice_name = "en-US-JaneNeural"
audio_config = speechsdk.audio.AudioConfig(use_default_microphone=True)
speech_recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config, audio_config=audio_config)
print("Speak into your microphone.")
speech_recognition_result = speech_recognizer.recognize_once_async().get()
tts(str(speech_recognition_result.text))
def tts(text):
speech_config = speechsdk.SpeechConfig(subscription=os.getenv('SPEECH_KEY'), region=os.getenv('SPEECH_REGION'))
speech_config.speech_synthesis_voice_name = "en-US-JaneNeural"
speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config="I don't know what to put here")
speech_synthesizer.speak_text_async(text).get()
recognize_from_microphone()
Sorry for the messy loop, I will try something more clean later
Thanks for helping!