Partager via


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

Use Bookmarks (Microsoft.Speech)

By inserting a bookmark into a prompt, you can identify a particular moment of time with a specific position in the prompt. One use for bookmarks is to permit an application to track the time between when a prompt was played and when a customer service representative responded to a customer’s call.

To insert a bookmark into a PromptBuilder prompt, call AppendBookmark(String), providing the name of the bookmark.

PromptBuilder pb = new PromptBuilder();
pb.AppendText("A customer service representative will be with you shortly.");
pb.AppendBookmark("Bookmark1");
synth.Speak(pb); 

To insert a bookmark using markup that conforms to the Speech Synthesis Markup Language (SSML) Version 1.0, call AppendSsmlMarkup(String) and insert a mark element, as shown in the following example:

PromptBuilder pb = new PromptBuilder();
builder.AppendSsmlMarkup("A customer service representative will be with you shortly. <mark name=\"Bookmark1\" /> ");
synth.Speak(pb);