> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gistmag.co.uk/llms.txt
> Use this file to discover all available pages before exploring further.

# Text-to-Speech Overview

> Introduction to the Text-to-Speech API

## Overview

The GistMag Text-to-Speech API converts text into natural-sounding speech using **Google Cloud Text-to-Speech**. It also provides Speech-to-Text transcription using **OpenAI Whisper API**. The API supports multiple languages, multiple voices, streaming, background music, and high-quality audio transcription.

## Features

<Columns cols={3}>
  <Card title="Basic TTS" icon="microphone" href="/api-reference/tts/basic">
    Convert text to speech with a simple API call
  </Card>

  <Card title="Streaming" icon="waveform" href="/api-reference/tts/stream">
    Stream audio in real-time as it's generated
  </Card>

  <Card title="Batch Processing" icon="layers" href="/api-reference/tts/batch">
    Process long text in batches with pauses
  </Card>

  <Card title="With Music" icon="music" href="/api-reference/tts/with-music">
    Generate speech with background music
  </Card>

  <Card title="Speech-to-Text" icon="file-text" href="/api-reference/tts/stt">
    Transcribe audio files to text
  </Card>

  <Card title="Change Speed" icon="gauge" href="/api-reference/tts/change-voice">
    Adjust playback speed of audio files
  </Card>

  <Card title="Add Music" icon="headphones" href="/api-reference/tts/add-music">
    Add background music to existing audio
  </Card>

  <Card title="Voices" icon="user" href="/api-reference/tts/voices">
    Browse and select from Google Cloud voices
  </Card>

  <Card title="Languages" icon="globe" href="/api-reference/tts/languages">
    List all supported languages
  </Card>
</Columns>

## Supported Languages

The TTS API supports multiple languages, including:

* English (en)
* Spanish (es)
* French (fr)
* German (de)
* Italian (it)
* Portuguese (pt)
* Japanese (ja)
* Korean (ko)
* Chinese (zh)

## Audio Formats

* **Input**: Text (plain string)
* **Output**: WAV (uncompressed) or MP3 (compressed) audio files
* **Streaming**: MP3 format for efficient streaming

## Engines

### Text-to-Speech

The API uses **Google Cloud Text-to-Speech** for TTS, which provides:

* High-quality, natural-sounding speech
* Multiple neural voices per language
* Control over speaking rate, pitch, and volume
* Fast, scalable generation with Google Cloud infrastructure

### Speech-to-Text

The API uses **OpenAI Whisper API** for STT, which provides:

* High-accuracy transcription with automatic language detection
* Support for many audio formats (MP3, WAV, M4A, FLAC, OGG, etc.)
* Multi-language support with automatic language detection
* Robust handling of various accents and audio qualities

## Quick Start

```bash theme={null}
curl -X POST https://api.gistmag.co.uk/tts \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello, this is a test of the text-to-speech API.",
    "language": "en",
    "api_key": "your_api_key_here"
  }'
```

The response will be an audio file that you can download or play directly.
