Enable read-aloud for your application with Azure neural TTS

Published 04-28-2021 05:02 AM 1,197 Views
Microsoft

This post is co-authored with Yulin Li, Yinhe Wei, Qinying Liao, Yueying Liu, Sheng Zhao

 

Voice is becoming increasingly popular in providing useful and engaging experiences for customers and employees. The Text-to-Speech (TTS) capability of Speech on Azure Cognitive Services allows you to quickly create intelligent read-aloud experience for your scenarios.

 

In this blog, we’ll walk through an exercise which you can complete in under two hours, to get started using Azure neural TTS voices and enable your apps to read content aloud. We’ll provide high level guidance and sample code to get you started, and we encourage you to play around with the code and get creative with your solution!

 

What is read-aloud   

 

Read-aloud is a modern way to help people to read and consume content like emails and word documents more easily. It is a popular feature in many Microsoft products, which has received highly positive user feedback. A few latest examples:

  • Play My Emails: In outlook iOS, users can listen to their incoming email during the commute to the office. They can choose from a female and a male voice to read the email aloud, anytime their hands may be busy doing other things.
  • Edge read aloud: In recent chromium-based edge browser, people can listen to the web pages or pdf documents when they are doing multi-tasking. The read-aloud voice quality has been enhanced with Azure neural TTS, which becomes the ‘favorite’ feature to many (Read the full article).
  • Immersive reader is a free tool that uses proven techniques to improve reading for people regardless of their age or ability. It has adopted Azure neural voices to read aloud content to students. 
  • Listen to Word documents on mobile. This is an eyes-off, potentially hands-off modern consumption experience for those who want to do multitask on the go. In specific, this feature supports a longer listening scenario for document consumption, now available with Word on Android and iOS.

With all these examples and more, we’ve seen clear trending of providing voice experiences for users consuming content on the go, when multi-tasking, or for those who tend to read in an audible way. With Azure neural TTS, it is easy to implement your own read-aloud that is pleasant to listen to for your users.  

 

The benefit of using Azure neural TTS for read-aloud

 

Azure neural TTS allows you to choose from more than 140 highly realistic voices across 60 languages and variants that enables fluid, natural-sounding speech, with rich customization capabilities available at the same time. 

 

High AI quality

Why is neural TTS so much better? Traditional TTS is a multi-step pipeline, and a complex process. Each step could involve human, expert rules or individual models. There is no end-to-end optimization in between, so the quality is not optimal. The AI based neural TTS voice technology has simplified the pipeline into three major components. Each component can be modeled by advanced neural deep learning networks: a neural text analysis module,  which generates more correct pronunciations for TTS to speak; a neural acoustic model, like uni-TTS which predicts prosody much better than the traditional TTS, and a neural vocoder, like HiFiNet which creates audios in higher fidelity.

 

With all these components, Azure neural TTS makes the listening experience much more enjoyable than the traditional TTS. Our studies repeatedly show that the read-aloud experience integrated with the highly natural voices on the Azure neural TTS platform can significantly increase the time that people spend on listening to the synthetic speech continuously, and greatly improve the effectiveness of their consumption of the audio content.

 

Broad locale coverage

Usually, the reading content is available in many different languages.  To read aloud more content and reach more users, TTS needs to support various locales.  Azure neural TTS now supports more than 60 languages off the shelf. Check out the details in the full language list.

 

By offering more voices across more languages and locales, we anticipate developers across the world will be able to build applications that change experiences for millions. With our innovative voice models in the low-resource setting, we can also extend to new languages much faster than ever.

 

Rich speaking styles

Azure neural TTS provides you a rich choice of different styles that resonate your content. For example, the newscast style is optimized for news content reading in a professional tone. The customer service style supports you to create a more friendly reading experience for conversational content focusing on customer support. In addition, various emotional styles and role-play capabilities can be used to create vivid audiobooks in synthetic voices.

 

Here are some examples of the voices and styles used for different types of content.  

 

Language

Content type

Sample

Note

English (US)

Newscast

Aria, in the newscast style

English (US)

Newscast

Guy, in the general/default style

English (US)

Conversational

Jenny, in the chat style

English (US)

Audiobook

Jenny, in multiple styles

Chinese (Mandarin, simplified)

Newscast

Yunyang, in the newscast style

Chinese (Mandarin, simplified)

Conversational

Yunxi, in the assistant style

Chinese (Mandarin, simplified)

Audiobook

Multiple voices used: Xiaoxiao and Yunxi

 

Different styles used: lyrical, calm, angry, disgruntled, angry, embarrassed, with different style degrees applied

 

 

These styles can be adjusted using SSML, together with other tuning capabilities, including rate, pitch, pronunciation, pauses, and more.

 

Powerful customization capabilities

Besides the rich choice of prebuilt neural voices, Azure TTS provides you a powerful capability to create a one-of-a-kind custom voice that can differentiate your brand from others. Using Custom Neural Voice, you can build a highly realistic voice using less than 30 minutes of audio as training data. You can then use your customized voices to create a unique read-aloud experience that reflects your brand identity or resonate the characteristics of your content.

 

Next, we’ll walk you through the coding exercise of developing the read-aloud feature with Azure neural TTS.  

 

How to build read-aloud features with your app    

 

It is incredibly easy to add the read-aloud capability using Azure neural TTS to your application with the Speech SDK.  Below we describe two typical designs to enable read-aloud for different scenarios.

 

Prerequisites

If you don't have an Azure subscription, create a free account before you begin. If you have a subscription, log in to the Azure Portal and create a Speech resource.

 

Client-side read-aloud

In this design, the client directly interacts with Azure TTS using the Speech SDK.  The following steps with the JavaScript code sample provide you the basic process to implement the read-aloud.

 

Step 1: Create synthesizer

First, create the synthesizer with the selected language and voices. Make sure you select a neural voice to get the best quality. 

 

const config = SpeechSDK.SpeechConfig. fromAuthorizationToken(“YourAuthorizationToken”, “YourSubscriptionRegion”);
config.SpeechSynthesisVoiceName = voice;
config.speechSynthesisOutputFormat = SpeechSDK.SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm;
// set the endpoint id if you are using custom voice
// config.endpointId = "YourEndpointId";
const player = new SpeechSDK.SpeakerAudioDestination();
const audioConfig  = SpeechSDK.AudioConfig.fromSpeakerOutput(player);
var synthesizer = new SpeechSDK.SpeechSynthesizer(config, audioConfig); 

 

Then you can hook up the events from the synthesizer. The event will be used to update the UX while the read-aloud is on.

 

player.onAudioEnd = function (_) {
    window.console.log("playback finished");
    // update your UX
};

 

Step 2: Collect word boundary events

The word boundary event is fired during synthesis. Usually, the synthesis speed is much faster than the playback speed of the audio. The word boundary event is fired before you get the corresponding audio chunks. The application can collect the event and the time stamp information of the audio for your next step.

 

var wordBoundaryList = [];
synthesizer.wordBoundary = function (s, e) {
    window.console.log(e);
    wordBoundaryList.push(e);
};

 

Step 3: Highlight word boundary during audio playback

You can then highlight the word as the audio plays, using the code sample below.

 

setInterval(function () {
    if (player !== undefined) {
        const currentTime = player.currentTime;
        var wordBoundary;
        for (const e of wordBoundaryList) {
            if (currentTime * 1000 > e.audioOffset / 10000) {
                wordBoundary = e;
            } else {
                break;
            }
        }
        if (wordBoundary !== undefined) {
            highlightDiv.innerHTML = synthesisText.value.substr(0, wordBoundary.textOffset) +
                    "" + wordBoundary.text + "" +
                    synthesisText.value.substr(wordBoundary.textOffset + wordBoundary.wordLength);
            } else {
            highlightDiv.innerHTML = synthesisText.value;
        }
    }
}, 50);

 

See the full example here for more details.

 

Server-side read-aloud

In this design, the client interacts with a middle layer service, which then interacts with Azure TTS through the Speech SDK. It is suitable for below scenarios:

  • It is required to put the authentication secret (e.g., subscription key) on the server side.
  • There could be additional related business logics such as text preprocessing, audio postprocessing etc.
  • There is already a service to interact with the client application. 

 

Below is a reference architecture for such design:

 

Reference architecture design for the server-side read-aloudReference architecture design for the server-side read-aloud

The roles of each component in this architecture are described below.

  • Azure Cognitive Services - TTS: the cloud API provided by Microsoft Azure, which converts text to human-like natural speech.
  • Middle Layer Service: the service built by you or your organization, which serves your client app by hosting the cross-device / cross-platform business logics.
  • TTS Handler: the component to handle TTS related business logics, which takes below responsibilities:
    • Wraps the Speech SDK to call the Azure TTS API.
    • Receives the text from the client app and makes preprocessing if necessary, then sends it to the Azure TTS  API through the Speech SDK.
    • Receives the audio stream and the TTS events (e.g., word boundary events) from Azure TTS, then makes postprocessing if necessary, and sends them to the client app.
  • Client App: your app running on the client side, which interacts with end users directly. It takes below responsibilities:
    • Sends the text to your service (“Middle Layer Service”).
    • Receives the audio stream and TTS events from your service (“Middle Layer Service”), and plays the audio to your end users, with UI rendering like real-time text highlight with the word boundary events.

 

Check here for the sample code to call Azure TTS API from server.

 

Comparing to the client-side read-aloud design, the server-side read-aloud is a more advanced solution. It can cost higher but is more powerful to handle more complicated requirements.

 

Recommended practices for building a read-aloud experience

 

The section above shows you how to build a read-aloud feature in the client and service scenarios. Below are some recommended practices that can help to make your development more efficient and improve your service experience.

 

Segmentation

When the content to read is long, it’s a good practice to always segment your reading content to sentences or short paragraphs in each request. Such segmentation has several benefits.

  • The response is faster for shorter content.
  • Long synthesized audio will cost more memory.
  • Azure speech synthesis API requires the synthesized audio length to be less than 10 minutes. If your audio exceeds 10 minutes, it will be truncated to 10 minutes.

Using the Speech SDK’s PullAudioOutputStream, the synthesized audio in each turn could be easily merged into one stream.

 

Streaming

Streaming is critical to lower the latency. When the first audio chunk is available, you can start the playback or start to forward the audio chunks immediately to your clients. The Speech SDK provides PullAudioOutputStreamPushAudioOutputStreamSynthesizing event, and AudioDateStream for streaming. You can select the one that best suites the architecture of your application. Find the samples here.

 

Besides, with the stream objects of the Speech SDK, you can get the seek-able in-memory audio stream, which works easily for any downstream services.

 

Tell us your experiences!

 

Whether you are building a voice-enabled chatbot or IoT device, an IVR solution, adding read-aloud features to your app, converting e-books to audio books, or even adding Speech to a translation app, you can make all these experiences natural sounding and fun with Neural TTS.

 

Let us know how you are using or plan to use Neural TTS voices in this form. If you prefer, you can also contact us at mstts [at] microsoft.com. We look forward to hearing about your experience and developing more compelling services together with you for the developers around the world.

 

Get started

Add voice to your app in 15 minutes

Explore the available voices in this demo

Build a voice-enabled bot

Deploy Azure TTS voices on prem with Speech Containers

Build your custom voice

Learn more about other Speech scenarios

 

%3CLINGO-SUB%20id%3D%22lingo-sub-2301422%22%20slang%3D%22en-US%22%3EEnable%20read-aloud%20for%20your%20application%20with%20Azure%20neural%20TTS%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2301422%22%20slang%3D%22en-US%22%3E%3CP%3E%3CEM%3EThis%20post%20is%20co-authored%20with%20Yulin%20Li%2C%20Yinhe%20Wei%2C%20Qinying%20Liao%2C%20Yueying%20Liu%2C%20Sheng%20Zhao%20%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EVoice%20is%20becoming%20increasingly%20popular%20in%20providing%20useful%20and%20engaging%20experiences%20for%20customers%20and%20employees.%20The%20Text-to-Speech%20(TTS)%20capability%20of%20Speech%20on%20Azure%20Cognitive%20Services%20allows%20you%20to%20quickly%20create%20intelligent%20read-aloud%20experience%20for%20your%20scenarios.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20blog%2C%20we%E2%80%99ll%20walk%20through%20an%20exercise%20which%20you%20can%20complete%20in%20under%20two%20hours%2C%20to%20get%20started%20using%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fcognitive-services%2Ftext-to-speech%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20neural%20TTS%20voices%3C%2FA%3E%26nbsp%3Band%20enable%20your%20apps%20to%20read%20content%20aloud.%20We%E2%80%99ll%20provide%20high%20level%20guidance%20and%20sample%20code%20to%20get%20you%20started%2C%20and%20we%20encourage%20you%20to%20play%20around%20with%20the%20code%20and%20get%20creative%20with%20your%20solution!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId-1325284470%22%20id%3D%22toc-hId-1325280657%22%3EWhat%20is%20read-aloud%20%26nbsp%3B%26nbsp%3B%3C%2FH1%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERead-aloud%20is%20a%20modern%20way%20to%20help%20people%20to%20read%20and%20consume%20content%20like%20emails%20and%20word%20documents%20more%20easily.%20It%20is%20a%20popular%20feature%20in%20many%20Microsoft%20products%2C%20which%20has%20received%20highly%20positive%20user%20feedback.%20A%20few%20latest%20examples%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dt5orkIk0Vj4%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CSTRONG%3EPlay%20My%20Emails%3A%3C%2FSTRONG%3E%3C%2FA%3E%20In%20outlook%20iOS%2C%20users%20can%20listen%20to%20their%20incoming%20email%20during%20the%20commute%20to%20the%20office.%20They%20can%20choose%20from%20a%20female%20and%20a%20male%20voice%20to%20read%20the%20email%20aloud%2C%20anytime%20their%20hands%20may%20be%20busy%20doing%20other%20things.%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Da9FN11y9qEQ%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CSTRONG%3EEdge%20read%20aloud%3A%3C%2FSTRONG%3E%3C%2FA%3E%20In%20recent%20chromium-based%20edge%20browser%2C%20people%20can%20listen%20to%20the%20web%20pages%20or%20pdf%20documents%20when%20they%20are%20doing%20multi-tasking.%20The%20read-aloud%20voice%20quality%20has%20been%20enhanced%20with%20Azure%20neural%20TTS%2C%20which%20becomes%20the%20%E2%80%98favorite%E2%80%99%20feature%20to%20many%20(Read%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.fastcompany.com%2F90622361%2Fmicrosoft-edge-tips-reasons-to-switch-from-chrome%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Efull%20article%3C%2FA%3E).%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fwww.onenote.com%2Flearningtools%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CSTRONG%3EImmersive%20reader%3C%2FSTRONG%3E%3C%2FA%3E%20is%20a%20free%20tool%20that%20uses%20proven%20techniques%20to%20improve%20reading%20for%20people%20regardless%20of%20their%20age%20or%20ability.%20It%20has%20adopted%20Azure%20neural%20voices%20to%20read%20aloud%20content%20to%20students.%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Ftwitter.com%2FMicrosoft365%2Fstatus%2F1354927335837999106%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CSTRONG%3EListen%20to%20Word%20documents%20on%20mobile.%3C%2FSTRONG%3E%3C%2FA%3E%20This%20is%20an%20eyes-off%2C%20potentially%20hands-off%20modern%20consumption%20experience%20for%20those%20who%20want%20to%20do%20multitask%20on%20the%20go.%20In%20specific%2C%20this%20feature%20supports%20a%20longer%20listening%20scenario%20for%20document%20consumption%2C%20now%20available%20with%20Word%20on%20Android%20and%20iOS.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EWith%20all%20these%20examples%20and%20more%2C%20we%E2%80%99ve%20seen%20clear%20trending%20of%20providing%20voice%20experiences%20for%20users%20consuming%20content%20on%20the%20go%2C%20when%20multi-tasking%2C%20or%20for%20those%20who%20tend%20to%20read%20in%20an%20audible%20way.%20With%20Azure%20neural%20TTS%2C%20it%20is%20easy%20to%20implement%20your%20own%20read-aloud%20that%20is%20pleasant%20to%20listen%20to%20for%20your%20users.%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId--482169993%22%20id%3D%22toc-hId--482173806%22%3EThe%20benefit%20of%20using%20Azure%20neural%20TTS%20for%20read-aloud%3C%2FH1%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20neural%20TTS%20allows%20you%20to%20choose%20from%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcognitive-services%2Fspeech-service%2Flanguage-support%23neural-voices%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Emore%20than%20140%20highly%20realistic%20voices%3C%2FA%3E%20across%2060%20languages%20and%20variants%20that%20enables%20fluid%2C%20natural-sounding%20speech%2C%20with%20rich%20customization%20capabilities%20available%20at%20the%20same%20time.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-208391481%22%20id%3D%22toc-hId-208387668%22%3EHigh%20AI%20quality%3C%2FH2%3E%0A%3CP%3EWhy%20is%20neural%20TTS%20so%20much%20better%3F%20Traditional%20TTS%20is%20a%20multi-step%20pipeline%2C%20and%20a%20complex%20process.%20Each%20step%20could%20involve%20human%2C%20expert%20rules%20or%20individual%20models.%20There%20is%20no%20end-to-end%20optimization%20in%20between%2C%20so%20the%20quality%20is%20not%20optimal.%20The%20AI%20based%20neural%20TTS%20voice%20technology%20has%20simplified%20the%20pipeline%20into%20three%20major%20components.%20Each%20component%20can%20be%20modeled%20by%20advanced%20neural%20deep%20learning%20networks%3A%20a%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-ai%2Funified-neural-text-analyzer-an-innovation-to-improve-neural-tts%2Fba-p%2F2102187%22%20target%3D%22_blank%22%3Eneural%20text%20analysis%20module%2C%20%3C%2FA%3E%26nbsp%3Bwhich%20generates%20more%20correct%20pronunciations%20for%20TTS%20to%20speak%3B%20a%20neural%20acoustic%20model%2C%20like%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-ai%2Fneural-text-to-speech-previews-five-new-languages-with%2Fba-p%2F1907604%22%20target%3D%22_blank%22%3Euni-TTS%20%3C%2FA%3Ewhich%20predicts%20prosody%20much%20better%20than%20the%20traditional%20TTS%2C%20and%20a%20neural%20vocoder%2C%20like%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-ai%2Fazure-neural-tts-upgraded-with-hifinet-achieving-higher-audio%2Fba-p%2F1847860%22%20target%3D%22_blank%22%3EHiFiNet%20%3C%2FA%3Ewhich%20creates%20audios%20in%20higher%20fidelity.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWith%20all%20these%20components%2C%20Azure%20neural%20TTS%20makes%20the%20listening%20experience%20much%20more%20enjoyable%20than%20the%20traditional%20TTS.%20Our%20studies%20repeatedly%20show%20that%20the%20read-aloud%20experience%20integrated%20with%20the%20highly%20natural%20voices%20on%20the%20Azure%20neural%20TTS%20platform%20can%20significantly%20increase%20the%20time%20that%20people%20spend%20on%20listening%20to%20the%20synthetic%20speech%20continuously%2C%20and%20greatly%20improve%20the%20effectiveness%20of%20their%20consumption%20of%20the%20audio%20content.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1599062982%22%20id%3D%22toc-hId--1599066795%22%3EBroad%20locale%20coverage%3C%2FH2%3E%0A%3CP%3EUsually%2C%20the%20reading%20content%20is%20available%20in%20many%20different%20languages.%26nbsp%3B%20To%20read%20aloud%20more%20content%20and%20reach%20more%20users%2C%20TTS%20needs%20to%20support%20various%20locales.%26nbsp%3B%20Azure%20neural%20TTS%20now%20supports%20more%20than%2060%20languages%20off%20the%20shelf.%20Check%20out%20the%20details%20in%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcognitive-services%2Fspeech-service%2Flanguage-support%23neural-voices%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Efull%20language%20list.%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBy%20offering%20more%20voices%20across%20more%20languages%20and%20locales%2C%20we%20anticipate%20developers%20across%20the%20world%20will%20be%20able%20to%20build%20applications%20that%20change%20experiences%20for%20millions.%20With%20our%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-ai%2Fneural-text-to-speech-previews-five-new-languages-with%2Fba-p%2F1907604%22%20target%3D%22_blank%22%3Einnovative%20voice%20models%20in%20the%20low-resource%20setting%3C%2FA%3E%2C%20we%20can%20also%20extend%20to%20new%20languages%20much%20faster%20than%20ever.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-888449851%22%20id%3D%22toc-hId-888446038%22%3ERich%20speaking%20styles%3C%2FH2%3E%0A%3CP%3EAzure%20neural%20TTS%20provides%20you%20a%20rich%20choice%20of%20different%20styles%20that%20resonate%20your%20content.%20For%20example%2C%20the%20newscast%20style%20is%20optimized%20for%20news%20content%20reading%20in%20a%20professional%20tone.%20The%20customer%20service%20style%20supports%20you%20to%20create%20a%20more%20friendly%20reading%20experience%20for%20conversational%20content%20focusing%20on%20customer%20support.%20In%20addition%2C%20various%20emotional%20styles%20and%20role-play%20capabilities%20can%20be%20used%20to%20create%20vivid%20audiobooks%20in%20synthetic%20voices.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere%20are%20some%20examples%20of%20the%20voices%20and%20styles%20used%20for%20different%20types%20of%20content.%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%20style%3D%22width%3A%20900px%3B%22%20width%3D%22900%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22144%22%3E%3CP%3E%3CSTRONG%3ELanguage%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22156%22%3E%3CP%3E%3CSTRONG%3EContent%20type%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22116%22%3E%3CP%3E%3CSTRONG%3ESample%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22207%22%3E%3CP%3E%3CSTRONG%3ENote%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22144%22%3E%3CP%3EEnglish%20(US)%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22156%22%3E%3CP%3ENewscast%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22116%22%3E%3CAUDIO%20controls%3D%22controls%22%20data-mce-fragment%3D%221%22%3E%0A%3CSOURCE%20src%3D%22https%3A%2F%2Fnerualttswaves.blob.core.windows.net%2Fneuralttswaves%2FAria-news.wav%22%3E%3C%2FSOURCE%3E%3C%2FAUDIO%3E%3C%2FTD%3E%0A%3CTD%20width%3D%22207%22%3E%3CP%3EAria%2C%20in%20the%20newscast%20style%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22144%22%3E%3CP%3EEnglish%20(US)%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22156%22%3E%3CP%3ENewscast%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22116%22%3E%3CAUDIO%20controls%3D%22controls%22%20data-mce-fragment%3D%221%22%3E%0A%3CSOURCE%20src%3D%22https%3A%2F%2Fnerualttswaves.blob.core.windows.net%2Fneuralttswaves%2FGuy-news.wav%22%3E%3C%2FSOURCE%3E%3C%2FAUDIO%3E%3C%2FTD%3E%0A%3CTD%20width%3D%22207%22%3E%3CP%3EGuy%2C%20in%20the%20general%2Fdefault%20style%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22144%22%3E%3CP%3EEnglish%20(US)%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22156%22%3E%3CP%3EConversational%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22116%22%3E%3CAUDIO%20controls%3D%22controls%22%20data-mce-fragment%3D%221%22%3E%0A%3CSOURCE%20src%3D%22https%3A%2F%2Fnerualttswaves.blob.core.windows.net%2Fneuralttswaves%2FJenny-chat.wav%22%3E%3C%2FSOURCE%3E%3C%2FAUDIO%3E%3C%2FTD%3E%0A%3CTD%20width%3D%22207%22%3E%3CP%3EJenny%2C%20in%20the%20chat%20style%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22144%22%3E%3CP%3EEnglish%20(US)%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22156%22%3E%3CP%3EAudiobook%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22116%22%3E%3CAUDIO%20controls%3D%22controls%22%20data-mce-fragment%3D%221%22%3E%0A%3CSOURCE%20src%3D%22https%3A%2F%2Fnerualttswaves.blob.core.windows.net%2Fneuralttswaves%2FJenny-audiobook.wav%22%3E%3C%2FSOURCE%3E%3C%2FAUDIO%3E%3C%2FTD%3E%0A%3CTD%20width%3D%22207%22%3E%3CP%3EJenny%2C%20in%20multiple%20styles%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22144%22%3E%3CP%3EChinese%20(Mandarin%2C%20simplified)%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22156%22%3E%3CP%3ENewscast%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22116%22%3E%3CAUDIO%20controls%3D%22controls%22%20data-mce-fragment%3D%221%22%3E%0A%3CSOURCE%20src%3D%22https%3A%2F%2Fnerualttswaves.blob.core.windows.net%2Fneuralttswaves%2FYunyang-news.wav%22%3E%3C%2FSOURCE%3E%3C%2FAUDIO%3E%3C%2FTD%3E%0A%3CTD%20width%3D%22207%22%3E%3CP%3EYunyang%2C%20in%20the%20newscast%20style%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22144%22%3E%3CP%3EChinese%20(Mandarin%2C%20simplified)%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22156%22%3E%3CP%3EConversational%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22116%22%3E%3CAUDIO%20controls%3D%22controls%22%20data-mce-fragment%3D%221%22%3E%0A%3CSOURCE%20src%3D%22https%3A%2F%2Fnerualttswaves.blob.core.windows.net%2Fneuralttswaves%2FYunxi-assistant.wav%22%3E%3C%2FSOURCE%3E%3C%2FAUDIO%3E%3C%2FTD%3E%0A%3CTD%20width%3D%22207%22%3E%3CP%3EYunxi%2C%20in%20the%20assistant%20style%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22144%22%3E%3CP%3EChinese%20(Mandarin%2C%20simplified)%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22156%22%3E%3CP%3EAudiobook%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22116%22%3E%3CAUDIO%20controls%3D%22controls%22%20data-mce-fragment%3D%221%22%3E%0A%3CSOURCE%20src%3D%22https%3A%2F%2Fnerualttswaves.blob.core.windows.net%2Fneuralttswaves%2Fzh-CN-audio.wav%22%3E%3C%2FSOURCE%3E%3C%2FAUDIO%3E%3C%2FTD%3E%0A%3CTD%20width%3D%22207%22%3E%3CP%3EMultiple%20voices%20used%3A%20Xiaoxiao%20and%20Yunxi%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDifferent%20styles%20used%3A%20lyrical%2C%20calm%2C%20angry%2C%20disgruntled%2C%20angry%2C%20embarrassed%2C%20with%20different%20style%20degrees%20applied%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThese%20styles%20can%20be%20adjusted%20using%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcognitive-services%2Fspeech-service%2Fspeech-synthesis-markup%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ESSML%3C%2FA%3E%2C%20together%20with%20other%20tuning%20capabilities%2C%20including%20rate%2C%20pitch%2C%20pronunciation%2C%20pauses%2C%20and%20more.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--919004612%22%20id%3D%22toc-hId--919008425%22%3EPowerful%20customization%20capabilities%3C%2FH2%3E%0A%3CP%3EBesides%20the%20rich%20choice%20of%20prebuilt%20neural%20voices%2C%20Azure%20TTS%20provides%20you%20a%20powerful%20capability%20to%20create%20a%20one-of-a-kind%20custom%20voice%20that%20can%20differentiate%20your%20brand%20from%20others.%20Using%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-ai%2Fbuild-a-natural-custom-voice-for-your-brand%2Fba-p%2F2112777%22%20target%3D%22_blank%22%3ECustom%20Neural%20Voice%3C%2FA%3E%2C%20you%20can%20build%20a%20highly%20realistic%20voice%20using%20less%20than%2030%20minutes%20of%20audio%20as%20training%20data.%20You%20can%20then%20use%20your%20customized%20voices%20to%20create%20a%20unique%20read-aloud%20experience%20that%20reflects%20your%20brand%20identity%20or%20resonate%20the%20characteristics%20of%20your%20content.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENext%2C%20we%E2%80%99ll%20walk%20you%20through%20the%20coding%20exercise%20of%20developing%20the%20read-aloud%20feature%20with%20Azure%20neural%20TTS.%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId--929507716%22%20id%3D%22toc-hId--929511529%22%3EHow%20to%20build%20read-aloud%20features%20with%20your%20app%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FH1%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt%20is%20incredibly%20easy%20to%20add%20the%20read-aloud%20capability%20using%20Azure%20neural%20TTS%20to%20your%20application%20with%20the%20Speech%20SDK.%20%26nbsp%3BBelow%20we%20describe%20two%20typical%20designs%20to%20enable%20read-aloud%20for%20different%20scenarios.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--238946242%22%20id%3D%22toc-hId--238950055%22%3EPrerequisites%3C%2FH2%3E%0A%3CP%3EIf%20you%20don't%20have%20an%20Azure%20subscription%2C%20create%20a%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Ffree%2Fcognitive-services%2F%3FOCID%3DAID3024570%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Efree%20account%3C%2FA%3E%26nbsp%3Bbefore%20you%20begin.%20If%20you%20have%20a%20subscription%2C%20log%20in%20to%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fms.portal.azure.com%2F%23home%3FOCID%3DAID3024570%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EAzure%20Portal%3C%2FA%3E%20and%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fcognitive-services%2Fspeech-service%2Foverview%23create-the-azure-resource%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ecreate%20a%20Speech%20resource%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--2046400705%22%20id%3D%22toc-hId--2046404518%22%3EClient-side%20read-aloud%3C%2FH2%3E%0A%3CP%3EIn%20this%20design%2C%20the%20client%20directly%20interacts%20with%20Azure%20TTS%20using%20the%20Speech%20SDK.%20%26nbsp%3BThe%20following%20steps%20with%20the%20JavaScript%20code%20sample%20provide%20you%20the%20basic%20process%20to%20implement%20the%20read-aloud.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1355839231%22%20id%3D%22toc-hId--1355843044%22%3EStep%201%3A%20Create%20synthesizer%3C%2FH3%3E%0A%3CP%3EFirst%2C%20create%20the%20synthesizer%20with%20the%20selected%20language%20and%20voices.%20Make%20sure%20you%20select%20a%20neural%20voice%20to%20get%20the%20best%20quality.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3Econst%20config%20%3D%20SpeechSDK.SpeechConfig.%20fromAuthorizationToken(%E2%80%9CYourAuthorizationToken%E2%80%9D%2C%20%E2%80%9CYourSubscriptionRegion%E2%80%9D)%3B%0Aconfig.SpeechSynthesisVoiceName%20%3D%20voice%3B%0Aconfig.speechSynthesisOutputFormat%20%3D%20SpeechSDK.SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm%3B%0A%2F%2F%20set%20the%20endpoint%20id%20if%20you%20are%20using%20custom%20voice%0A%2F%2F%20config.endpointId%20%3D%20%22YourEndpointId%22%3B%0Aconst%20player%20%3D%20new%20SpeechSDK.SpeakerAudioDestination()%3B%0Aconst%20audioConfig%20%20%3D%20SpeechSDK.AudioConfig.fromSpeakerOutput(player)%3B%0Avar%20synthesizer%20%3D%20new%20SpeechSDK.SpeechSynthesizer(config%2C%20audioConfig)%3B%20%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThen%20you%20can%20hook%20up%20the%20events%20from%20the%20synthesizer.%20The%20event%20will%20be%20used%20to%20update%20the%20UX%20while%20the%20read-aloud%20is%20on.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3Eplayer.onAudioEnd%20%3D%20function%20(_)%20%7B%0A%20%20%20%20window.console.log(%22playback%20finished%22)%3B%0A%20%20%20%20%2F%2F%20update%20your%20UX%0A%7D%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-436510123%22%20id%3D%22toc-hId-436506310%22%3EStep%202%3A%20Collect%20word%20boundary%20events%3C%2FH3%3E%0A%3CP%3EThe%20word%20boundary%20event%20is%20fired%20during%20synthesis.%20Usually%2C%20the%20synthesis%20speed%20is%20much%20faster%20than%20the%20playback%20speed%20of%20the%20audio.%20The%20word%20boundary%20event%20is%20fired%20before%20you%20get%20the%20corresponding%20audio%20chunks.%20The%20application%20can%20collect%20the%20event%20and%20the%20time%20stamp%20information%20of%20the%20audio%20for%20your%20next%20step.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3Evar%20wordBoundaryList%20%3D%20%5B%5D%3B%0Asynthesizer.wordBoundary%20%3D%20function%20(s%2C%20e)%20%7B%0A%20%20%20%20window.console.log(e)%3B%0A%20%20%20%20wordBoundaryList.push(e)%3B%0A%7D%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1370944340%22%20id%3D%22toc-hId--1370948153%22%3EStep%203%3A%20Highlight%20word%20boundary%20during%20audio%20playback%3C%2FH3%3E%0A%3CP%3EYou%20can%20then%20highlight%20the%20word%20as%20the%20audio%20plays%2C%20using%20the%20code%20sample%20below.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3EsetInterval(function%20()%20%7B%0A%20%20%20%20if%20(player%20!%3D%3D%20undefined)%20%7B%0A%20%20%20%20%20%20%20%20const%20currentTime%20%3D%20player.currentTime%3B%0A%20%20%20%20%20%20%20%20var%20wordBoundary%3B%0A%20%20%20%20%20%20%20%20for%20(const%20e%20of%20wordBoundaryList)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(currentTime%20*%201000%20%26gt%3B%20e.audioOffset%20%2F%2010000)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20wordBoundary%20%3D%20e%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20break%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20if%20(wordBoundary%20!%3D%3D%20undefined)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20highlightDiv.innerHTML%20%3D%20synthesisText.value.substr(0%2C%20wordBoundary.textOffset)%20%2B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22%22%20%2B%20wordBoundary.text%20%2B%20%22%22%20%2B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20synthesisText.value.substr(wordBoundary.textOffset%20%2B%20wordBoundary.wordLength)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20highlightDiv.innerHTML%20%3D%20synthesisText.value%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%7D%2C%2050)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESee%20the%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure-Samples%2Fcognitive-services-speech-sdk%2Fblob%2Fmaster%2Fsamples%2Fjs%2Fbrowser%2Fsynthesis.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Efull%20example%20here%3C%2FA%3E%26nbsp%3Bfor%20more%20details.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-987485774%22%20id%3D%22toc-hId-987481961%22%3EServer-side%20read-aloud%3C%2FH2%3E%0A%3CP%3EIn%20this%20design%2C%20the%20client%20interacts%20with%20a%20middle%20layer%20service%2C%20which%20then%20interacts%20with%20Azure%20TTS%20through%20the%20Speech%20SDK.%26nbsp%3BIt%20is%20suitable%20for%20below%20scenarios%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EIt%20is%20required%20to%20put%20the%20authentication%20secret%20(e.g.%2C%20subscription%20key)%20on%20the%20server%20side.%3C%2FLI%3E%0A%3CLI%3EThere%20could%20be%20additional%20related%20business%20logics%20such%20as%20text%20preprocessing%2C%20audio%20postprocessing%20etc.%3C%2FLI%3E%0A%3CLI%3EThere%20is%20already%20a%20service%20to%20interact%20with%20the%20client%20application.%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBelow%20is%20a%20reference%20architecture%20for%20such%20design%3A%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorQinying%20Liao_3%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22read_aloud_server_scenario.png%22%20style%3D%22width%3A%20924px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F276221i6FF5767F0889B34B%2Fimage-dimensions%2F924x511%3Fv%3Dv2%22%20width%3D%22924%22%20height%3D%22511%22%20role%3D%22button%22%20title%3D%22read_aloud_server_scenario.png%22%20alt%3D%22Reference%20architecture%20design%20for%20the%20server-side%20read-aloud%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EReference%20architecture%20design%20for%20the%20server-side%20read-aloud%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThe%20roles%20of%20each%20component%20in%20this%20architecture%20are%20described%20below.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EAzure%20Cognitive%20Services%20-%20TTS%3C%2FSTRONG%3E%3A%20the%20cloud%20API%20provided%20by%20Microsoft%20Azure%2C%20which%20converts%20text%20to%20human-like%20natural%20speech.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EMiddle%20Layer%20Service%3C%2FSTRONG%3E%3A%20the%20service%20built%20by%20you%20or%20your%20organization%2C%20which%20serves%20your%20client%20app%20by%20hosting%20the%20cross-device%20%2F%20cross-platform%20business%20logics.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ETTS%20Handler%3C%2FSTRONG%3E%3A%20the%20component%20to%20handle%20TTS%20related%20business%20logics%2C%20which%20takes%20below%20responsibilities%3A%3CUL%3E%0A%3CLI%3EWraps%20the%20Speech%20SDK%20to%20call%20the%20Azure%20TTS%20API.%3C%2FLI%3E%0A%3CLI%3EReceives%20the%20text%20from%20the%20client%20app%20and%20makes%20preprocessing%20if%20necessary%2C%20then%20sends%20it%20to%20the%20Azure%20TTS%26nbsp%3B%20API%20through%20the%20Speech%20SDK.%3C%2FLI%3E%0A%3CLI%3EReceives%20the%20audio%20stream%20and%20the%20TTS%20events%20(e.g.%2C%20word%20boundary%20events)%20from%20Azure%20TTS%2C%20then%20makes%20postprocessing%20if%20necessary%2C%20and%20sends%20them%20to%20the%20client%20app.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EClient%20App%3C%2FSTRONG%3E%3A%20your%20app%20running%20on%20the%20client%20side%2C%20which%20interacts%20with%20end%20users%20directly.%20It%20takes%20below%20responsibilities%3A%3CUL%3E%0A%3CLI%3ESends%20the%20text%20to%20your%20service%20(%E2%80%9CMiddle%20Layer%20Service%E2%80%9D).%3C%2FLI%3E%0A%3CLI%3EReceives%20the%20audio%20stream%20and%20TTS%20events%20from%20your%20service%20(%E2%80%9CMiddle%20Layer%20Service%E2%80%9D)%2C%20and%20plays%20the%20audio%20to%20your%20end%20users%2C%20with%20UI%20rendering%20like%20real-time%20text%20highlight%20with%20the%20word%20boundary%20events.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECheck%20here%20for%20the%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure-Samples%2Fcognitive-services-speech-sdk%2Fblob%2Fmaster%2Fsamples%2Fjava%2Fjre%2Fconsole%2Fsrc%2Fcom%2Fmicrosoft%2Fcognitiveservices%2Fspeech%2Fsamples%2Fconsole%2FSpeechSynthesisScenarioSamples.java%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Esample%20code%20to%20call%20Azure%20TTS%20API%20from%20server%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EComparing%20to%20the%20client-side%20read-aloud%20design%2C%20the%20server-side%20read-aloud%20is%20a%20more%20advanced%20solution.%20It%20can%20cost%20higher%20but%20is%20more%20powerful%20to%20handle%20more%20complicated%20requirements.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId--949051408%22%20id%3D%22toc-hId--949055221%22%3ERecommended%20practices%20for%20building%20a%20read-aloud%20experience%3C%2FH1%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20section%20above%20shows%20you%20how%20to%20build%20a%20read-aloud%20feature%20in%20the%20client%20and%20service%20scenarios.%20Below%20are%20some%20recommended%20practices%20that%20can%20help%20to%20make%20your%20development%20more%20efficient%20and%20improve%20your%20service%20experience.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1667544144%22%20id%3D%22toc-hId-1667540331%22%3ESegmentation%3C%2FH2%3E%0A%3CP%3EWhen%20the%20content%20to%20read%20is%20long%2C%20it%E2%80%99s%20a%20good%20practice%20to%20always%20segment%20your%20reading%20content%20to%20sentences%20or%20short%20paragraphs%20in%20each%20request.%20Such%20segmentation%20has%20several%20benefits.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EThe%20response%20is%20faster%20for%20shorter%20content.%3C%2FLI%3E%0A%3CLI%3ELong%20synthesized%20audio%20will%20cost%20more%20memory.%3C%2FLI%3E%0A%3CLI%3EAzure%20speech%20synthesis%20API%20requires%20the%20synthesized%20audio%20length%20to%20be%20less%20than%2010%20minutes.%20If%20your%20audio%20exceeds%2010%20minutes%2C%20it%20will%20be%20truncated%20to%2010%20minutes.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EUsing%20the%20Speech%20SDK%E2%80%99s%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fdotnet%2Fapi%2Fmicrosoft.cognitiveservices.speech.audio.pullaudiooutputstream%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EPullAudioOutputStream%3C%2FA%3E%2C%20the%20synthesized%20audio%20in%20each%20turn%20could%20be%20easily%20merged%20into%20one%20stream.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--139910319%22%20id%3D%22toc-hId--139914132%22%3EStreaming%3C%2FH2%3E%0A%3CP%3EStreaming%20is%20critical%20to%20lower%20the%20latency.%20When%20the%20first%20audio%20chunk%20is%20available%2C%20you%20can%20start%20the%20playback%20or%20start%20to%20forward%20the%20audio%20chunks%20immediately%20to%20your%20clients.%26nbsp%3BThe%20Speech%20SDK%20provides%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fdotnet%2Fapi%2Fmicrosoft.cognitiveservices.speech.audio.pullaudiooutputstream%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EPullAudioOutputStream%3C%2FA%3E%2C%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fdotnet%2Fapi%2Fmicrosoft.cognitiveservices.speech.audio.pushaudiooutputstream%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EPushAudioOutputStream%3C%2FA%3E%2C%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fdotnet%2Fapi%2Fmicrosoft.cognitiveservices.speech.speechsynthesizer.synthesizing%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ESynthesizing%26nbsp%3Bevent%3C%2FA%3E%2C%20and%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fdotnet%2Fapi%2Fmicrosoft.cognitiveservices.speech.audiodatastream%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAudioDateStream%3C%2FA%3E%26nbsp%3Bfor%20streaming.%20You%20can%20select%20the%20one%20that%20best%20suites%20the%20architecture%20of%20your%20application.%20Find%20the%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure-Samples%2Fcognitive-services-speech-sdk%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Esamples%20here%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBesides%2C%20with%20the%20stream%20objects%20of%20the%20Speech%20SDK%2C%20you%20can%20get%20the%20seek-able%20in-memory%20audio%20stream%2C%20which%20works%20easily%20for%20any%20downstream%20services.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId--2076447501%22%20id%3D%22toc-hId--2076451314%22%3ETell%20us%20your%20experiences!%3C%2FH1%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhether%20you%20are%20building%20a%20voice-enabled%20chatbot%20or%20IoT%20device%2C%20an%20IVR%20solution%2C%20adding%20read-aloud%20features%20to%20your%20app%2C%20converting%20e-books%20to%20audio%20books%2C%20or%20even%20adding%20Speech%20to%20a%20translation%20app%2C%20you%20can%20make%20all%20these%20experiences%20natural%20sounding%20and%20fun%20with%20Neural%20TTS.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet%20us%20know%20how%20you%20are%20using%20or%20plan%20to%20use%20Neural%20TTS%20voices%20in%20this%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fforms.office.com%2FPages%2FResponsePage.aspx%3Fid%3Dv4j5cvGGr0GRqy180BHbRx5-v_jX54tFo-eNTe-69oBUMDU3SDlVUEFCNkQyNjNXM0tOS0NQNkM2VS4u%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eform%3C%2FA%3E.%20If%20you%20prefer%2C%20you%20can%20also%20contact%20us%20at%20mstts%20%5Bat%5D%20microsoft.com.%20We%20look%20forward%20to%20hearing%20about%20your%20experience%20and%20developing%20more%20compelling%20services%20together%20with%20you%20for%20the%20developers%20around%20the%20world.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId-411065332%22%20id%3D%22toc-hId-411061519%22%3EGet%20started%3C%2FH1%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcognitive-services%2Fspeech-service%2Fget-started-text-to-speech%3Ftabs%3Dscript%252Cwindowsinstall%26amp%3Bpivots%3Dprogramming-language-csharp%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAdd%20voice%20to%20your%20app%20in%2015%20minutes%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fcognitive-services%2Ftext-to-speech%2F%3Focid%3DAID3027325%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EExplore%20the%20available%20voices%20in%20this%20demo%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcognitive-services%2Fspeech-service%2Ftutorial-voice-enable-your-bot-speech-sdk%23optional-change-the-language-and-bot-voice%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EBuild%20a%20voice-enabled%20bot%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcognitive-services%2Fspeech-service%2Fspeech-container-howto%3Ftabs%3Dntts%252Ccsharp%252Csimple-format%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EDeploy%20Azure%20TTS%20voices%20on%20prem%20with%20Speech%20Containers%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fspeech.microsoft.com%2Fcustomvoice%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EBuild%20your%20custom%20voice%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fcognitive-services%2Fspeech-services%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ELearn%20more%20about%20other%20Speech%20scenarios%3C%2FA%3E%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId--1396389131%22%20id%3D%22toc-hId--1396392944%22%3E%26nbsp%3B%3C%2FH1%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2301422%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20this%20blog%2C%20we%E2%80%99ll%20walk%20through%20an%20exercise%20which%20you%20can%20complete%20in%20under%20two%20hours%2C%20to%20get%20started%20using%20Azure%20neural%20TTS%20and%20enable%20your%20apps%20to%20read%20content%20aloud.%20We%E2%80%99ll%20provide%20high%20level%20guidance%20and%20sample%20code%20to%20get%20you%20started%2C%20and%20we%20encourage%20you%20to%20play%20around%20with%20the%20code%20and%20get%20creative%20with%20your%20solution!%3C%2FP%3E%3C%2FLINGO-TEASER%3E
Version history
Last update:
‎Apr 28 2021 11:19 PM
Updated by: