JS Azure Speech SDK Text to Speech (control volume for AudioConfig)

L, Vinod Kumar 21 Reputation points
2022-01-05T10:52:24.057+00:00

Hi Team,

I'm working with azure text to speech service for enabling voice based outputs. Using Speech SDK Javascript.

For outputing the sound, im creating fromSpeakerOutput instance with custom iPlayer (as in docs).

   const browserSound = new speechsdk.SpeakerAudioDestination();  
   const audioConfig = speechsdk.AudioConfig.fromSpeakerOutput(browserSound);  
   var synthesizer = new speechsdk.SpeechSynthesizer(speechConfig, audioConfig);  

Issue is, i need some iPlayer customizations like pause, resume, stop current sound. I could see only pause and resume. Is there any way i could cancel current playing sound ?

Thanks.

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
2,061 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. GiftA-MSFT 11,176 Reputation points
    2022-01-06T15:23:01.097+00:00

    Hi, the only reference I've seen so far is pause and resume. I don't think this scenario is supported currently. However, I'm making some inquiries and will share updates as soon as I have more information.

    1 person found this answer helpful.
    0 comments No comments

  2. Wenqian Xu (Shanghai Wicresoft Co Ltd) 0 Reputation points Microsoft External Staff
    2024-08-20T07:08:10.8633333+00:00

    Stopping audio playing is supported.

    You need to create a SpeechSDK.SpeakerAudioDestination() object and use it to create audioConfig like this.

    var
    

    Then you can call player.pause() and player.resume() to pause and resume the playback.

    You can find more info from the doc and sample.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.