Skip to content
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

speakTextAsync SynthesizingAudioCompleted indicator is raised in beginning of audio instead of end #656

Open
uri3000 opened this issue Mar 29, 2023 · 6 comments
Assignees

Comments

@uri3000
Copy link

uri3000 commented Mar 29, 2023

You can run this code and see how it happens:

const speak = async (text, onEnd, pitch = 1, rate = 0.35) => {
const tokenObj = await getTokenOrRefresh();
const speechConfig = speechsdk.SpeechConfig.fromAuthorizationToken(tokenObj.authToken, tokenObj.region);
speechConfig.speechSynthesisVoiceName = 'es-AR-ElenaNeural';
const audioConfig = speechsdk.AudioConfig.fromDefaultSpeakerOutput();
const synthesizer = new speechsdk.SpeechSynthesizer(speechConfig, audioConfig);

    synthesizer.speakTextAsync(text, result => {
        if (result.reason === ResultReason.SynthesizingAudioCompleted) {
          await onEnd(); // This runs in the start of the audio playback instead of in the end.
      
        } else {
            console.error('Speech was cancelled or could not be recognized. Ensure your microphone is working properly.');
        }
    });

}

@glharper
Copy link
Member

@yulin-li FYI

@frandlee
Copy link

frandlee commented Apr 3, 2023

I tried to change the call back to await but it doesn't work. Any idea? thanks.
await synthesizer.speakTextAsync

@yulin-li
Copy link
Contributor

SynthesizingAudioCompleted means the service synthesized all audio and the client finished to receive them, instead of audio playing completed. You can refer to onAudioEnd

@frandlee
Copy link

SynthesizingAudioCompleted means the service synthesized all audio and the client finished to receive them, instead of audio playing completed. You can refer to onAudioEnd

Hi, I am trying to download the file instead of playing it online.
Synthesizer.speakTextAsync is an async api but it doesn't works is the line below.
await synthesizer.speakTextAsync(text)

Many thanks.

@jackiealex
Copy link

SynthesizingAudioCompleted means the service synthesized all audio and the client finished to receive them, instead of audio playing completed. You can refer to onAudioEnd

Hi, I am trying to download the file instead of playing it online. Synthesizer.speakTextAsync is an async api but it doesn't works is the line below. await synthesizer.speakTextAsync(text)

Many thanks.

That does not work, see issue: #699 (comment)

@jackiealex
Copy link

SynthesizingAudioCompleted means the service synthesized all audio and the client finished to receive them, instead of audio playing completed. You can refer to onAudioEnd

That does not work, see issue: #699 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants