Azure-Samples / cognitive-services-speech-sdk

Sample code for the Microsoft Cognitive Services Speech SDK
MIT License
2.79k stars 1.82k forks source link

Can we edit the text then translate and speak it #2396

Closed Tommy95271 closed 3 weeks ago

Tommy95271 commented 3 months ago

Is your feature request related to a problem? Please describe. When users speak and call recognizeOnceAsync() in JavaScript, the translation result will output from browser, but sometimes user might want to edit the text they spoked and play the audio again.

Describe the solution you'd like Wondering if we can edit the source text in UI and call another function to play the translated audio without speaking again?

github-actions[bot] commented 2 months ago

This item has been open without activity for 19 days. Provide a comment on status and remove "update needed" label.

pankopon commented 3 weeks ago

Hi, translation generates the following results:

See the single-shot translation example, e.result.text contains the recognized speech as text in the source language, e.result.translations contains the translated speech as text.

Considering

sometimes user might want to edit the text they spoked and play the audio again

Editing the result text will not affect the result audio already produced. Either you need to run translation with new spoken input from the user, or you can use the edited text as input for standalone speech synthesis.