question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sample bookmark listener from tts Azure documentation not working

See original GitHub issue

Hi,

In a java application, I try to use bookmarks for evaluating audio offsets in a text-to-speech conversion and even the sample code from the tts documentation is giving false results.

Any idea on what is the problem in my coding or a limitation that applies ?

Here is the code :

    private void test() {
    String speechSubscriptionKey = "38blabla";
    String serviceRegion = "westeurope";
    config = SpeechConfig.fromSubscription(speechSubscriptionKey, serviceRegion);
    assert (config != null);
    config.setSpeechSynthesisOutputFormat(SpeechSynthesisOutputFormat.Audio24Khz96KBitRateMonoMp3);

    String ssml = "<speak version=\"1.0\" xmlns=\"http://www.w3.org/2001/10/synthesis\" xml:lang=\"en-US\">\r\n"
            + "    <voice name=\"en-US-AriaNeural\">\r\n"
            + "        We are selling <bookmark mark='flower_1'/>roses and <bookmark mark='flower_2'/>daisies.\r\n"
            + "    </voice>\r\n" + "</speak>\r\n" + "";
    assert (ssml != null);

    SpeechSynthesizer synth;
    synth = new SpeechSynthesizer(config, null);
    assert (synth != null);
    synth.BookmarkReached.addEventListener((o, e) -> {
        // The unit of e.AudioOffset is tick (1 tick = 100 nanoseconds), divide by
        // 10,000 to convert to milliseconds.

        System.out.println(
                "Bookmark " + e.getText() + " reached. Audio offset: " + e.getAudioOffset() / 10000 + "ms.");
    });

    // creates voice
    SpeechSynthesisResult result = synth.SpeakSsml(ssml);
    assert (result != null);

And here is the result :

Bookmark flower_1 reached. Audio offset: 50ms.
Bookmark flower_2 reached. Audio offset: 50ms.

Which is not the expected result.

My configuration for this test : Windows 10 with java jdk 1.8.0_301.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
yulin-licommented, Oct 27, 2021

Just synced with service guy, the ETA to fix this issue is end of Nov. Thanks!

1reaction
brianarch82commented, Sep 17, 2021

I am also experiencing this bug from .NET.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Text to speech SSML bookmark tags Error
The bookmark element is incompatible with the prosody and break elements. You can't adjust pause and prosody like pitch, contour, rate, ...
Read more >
How to synthesize speech from text - Azure
See the text to speech overview for more information about: ... To trigger a bookmark reached event, a bookmark element is required in...
Read more >
What's new in Azure AI Speech?
Fix authentication token not working when getting speech synthesis voice ... Added VisemeReceived event for TTS/speech synthesis to return ...
Read more >
TTS Rest Endpoint for SSML bookmark tag - Microsoft Q&A
I read that Microsoft evaluates the bookmark element within SSML text. According to the documentation, this can be subscribed to with one of ......
Read more >
Speech Synthesis Markup Language (SSML) overview
You can wrap text with event tags such as bookmark or viseme that can be processed ... Although the SSML document itself is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found