microsoft / microsoft/cognitive-services-speech-sdk-js
speakTextAsync SynthesizingAudioCompleted indicator is raised in beginning of audio instead of end
- Dominant language
- TypeScript
- Stars
- 325
- Forks
- 118
- PR merge metrics
- No merged PRs in 30d
Description
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.');
}
});
}
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.