How to Generate Synthetic Speech for ML Datasets?

By 2Tiger editorial team · Updated 2026-11-19

This page outlines the technical workflow for generating labeled synthetic speech datasets using the LinguaForge API. It covers text volume estimation, voice diversity, and language coverage for machine learning pipelines. You will learn how to configure parameters, manage large inputs, and optimize output formats for training efficiency.

Designed for indie developers and data engineers, the guide details API integration, rate limit handling, and quality assurance. It includes concrete examples for cURL and Python, explaining character limits, audio concatenation, and watermark verification. The content focuses on practical steps to build consistent, cost-effective synthetic audio corpora.

How to Generate Synthetic Speech for ML Datasets?

Frequently asked questions

What is synthetic speech?

Synthetic speech is audio generated by a text-to-speech API. Our cloud service accepts text and returns an audio file. Each file carries an inaudible watermark marking it as synthetic. This allows automated pipelines to distinguish generated audio from human recordings during dataset processing.

Why use synthetic data for ML?

Synthetic data accelerates machine learning training by providing consistent, labeled audio corpora. Our API delivers uniform voices across thousands of samples. This consistency improves model performance by reducing acoustic variability. The inaudible watermark helps filter synthetic data from real-world recordings during evaluation.

How do I choose a voice?

Select from eight presets: Aria, Nova, Luna, Sage, Felix, Milo, Atlas, or Orion. Each voice has a distinct tone, from warm narrators to deep documentaries. All voices support 23 languages. Choose based on your dataset’s required emotional tone or linguistic style.

What is the difference between tts-1 and tts-1-hd?

Both models use the same engine and price. The tts-1-hd model offers higher audio fidelity. Use tts-1 for cost-effective bulk generation. Use tts-1-hd when higher quality is required for your training samples. Both accept identical request parameters.

How accurate is the auto-language detection?

The API guesses language from the script. Latin script defaults to English. For non-English Latin text, explicitly set the language parameter. Detection is not guaranteed. Manual specification ensures correct pronunciation for your target language in the generated audio corpus.

Can I use this for commercial products?

Yes. The generated audio is returned in the response and not stored. Input text is used only for synthesis. You can integrate the audio files into your commercial products. The voices are based on licensed recordings, allowing commercial use.

What is the maximum input length?

Each request accepts up to 4096 characters. Spaces and punctuation count toward this limit. Longer texts must be split into multiple requests. Each segment generates a separate audio file that you can join later in your pipeline.

How do I handle text longer than 4096 characters?

Split your text into parts of up to 4096 characters. Send each part as a separate POST request. Receive individual audio files for each segment. Join these audio files in your application to create the complete dataset audio track.

Is the audio quality suitable for training?

Yes. The API generates clear synthetic speech with consistent quality. Voices are based on licensed recordings. The inaudible watermark identifies synthetic data. This consistency makes the audio suitable for training machine learning models requiring labeled speech data.

Do I need to credit the voices?

The voices are based on LibriTTS-R (CC BY 4.0) and LibriVox public-domain readings. While attribution is good practice, the API does not enforce specific credit formats. You may use the audio in your datasets without mandatory visible credits.

How are voices licensed?

Voices are based on LibriTTS-R, licensed under CC BY 4.0. The source material comes from LibriVox public-domain audiobook readings. This allows commercial use of the generated synthetic audio without additional licensing fees per file.

What is a synthetic watermark?

Every generated audio file contains an inaudible watermark. This mark identifies the audio as synthetic speech. It helps ML pipelines distinguish generated data from human recordings. The watermark does not affect audio quality or playback.

Can I clone a specific voice?

No. We do not offer custom voice cloning. You cannot upload your own voice or design a custom voice. You must choose from the eight available presets. Each preset speaks all 23 supported languages with consistent tone.

How do I pay for large datasets?

Pay via USDT on the TRON network (TRC-20). Minimum top-up is $5. Credits are added automatically within minutes. No invoices or VAT. Balance does not expire. Failed requests are refunded. This method supports high-volume dataset generation.

Defining Dataset Requirements

Sound wave illustration for: Defining Dataset Requirements

Generating labeled audio corpora requires precise input volume calculations to align with training pipeline capacity. With a rate limit of 60 requests per minute, throughput scales predictably based on text length. Each request supports up to 4,096 characters, allowing efficient batching of large datasets without exceeding API constraints.

Text Volume Estimation

Calculate total characters including spaces and punctuation. At $0.01 per 1,000 characters, budgeting aligns directly with input size. Split texts into 4,096-character chunks to ensure consistent processing speeds, as requests are handled sequentially under load.

  • Count all characters, including spaces and punctuation.
  • Split inputs into 4,096-character segments.
  • Account for queue delays during peak usage.

Voice Diversity Needs

Select from eight presets covering male and female ranges. Each voice offers distinct tonal characteristics suitable for different corpus types. Use consistent voice selection for uniform labeling, or vary voices to test model robustness against speaker variation.

  • Aria: warm, clear narrator.
  • Nova: bright, upbeat tone.
  • Atlas: neutral, news style.

Language Coverage Goals

Support 23 languages with full voice compatibility. Explicitly set the language parameter for Latin-script texts outside English to prevent default detection errors. Verify target languages against the supported list before batch generation.

  • Arabic, Chinese, Danish, Dutch, English.
  • French, German, Greek, Hebrew, Hindi.
  • Japanese, Korean, Malay, Norwegian, Polish.

Selecting the Appropriate Model

Sound wave illustration for: Selecting the Appropriate Model

Selecting the right model requires balancing acoustic fidelity against generation throughput. The API offers two engine variants, tts-1 and tts-1-hd, which share identical pricing and character limits but differ in output quality. Both models support the same eight voice presets and 23 languages, ensuring consistent voice diversity across your dataset.

tts-1 vs tts-1-hd

Choose tts-1 for high-volume corpus generation where processing speed is prioritized over nuance. Select tts-1-hd when precise phonetic accuracy is critical for training speech recognition models. Both engines accept the same input parameters and produce audio in the specified formats without additional configuration overhead.

  • Identical pricing: $0.01 per 1,000 characters
  • Same 8 voice presets and 23 languages
  • Supports mp3, wav, opus, flac, and pcm

Quality vs Cost Trade-offs

Since both models incur the same cost, the decision rests entirely on acoustic requirements. tts-1 provides sufficient clarity for general intent classification tasks. tts-1-hd reduces artifacts in complex phoneme sequences, making it suitable for fine-grained phoneme-level labeling.

Performance Benchmarks

Generation speed averages roughly real-time, producing approximately 25 characters of text per second. Requests are processed sequentially; under heavy load, queuing may introduce latency. Failed requests incur no charge, ensuring efficient cost tracking regardless of model selection.

  • Typical speed: ~25 characters per second
  • Sequential processing with potential queue delays
  • Failed requests are free

Configuring Voice Parameters

Sound wave illustration for: Configuring Voice Parameters

To build diverse corpora, select from eight preset voices spanning male and female ranges. Options include aria for clear narration, nova for upbeat content, or atlas for neutral news delivery. Each voice supports all 23 languages, allowing you to mix speakers across regions without additional configuration.

Gender and Tone Selection

Choose voices based on their specific tonal characteristics: sage offers calm instruction, while felix provides energetic promo delivery. Orion suits documentary styles with its deep tone, and luna excels in soft storytelling. Since any voice can speak any supported language, you can assign specific tones to different data segments to increase dataset variety.

  • Aria: warm, clear narrator
  • Nova: bright, upbeat
  • Luna: soft, storytelling
  • Sage: calm, instructional
  • Felix: energetic, promo
  • Milo: friendly, conversational
  • Atlas: neutral, news
  • Orion: deep, documentary

Speed Adjustment

Adjust the speed parameter between 0.25 and 4.0 to match your target audio duration. Slower speeds improve clarity for complex phonetic data, while faster rates reduce generation time for large-scale labeling. Requests are processed sequentially, so higher speeds may queue if load is high.

Consistency Management

Ensure consistent audio characteristics by locking the voice and model parameters across your generation pipeline. Using the same voice ID prevents tonal drift between files. Note that generated files include an inaudible watermark, allowing you to verify synthetic origin without compromising dataset integrity.

Processing Large Text Inputs

Sound wave illustration for: Processing Large Text Inputs

Generating labeled audio corpora often requires processing text blocks that exceed the API's 4096-character limit per request. To maintain workflow integrity, texts must be programmatically split into valid segments before submission, ensuring no data loss during the synthesis phase.

The API processes requests sequentially, which can introduce queue delays under load. Splitting large inputs into smaller, manageable chunks allows for efficient batching and predictable latency, keeping generation times aligned with real-time expectations for most use cases.

Splitting Strategies

Divide input text into segments of up to 4096 characters, including spaces and punctuation. This ensures each request fits the strict character limit defined in the API specification.

Use simple string slicing or regex-based sentence boundary detection to preserve logical context within each chunk. Split text into segments of up to 4096 characters.

  • Max 4096 characters per request
  • Include spaces and punctuation in count
  • Preserve logical sentence boundaries

Character Limit Handling

Each request is capped at 4096 characters. Exceeding this limit will result in a failed request, which remains free of charge.

Monitor character counts carefully, especially when processing dense technical documentation or multilingual texts with varying character widths.

Audio Concatenation

After receiving audio files for each split segment, concatenate them in the original order to reconstruct the full narration. This method reconstructs the full narration from individual audio files.

Ensure consistent speed and voice parameters across all segments to prevent audible artifacts during concatenation.

Optimizing Output Formats

Sound wave illustration for: Optimizing Output Formats

Selecting the correct output format is critical for balancing storage efficiency and data integrity in ML training pipelines. The API supports mp3, wav, opus, flac, and pcm, allowing developers to choose based on whether they prioritize compression, lossless fidelity, or raw stream processing.

MP3 for General Use

MP3 offers efficient compression suitable for general-purpose speech recognition models. It reduces storage costs significantly compared to uncompressed formats, making it ideal for large-scale corpus generation where bandwidth and disk space are primary constraints.

  • Supported via standard response_format: mp3 parameter
  • Best for ASR training with noise-tolerant models

FLAC for Lossless Training

FLAC provides lossless compression, preserving the exact digital signal without data loss. This format is optimal for high-fidelity training datasets where preserving subtle phonetic details is crucial, ensuring the synthetic speech matches the source quality precisely without encoding degradation.

  • Use response_format: flac for zero-loss storage
  • Ideal for sensitive acoustic feature extraction

PCM for Raw Processing

PCM returns raw uncompressed audio samples, eliminating the need for decoding steps during pipeline ingestion. This format is suitable for processing tools that expect raw byte streams.

  • Use response_format: pcm for raw byte access
  • Eliminates decoding overhead in processing pipelines

Integrating with Data Pipelines

Sound wave illustration for: Integrating with Data Pipelines

Integrating LinguaForge into ML pipelines requires automating request submission to handle the volume needed for labeled corpora. Using the standard OpenAI-compatible SDK or direct HTTP calls allows developers to queue synthesis tasks efficiently, ensuring consistent throughput for training data generation.

Proper integration also involves managing rate limits and tracking character usage. Requests are processed sequentially; queuing mechanisms prevent overload and ensure that each audio file is generated reliably without exceeding the 60 requests per minute limit per key.

Automated Request Queues

Use a background worker to submit texts in batches. This ensures steady utilization of the 60 requests per minute limit without manual intervention.

Implement exponential backoff for retries to handle transient network issues or queue delays during high demand periods.

  • Queue texts by language and voice preset to maintain consistency.
  • Monitor queue depth to adjust concurrency levels dynamically.

Error Handling Scripts

Check the HTTP status code and response body for each request. Failed requests are free, so no credit is lost on errors.

Log the input text, voice, and timestamp for every request to facilitate debugging and billing reconciliation.

  • Retry failed requests up to three times with increasing delays.
  • Discard requests exceeding the 4096 character limit before submission.

Metadata Tagging

Attach relevant metadata to each audio file, such as the voice preset, speed, and language code used during synthesis.

Include the request timestamp and character count to track generation costs and performance metrics accurately.

  • Tag files with the specific model (tts-1 or tts-1-hd) used.
  • Ensure metadata aligns with your dataset labeling schema for easy filtering.

Validating Synthetic Audio

Sound wave illustration for: Validating Synthetic Audio

Validation ensures generated audio meets pipeline standards before ingestion. Synthetic speech requires verification against character limits and format specifications to prevent training data corruption.

Quality Assurance Checks

Verify audio integrity by checking file headers and sample rates. Ensure each segment matches the expected response format (mp3, wav, opus, flac, pcm). Confirm that split segments join to reconstruct the original text.

  • Check file size matches expected duration
  • Verify codec compatibility with training tools

Watermark Verification

Every generated file carries an inaudible watermark marking it as synthetic speech. Include this verification step in your pipeline to distinguish synthetic data from human-recorded corpus elements during model training.

  • Detect synthetic origin automatically
  • Prevent data contamination

Latency Monitoring

Monitor request processing time. Short phrases take a few seconds; longer texts generate at roughly real-time speed (25 characters per second). Under load, requests may queue, so track wait times to adjust batch sizes accordingly.

  • Track generation duration
  • Adjust batch size for throughput
Validating Synthetic Audio

Scaling Generation Workflows

Sound wave illustration for: Scaling Generation Workflows

Scaling synthetic speech generation requires managing the 60 requests-per-minute rate limit efficiently. By distributing load across concurrent connections, you can maintain steady throughput without exceeding the cap, ensuring continuous data production for your ML pipelines.

Parallel Request Handling

Use multiple concurrent HTTP connections to maximize utilization of the 60 requests/minute allowance. Since requests are processed sequentially, parallel client-side handling prevents idle time between batches, keeping the generation pipeline active.

Rate Limit Optimization

The initial limit is 10 requests/minute until the first top-up is processed. After funding, the limit increases to 60 requests/minute. Monitor your key’s status to avoid 429 errors, which do not incur charges but delay production.

  • Avoid exceeding 60 requests/minute to prevent temporary throttling.
  • New keys start with a 10 requests/minute limit.
  • Failed requests do not consume quota or balance.

Cost Tracking

Costs are strictly proportional to character count at $0.01 per 1,000 characters. Track input length before submitting to predict expenses accurately. Unused balance does not expire, allowing you to accumulate credits from bulk TRC-20 transfers for large-scale dataset projects.

Troubleshooting Common Issues

Sound wave illustration for: Troubleshooting Common Issues

Synthetic speech generation for ML datasets requires handling common pipeline failures efficiently. Understanding failure modes and resolution steps ensures consistent data quality without interrupting large-scale training workflows.

Issues typically fall into three categories: request failures, language misidentification, or audio artifacts. Addressing these systematically maintains dataset integrity and reduces manual review overhead.

Failed Synthesis Requests

Requests may fail due to rate limits or server load. Failed requests incur no charge, so retrying is cost-free. Monitor the response status to distinguish between transient errors and permanent failures.

If a request exceeds the 60 requests per minute limit, queue subsequent calls. Use exponential backoff to avoid overwhelming the endpoint during peak generation periods.

  • Check Authorization header validity if 401 errors occur.
  • Retry failed requests immediately; they are free.
  • Monitor rate limit headers to adjust queue speed.

Language Detection Errors

When the language field is omitted, the system guesses based on script. Latin-script text defaults to English, which causes errors for other Latin-based languages like Dutch or Swedish.

Always specify the language ISO code for non-English Latin text to ensure correct phoneme generation. This prevents accent mismatches in labeled corpora.

  • Set language explicitly for all non-English Latin inputs.
  • Verify output audio matches the intended language script.
  • Use known language codes from the supported list.

Audio Artifacts

Concatenating split audio parts reconstructs the full narration seamlessly. However, rapid speed changes or extreme voice presets may introduce slight artifacts at segment boundaries.

Use FLAC format to preserve audio fidelity during splitting. Validate concatenated files by listening for gaps or pitch shifts before adding them to your training set.

  • Use FLAC for lossless quality during splitting.
  • Validate concatenated files for pitch consistency.
  • Avoid speed settings outside 0.25–4.0 range.

Best Practices for Labeling

Sound wave illustration for: Best Practices for Labeling

Consistent labeling ensures that synthetic audio corpora remain machine-readable and easily searchable during training. Metadata fields must strictly define the source voice, language code, and generation parameters for every audio file.

Accurate attribution prevents data contamination. Each file should explicitly state which of the eight preset voices was used, ensuring models can learn voice-specific features without ambiguity.

Metadata Consistency

Standardize your JSON schemas to include character counts, speed settings, and response format. This ensures reproducibility when re-running synthesis jobs or debugging model inputs.

Include the specific voice identifier (e.g., aria, milo) and language code in every filename or sidecar metadata file to prevent mix-ups during dataset assembly.

  • Use ISO 639-1 language codes.
  • Record exact speed multipliers used.
  • Log character count per segment.

Voice Attribution

Explicitly tag each audio segment with its source voice preset. This allows ML pipelines to isolate voice-specific acoustic properties or train voice-agnostic models.

Since all outputs carry an inaudible watermark, you can verify synthetic origin programmatically, but explicit metadata is still required for dataset documentation.

  • Tag with preset name (e.g., 'nova').
  • Note voice preset name.
  • Link to generation timestamp.

Version Control

Track which model version generated the audio, even if using the same engine name. Update your labeling schema when new voices or formats are added.

Maintain a manifest file that maps audio IDs to their exact API request parameters, enabling precise replication of the dataset for future model training runs.

  • Record API request payload.
  • Store audio file hash.
  • Update schema on voice changes.

image

Example API Requests

Sound wave illustration for: Example API Requests

The API accepts standard JSON payloads via POST requests. Below are concrete examples for generating synthetic speech using different tools and formats.

All requests require a Bearer token and adhere to the 4096-character limit per input string.

cURL Command Example

Use this command to generate audio directly from the terminal.

Replace YOUR_API_KEY with your active credential.

  • curl -X POST https://api.2tiger.info/v1/audio/speech
  • -H "Authorization: Bearer YOUR_API_KEY"
  • -H "Content-Type: application/json"
  • `-d '{"model": "tts-1", "input": "Data generation example", "voice": "nova", "response_format": "mp3"}'`

Python SDK Snippet

The OpenAI SDK works by changing the base URL.

Install the package via pip install openai.

  • import openai
  • client = openai.OpenAI(base_url="https://api.2tiger.info/v1", api_key="YOUR_API_KEY")
  • `response = client.audio.speech.create(model="tts-1", voice="sage", input="ML dataset sample", response_format="wav")`
  • response.stream_to_file("output.wav")

JSON Payload Structure

The request body must contain the model, input text, voice preset, and desired response format.

Optional fields include speed (0.25–4.0) and language (ISO code).

  • model: "tts-1" or "tts-1-hd"`
  • input: "Your text here"`
  • voice: "aria", "nova", "luna", "sage", "felix", "milo", "atlas", or "orion"`
  • response_format: "mp3", "wav", "opus", "flac", or "pcm"`

Future-Proofing Your Dataset

Sound wave illustration for: Future-Proofing Your Dataset

Ensuring long-term usability requires aligning your synthetic audio corpus with evolving infrastructure standards. As machine learning pipelines migrate toward more efficient processing, maintaining format consistency reduces downstream friction during model training.

Voice Library Updates

LinguaForge maintains eight consistent synthetic voices derived from licensed and public-domain sources. While the core set remains stable, monitoring the /v1/voices endpoint ensures you capture any adjustments to voice metadata or availability without disrupting your labeling schema.

Model Upgrades

The API offers two engine variants: tts-1 and tts-1-hd. Both share identical request structures, allowing seamless transitions between models. Upgrading to the higher-definition variant improves audio fidelity for training data without requiring changes to your integration code or base URL configuration.

Format Standardization

Standardizing on lossless formats like FLAC or raw PCM preserves spectral details critical for high-performance acoustic models. MP3 introduces compression artifacts that may degrade training quality. Choose one format and apply it uniformly across all generated corpora to ensure consistent input dimensions for your algorithms.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Balance key issuance with throughput needs, as each key has a fixed rate limit.

Avatar of the voice aria
ariafemale
Avatar of the voice nova
novafemale
Avatar of the voice luna
lunafemale
Avatar of the voice sage
sagefemale
Avatar of the voice felix
felixmale
Avatar of the voice milo
milomale
Avatar of the voice atlas
atlasmale
Avatar of the voice orion
orionmale

23 languages

Any voice speaks any of these languages.

Sources and further reading

  1. Wikipedia
  2. Tether (USDT)
  3. TRON developer hub: TRC-20
  4. Python documentation
  5. MDN: Web Speech API
  6. FFmpeg documentation
  7. LibriTTS-R corpus (OpenSLR 141)
  8. ISO 639 language codes
  9. openai-python on GitHub
  10. Creative Commons Attribution 4.0
  11. Node.js documentation
  12. OpenAI API reference: create speech

More on this site