# Text to speech converter (`akash9078/advanced-text-to-speech`)

Professional-grade Text-to-Speech (TTS) actor powered by advanced AI models. Convert any text into natural, human-like speech with 50+ premium voices across 9 languages. Perfect for content creation, accessibility, voiceovers, audiobooks, podcasts, and multilingual applications.

- **URL**: https://beta-securitybyobscurity.apify.com/akash9078/advanced-text-to-speech.md
- **Developed by:** [Akash Kumar Naik](https://beta-securitybyobscurity.apify.com/akash9078) (community)
- **Categories:** AI, Automation, Social media
- **Stats:** 4 total users, 2 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

$10.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.
You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#rental-actors

# README

## Advanced Text-to-Speech Generator

Professional-grade Text-to-Speech (TTS) actor powered by advanced AI models. Convert any text into natural, human-like speech with 50+ premium voices across 9 languages. Perfect for content creation, accessibility, voiceovers, audiobooks, podcasts, and multilingual applications.

### ✨ Key Features

- **🌍 Multi-language support**: English (US/UK), Spanish, French, Hindi, Italian, Portuguese, Japanese, Chinese
- **🎙️ 50+ premium voices**: Professional-quality male and female voices across different languages
- **⚡ Optimized performance**: Pre-loaded models for fast startup and reliable processing
- **🚀 GPU acceleration**: Automatically uses CUDA when available for faster generation
- **📝 Smart text processing**: Handles long texts efficiently with automatic chunking
- **🎛️ Flexible speed control**: Adjustable speech speed from 0.1x to 3.0x
- **🔧 Voice validation**: Automatically selects appropriate voices for each language
- **📊 Detailed metrics**: Provides audio duration, file size, and performance data

### 📋 Input Configuration

| Parameter | Type | Description | Default |
|-----------|------|-------------|---------|
| `text` | string | Text to convert to speech (required) | - |
| `voice` | string | Premium voice for synthesis | `af_heart` |
| `lang` | string | Language code for text processing | `en-us` |
| `speed` | string | Speech speed multiplier (0.1-3.0) | `1.0` |

### 🎭 Voice Selection

#### English (US/GB) - Premium Voices

- **Female**: af\_alloy, af\_aoede, af\_bella, af\_heart, af\_jessica, af\_kore, af\_nicole, af\_nova, af\_river, af\_sarah, af\_sky, bf\_alice, bf\_emma, bf\_isabella, bf\_lily
- **Male**: am\_adam, am\_echo, am\_eric, am\_fenrir, am\_liam, am\_michael, am\_onyx, am\_puck, am\_santa, bm\_daniel, bm\_fable, bm\_george, bm\_lewis

#### International Languages

- **Spanish**: am\_santa, ef\_dora, em\_alex, em\_santa, pf\_dora, pm\_alex, pm\_santa
- **French**: ff\_siwis
- **Hindi**: hf\_alpha, hf\_beta, hm\_omega, hm\_psi
- **Italian**: if\_sara, im\_nicola
- **Portuguese**: pf\_dora, pm\_alex, pm\_santa
- **Japanese**: jf\_alpha, jf\_gongitsune, jf\_nezumi, jf\_tebukuro, jm\_kumo
- **Chinese**: zf\_xiaobei, zf\_xiaoni, zf\_xiaoxiao, zf\_xiaoyi, zm\_yunjian, zm\_yunxi, zm\_yunxia, zm\_yunyang

### 💡 Usage Examples

#### Basic Text-to-Speech

```json
{
  "text": "Welcome to our advanced text-to-speech system. Experience natural, human-like voice generation.",
  "voice": "af_heart",
  "lang": "en-us",
  "speed": "1.0"
}
```

#### Multilingual Content

```json
{
  "text": "Bonjour et bienvenue dans notre système de synthèse vocale avancé.",
  "voice": "ff_siwis", 
  "lang": "fr-fr",
  "speed": "1.2"
}
```

#### Professional Voiceover

```json
{
  "text": "Create professional voiceovers and audiobooks with our premium AI voices. Perfect for content creators, educators, and businesses.",
  "voice": "am_adam",
  "lang": "en-us", 
  "speed": "0.9"
}
```

#### Podcast Generation

```json
{
  "text": "Generate high-quality podcast content with natural speech patterns and professional audio quality.",
  "voice": "bf_alice",
  "lang": "en-gb",
  "speed": "1.1"
}
```

### 📤 Output Data

The actor generates comprehensive output including:

- **Audio file**: High-quality WAV format (24kHz sample rate)
- **Performance metrics**: Processing time, pipeline initialization time
- **Audio metadata**: Duration, file size, format details
- **Configuration data**: Voice used, language, speed settings
- **Public URL**: Direct access to generated audio file

### 🔧 Technical Specifications

- **Sample rate**: 24,000 Hz (professional quality)
- **Audio format**: WAV (uncompressed, broadcast quality)
- **Processing**: Optimized GPU acceleration with CPU fallback
- **Memory optimization**: Intelligent text chunking for large inputs
- **Startup time**: ~2 seconds (pre-loaded models)
- **Reliability**: 100% uptime with comprehensive error handling

### 🎯 Use Cases

#### Content Creation

- **YouTube videos**: Generate professional narration and voiceovers
- **Podcasts**: Create consistent voice content across episodes
- **Social media**: Add voice to text-based content
- **Marketing**: Professional promotional audio content

#### Accessibility

- **Website accessibility**: Convert text content to audio
- **Educational content**: Make learning materials more accessible
- **Document reading**: Convert written documents to speech
- **Visual impairment support**: Text-to-speech for better accessibility

#### Business Applications

- **Training materials**: Convert training documents to audio
- **Customer service**: Automated voice responses
- **Presentations**: Professional presentation narration
- **Audiobooks**: Convert written content to spoken format

#### Multilingual Projects

- **Global content**: Create content in multiple languages
- **Language learning**: Practice pronunciation and listening
- **International marketing**: Localized voice content
- **Translation support**: Audio output for translated content

### ⚡ Performance Optimizations

- **Pre-loaded models**: Eliminates download time during runtime
- **Voice caching**: Optimized loading for common voices
- **Smart chunking**: Efficient processing of long texts
- **GPU utilization**: Automatic acceleration when available
- **Memory management**: Optimized resource usage

### 🔍 SEO Keywords

**Primary**: text-to-speech, TTS, voice synthesis, speech generation, AI voice
**Secondary**: voiceover, audiobook, content creation, accessibility, multilingual TTS
**Long-tail**: professional text-to-speech generator, AI voice synthesis tool, multilingual speech generation

# Actor input Schema

## `text` (type: `string`):

The text you want to convert to speech. Supports multiple languages and long texts will be automatically chunked for optimal processing.

## `voice` (type: `string`):

Select a premium voice for the specified language. Each language has specific high-quality voices available.

## `lang` (type: `string`):

Language code for the text. This determines which voices are available and how the text is processed for optimal pronunciation.

## `speed` (type: `string`):

Speed multiplier for the speech. 1.0 is normal speed, 0.5 is half speed, 2.0 is double speed. Valid range: 0.1-3.0

## Actor input object example

```json
{
  "text": "Hello! This is a demonstration of our advanced text-to-speech system. The system supports multiple languages and premium voices for professional-quality audio generation.",
  "voice": "af_heart",
  "lang": "en-us",
  "speed": "1.0"
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "text": "Hello! This is a demonstration of our advanced text-to-speech system. The system supports multiple languages and premium voices for professional-quality audio generation.",
    "voice": "af_heart"
};

// Run the Actor and wait for it to finish
const run = await client.actor("akash9078/advanced-text-to-speech").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "text": "Hello! This is a demonstration of our advanced text-to-speech system. The system supports multiple languages and premium voices for professional-quality audio generation.",
    "voice": "af_heart",
}

# Run the Actor and wait for it to finish
run = client.actor("akash9078/advanced-text-to-speech").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "text": "Hello! This is a demonstration of our advanced text-to-speech system. The system supports multiple languages and premium voices for professional-quality audio generation.",
  "voice": "af_heart"
}' |
apify call akash9078/advanced-text-to-speech --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=akash9078/advanced-text-to-speech",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Text to speech converter",
        "description": "Professional-grade Text-to-Speech (TTS) actor powered by advanced AI models. Convert any text into natural, human-like speech with 50+ premium voices across 9 languages. Perfect for content creation, accessibility, voiceovers, audiobooks, podcasts, and multilingual applications.",
        "version": "2.0",
        "x-build-id": "MO5AFN8E7IfcrvAjc"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/akash9078~advanced-text-to-speech/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-akash9078-advanced-text-to-speech",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/akash9078~advanced-text-to-speech/runs": {
            "post": {
                "operationId": "runs-sync-akash9078-advanced-text-to-speech",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/akash9078~advanced-text-to-speech/run-sync": {
            "post": {
                "operationId": "run-sync-akash9078-advanced-text-to-speech",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "text"
                ],
                "properties": {
                    "text": {
                        "title": "Text to synthesize",
                        "type": "string",
                        "description": "The text you want to convert to speech. Supports multiple languages and long texts will be automatically chunked for optimal processing."
                    },
                    "voice": {
                        "title": "Voice",
                        "enum": [
                            "af_alloy",
                            "af_aoede",
                            "af_bella",
                            "af_heart",
                            "af_jessica",
                            "af_kore",
                            "af_nicole",
                            "af_nova",
                            "af_river",
                            "af_sarah",
                            "af_sky",
                            "am_adam",
                            "am_echo",
                            "am_eric",
                            "am_fenrir",
                            "am_liam",
                            "am_michael",
                            "am_onyx",
                            "am_puck",
                            "am_santa",
                            "bf_alice",
                            "bf_emma",
                            "bf_isabella",
                            "bf_lily",
                            "bm_daniel",
                            "bm_fable",
                            "bm_george",
                            "bm_lewis",
                            "ef_dora",
                            "em_alex",
                            "em_santa",
                            "ff_siwis",
                            "hf_alpha",
                            "hf_beta",
                            "hm_omega",
                            "hm_psi",
                            "if_sara",
                            "im_nicola",
                            "jf_alpha",
                            "jf_gongitsune",
                            "jf_nezumi",
                            "jf_tebukuro",
                            "jm_kumo",
                            "pf_dora",
                            "pm_alex",
                            "pm_santa",
                            "zf_xiaobei",
                            "zf_xiaoni",
                            "zf_xiaoxiao",
                            "zf_xiaoyi",
                            "zm_yunjian",
                            "zm_yunxi",
                            "zm_yunxia",
                            "zm_yunyang"
                        ],
                        "type": "string",
                        "description": "Select a premium voice for the specified language. Each language has specific high-quality voices available.",
                        "default": "af_heart"
                    },
                    "lang": {
                        "title": "Language",
                        "enum": [
                            "en-us",
                            "en-gb",
                            "es",
                            "fr-fr",
                            "hi",
                            "it",
                            "pt-br",
                            "ja",
                            "zh"
                        ],
                        "type": "string",
                        "description": "Language code for the text. This determines which voices are available and how the text is processed for optimal pronunciation.",
                        "default": "en-us"
                    },
                    "speed": {
                        "title": "Speech speed",
                        "pattern": "^[0-3](?:\\.[0-9])?$|^0\\.[1-9]$",
                        "type": "string",
                        "description": "Speed multiplier for the speech. 1.0 is normal speed, 0.5 is half speed, 2.0 is double speed. Valid range: 0.1-3.0",
                        "default": "1.0"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
