# Speech Synthesis

### 1. Speech to Speech

{% hint style="info" %}
Use Case: Live translation, transcription, Intepreter, Dictation.&#x20;

Example:  Can receive speech in any of the supported languages and respond with the translation speech in other supported languages.
{% endhint %}

<mark style="color:yellow;">`POST`</mark>  `/speech`

Headers

|              |                  |
| ------------ | ---------------- |
| Content-Type | application/Json |
| apikey       | string           |
| secret       | string           |

Body

| Name         | Type                           | Description                                                                    |
| ------------ | ------------------------------ | ------------------------------------------------------------------------------ |
| speech       | {filedatabase64} or {file url} | must be .ogg, .mp3, .wav                                                       |
| inlanguage   | string                         |                                                                                |
| outlanguage  | string                         |                                                                                |
| responsetype | string                         | Can be voice, image, video or text. If you need voice and text use voice,text. |
| stream       | boolean                        |                                                                                |

{% tabs %}
{% tab title="Request" %}

```json
{
    "speech":{filedatabase64} or {file url}, 
    "inlanguage":"hausa",
    "outputlanguage":"english",
    "responsetype":"voice", 
    "stream":false
}
```

{% endtab %}

{% tab title="Response" %}

<pre class="language-json"><code class="lang-json"><strong>
</strong>{
    "status":"success",
    "content":{filedatabase64} or {file url}, //.ogg, .mp3, .wav
    "inlanguage":"hausa",
    "outputlanguage":"english",
    "responsetype":"voice", //Can be voice, image, video or text. If you need voice and text use voice,text.
    "stream":false
}
</code></pre>

{% endtab %}
{% endtabs %}

***

### 2. Speech to Text

{% hint style="info" %}
Use Case: Dictation.\
Example: Get the written transcription of speech in a language, translate it to other languages and much more.
{% endhint %}

| Name         | Value            |
| ------------ | ---------------- |
| Content-Type | application/json |
| apiKey       | string           |
| secret       | string           |

#### Body

| Name           | Type                           | Description                                                                    |
| -------------- | ------------------------------ | ------------------------------------------------------------------------------ |
| speech         | {filedatabase64} or {file url} | must be .ogg, .mp3, .wav                                                       |
| inlanguage     | string                         |                                                                                |
| outputlanguage | string                         |                                                                                |
| responsetype   | string                         | Can be voice, image, video or text. If you need voice and text use voice,text. |
| stream         | boolean                        |                                                                                |

{% tabs %}
{% tab title="Request" %}

```
{
    "speech":{filedatabase64} or {file url}, //must be .ogg, .mp3, .wav
    "inlanguage":"yoruba",
    "outputlanguage":"igbo",
    "responsetype":"text", //Can be voice, image, video or text. If you need voice and text use voice,text
    "stream":false
}

```

{% endtab %}

{% tab title="Response" %}

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://safidocs.insolify.com/speech-synthesis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
