-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to stop the Text-To-Speech Azure SDK #2647
Comments
Hey, @Roopesh-Bharatwaj-K-R . Hope this helps I have used the microsoft-cognitiveservices-speech-sdk for viseme so I have used ref in ReactJS for the synthesizer. import * as sdk from "microsoft-cognitiveservices-speech-sdk" const synthesizeSpeech = text => { And to stop the speech, I did this This helped in stopping the speech as well as resetting the synthesis, so if you play it again, the audio starts too. |
Hi @aman-vohra-007 Thanks a lot for taking the time to respond to me on this issue, I will check on this code and will try it. Also could you please share the documentation for the same, it will be useful for me to have a readout and recording purpose for other readers facing the same issue. |
Hey, @Roopesh-Bharatwaj-K-R , Their Doc: https://learn.microsoft.com/en-gb/azure/ai-services/speech-service/speech-synthesis-markup-voice Hence, when I was working on my code I knew that the speech was made by ssml in my case And there was no such function as StopSpeakingAsync() as well as even if it worked, It kept going on until the end of the sentence. So I consoled my ref of the synthesizer and found out the audio made at this spot So, I used it to stop the audio instantly, reset the audio, and also close the speechSynthesizerRef. I didn't find any form of documentation for this and was stuck for days but when I solved it, I thought of sharing the solution for others who are stuck doing the same thing. Hope this helps. Thank you, |
Thanks a lot for sharing your code and docs, I also used a similar approach by calling private property audio Object. ` const audio = synthesizer.privAdapter?.privSessionAudioDestination?.privDestination?.privAudio; One disadvantage of both the suggested approaches; is whenever they update the SDK we may not be able to do the same. Best, |
Thanks for sharing the code, the pause doesn't work for me, it never pauses the audio. It goes on until the playback is complete. When you start speaking while the playback is happening, it starts playing out the new speech. when the code detects user speaking, i try to stop the playback...
|
Hi Azure,
I have created a React app that utilises the Azure Speech (TTS) solution and, it's working fine.
I have used the Javascript and followed the JS Speech Synthesis documentation from Azure:
[https://learn.microsoft.com/en-us/azure/ai-services/speech-service/how-to-speech-synthesis?pivots=programming-language-javascript&tabs=browserjs%2Cterminal#synthesize-speech-to-a-file]
But the issue popped when we try to stop the speaking, we could not stop the speech from the azure, and when i checked the code, there was no methods which calls direct stop, instead i could see, Close(), Cancel().
Which was not working fine and i did check the couple of issues related to the same. [SpeechSynthesizer.StopSpeakingAsync()] which was also not working fine.
SpeechSynthesizer.StopSpeakingAsync()
and thenStartSpeakingTextAsync()
does not work immediately #2367SpeechSynthesizer.StopSpeakingAsync()
does not stop synthesis #2350I tried other approaches to do refreshing of the audio, and synthesis to Null. But it was not working fine
kindly suggest to me the best way how stop the audio from the azure TTS. Kindly share some of the Notebooks and code examples to resolve the stopping effectively.
Thanks in Advance for your kind suggestions.
Best,
Roopesh
The text was updated successfully, but these errors were encountered: