Text To Speech in SDK

Overview

External client TTS allows a client to use pre-recorded or synthesized on SDK side phrases in the dialogue graph.

Creating handler

The first thing you need to do to use external client TTS is create a handler function that takes text and voice info from #say commands as input and returns audio format and data as output.

Supported formats: wav, mp3, pcm16.

The handler must provide a TtsResponse object for each text field in the phrases section from phrasemap.json, otherwise, the job will fail to start.

Change config

In config.json file passed to app.addSessionConfig or in arguments of app.addSessionConfig (when you are using an inline version of configs) you need to change configName field to an "ExternalClient" in tts section of the configuration. This option says Dasha, that she should ask your application for audio-records instead of generation them.

Setting handler

After that all you need to do is set a created handler to a registered app via the special method.

Found a mistake? Email us, and we'll send you a free t-shirt!