# ASR and TTS

## Supported Languages

* English
* French
* German
* Italian
* Japanese
* Danish
* Dutch
* Norwegian&#x20;
* Spanish
* Swedish
* Russian

The chat interface also has some i18n added that will change some of the labels used in Leopard to be shown in the respective language. It doesn't have full coverage of every area available in Leopards UI but it does cover the main bases.  The file used to control the labels is located in `\src\constants\translations.js`

{% hint style="warning" %}
[**ASR and TTS**](https://jolzee.gitbook.io/leopard/configuration/asr-and-tts) utilizes the [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API) through the use of the [Artyom.js](https://sdkcarlos.github.io/sites/artyom.html) library.  You will only reliably be able to use both ASR and TTS in a **Chrome Browser**.
{% endhint %}

<div align="left"><img src="https://4062709520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-La71Iy76rotlqbCOWoQ%2F-LaHK_ms-NSFKa9FlEgR%2F-LaHLc-BkH8nv77xBS9t%2Ffrench.jpg?alt=media&#x26;token=edb3cd5e-87e4-41c2-afbc-6b6c40ed6e31" alt=""></div>

## Configuration

In Leopard Chat Configuration UI each solution has a configuration option to change the language of the solution it's expecting to interact with. This setting also sets the ASR and TTS to be configured that respective language.

<div align="left"><img src="https://4062709520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-La71Iy76rotlqbCOWoQ%2F-M7TrUKhSgsBFbAETu3-%2F-M7Ts7ie_sm4jOEbvPsW%2Flocale.png?alt=media&#x26;token=142ad1fa-9992-4388-82f9-a34e26a22711" alt=""></div>

## Enable in Chat UI

&#x20;There are a few options of toggling the use of both ASR and TTS.&#x20;

* Long click on any Teneo response icon&#x20;
* Long click on the `>>` chevron or microphone icon when it's activated
* `CTL+ALT+/` or `CTL+ALT+DOWNARROW`

## Capturing Audio

&#x20;Capture audio through ASR can be done by **clicking on the microphone button** or through shortcuts:

* `CTL+ALT+UPARROW` or `CTL+ALT+.`

<div align="left"><img src="https://4062709520-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-La71Iy76rotlqbCOWoQ%2F-LaHK6nzuvNYrDT2sO_1%2F-LaHKBpGV2Unulg0BFii%2Fasr.jpg?alt=media&#x26;token=c7b5264c-3a2d-4842-ada6-871e49b8e3c6" alt="ASR capture"></div>

## Cancel Audio Capture or TTS

Useful in the following scenarios:&#x20;

* You might become tired of hearing long TTS responses or someone you're demoing to might have a question mid way through a response
* You might stutter during a ASR input and want to cancel it before it gets sent to Teneo

Cancelling both ASR input and TTS response can be done with hitting `ESC`

## ASR Corrections

Depending on the CAI use case you might find that the ASR badly transcribes some user inputs. For obvious and repeatable issues there is a corrections file in the code base that will be referenced for every ASR user input.

The file is located in  `\src\constants\asr-corrections.js` and contains a case insensitive search and replace array of arrays.

{% code title="\src\constants\asr-corrections.js" %}

```javascript
export const ASR_CORRECTIONS = [
    ["replacethis", "with this"], 
    ["apparantly", "apparently"],
    [". coke", "diet coke"]
];
```

{% endcode %}

{% hint style="info" %}
You can also define ASR transcription corrections at a solution configuration level. Edit a solution in the Leopard config area and there a field that allows you to define the corrections.
{% endhint %}

## TTS Override

It's quite common that you might want to have the TTS speak back a shorter response than what's displayed in the answer text.&#x20;

You can tell Leopard to speak back a specific string of text by adding the following output parameter to any output node.

```
tts = Speak this instead of what's in the answer text
```
