JS Azure Speech SDK 文本转语音(AudioConfig 控制音量)

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

我正在使用 Azure 文本转语音服务来启用基于语音的输出。使用 Speech SDK Javascript.

为了输出声音,我正在使用自定义 iPlayer 创建 fromSpeakerOutput 实例(如 docs)。

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

问题是,我需要一些 iPlayer 自定义设置,例如暂停、恢复、停止当前声音。我只能看到暂停和恢复。有什么办法可以取消当前播放的声音吗?

谢谢。

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:向 SpeakerAudioDestination

添加了音量 getter/setter 和 mute()/unmute() API
 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;
    }

参考:Speech SDK 1.20.0: January 2022 release