Vinoth
Vinoth

Reputation: 47

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

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.

Upvotes: 0

Views: 735

Answers (1)

Ecstasy
Ecstasy

Reputation: 1864

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 ?

JavaScript: Added volume getter/setter and mute()/unmute() APIs to SpeakerAudioDestination

 public get volume(): number {
        return this.privAudio.volume;
    }

    public set volume(volume: number) {
        this.privAudio.volume = volume;
    }

    public mute(): void {
        this.privAudio.muted = true;
    }

    public unmute(): void {
        this.privAudio.muted = false;
    }

Reference: Speech SDK 1.20.0: January 2022 release

Upvotes: 0

Related Questions