We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Codes:
const sdk = require("microsoft-cognitiveservices-speech-sdk"); const speechConfig = sdk.SpeechConfig.fromSubscription("YourSubscriptionKey", "YourServiceRegion"); speechConfig.enableAudioLogging(); var audioFile = "YourAudioFile.wav"; const audioConfig = sdk.AudioConfig.fromAudioFileOutput(audioFile); const synthesizer = new sdk.SpeechSynthesizer(speechConfig, audioConfig); const ssml = ` <speak version='1.0' xml:lang='en-US' xmlns='http://www.w3.org/2001/10/synthesis' xmlns:mstts='http://www.w3.org/2001/mstts'> <voice name='en-US-AvaMultilingualNeural'> The rainbow has seven colors </voice> <voice name='en-US-JennyNeural'> What's the weather like? </voice> </speak> `; synthesizer.wordBoundary = (s, e) => { // Word, Punctuation, or Sentence var str = `WordBoundary event: \ \r\n\tBoundaryType: ${e.boundaryType} \ \r\n\tAudioOffset: ${(e.audioOffset + 5000) / 10000}ms \ \r\n\tDuration: ${e.duration} \ \r\n\tText: \"${e.text}\" \ \r\n\tTextOffset: ${e.textOffset} \ \r\n\tWordLength: ${e.wordLength}`; console.log(str); }; synthesizer.speakSsmlAsync(ssml, result => { if (result.reason === sdk.ResultReason.SynthesizingAudioCompleted) { console.log("Speech synthesis succeeded."); } else { console.error("Speech synthesis failed:", result.errorDetails); } synthesizer.close(); }, error => { console.error("Speech synthesis error:", error); } );
Results:
WordBoundary event: BoundaryType: SentenceBoundary AudioOffset: 50.5ms Duration: 23750000 Text: "The rainbow has seven colors" TextOffset: 192 WordLength: 28 WordBoundary event: BoundaryType: SentenceBoundary AudioOffset: 2475.5ms Duration: 19750000 Text: "What's the weather like?" TextOffset: 291 WordLength: 24
How do I get the speaker names of en-US-AvaMultilingualNeural and en-US-JennyNeural from event wordBoundary? Such as:
synthesizer.wordBoundary = (s, e) => { console.log('Speaker Name:', e.speakerName); };
Or add a new event:
synthesizer.tagReached = (s, e) => { console.log('Tag Name:', e.tag); // voice console.log('Speaker Name:', e.speakerName); // en-US-AvaMultilingualNeural or en-US };
1.36.0 (Latest)
No response
The text was updated successfully, but these errors were encountered:
yulin-li
No branches or pull requests
What happened?
Codes:
Results:
How do I get the speaker names of en-US-AvaMultilingualNeural and en-US-JennyNeural from event wordBoundary?
Such as:
Or add a new event:
Version
1.36.0 (Latest)
What browser/platform are you seeing the problem on?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: