AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

Automating Text-to-Speech and Multi-Track WAV Stems with the Lovo.ai API

Samuel Liu · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

Building an automated voiceover pipeline for games, animations, or localized video series usually hits a wall when platforms treat audio as a flattened, single-speaker gimmick. At 365Finds, we look for developer tools that fit into real production environments. If you are producing dialogue with multiple characters, sound designers do not want a single mixed MP3 file; they need clean, uncompressed multi-track WAV stems aligned to a timeline.

Lovo.ai exposes this capability through its Genny REST API (https://api.genny.lovo.ai/api/v1). The API does not provide a one-click magic DAW stem export button, but its asynchronous text-to-speech architecture lets you orchestrate character lines, control emotional prosody, and programmatically assemble time-aligned broadcast-grade WAV stems.

Here is how to set up the workflow, query voices, dispatch asynchronous rendering jobs, and package independent vocal stems for your audio pipeline.


1. Authentication and Speaker Discovery

Every request to the Genny API requires an API key passed in the X-API-KEY header. You can obtain this key from your account settings inside the Genny studio interface.

Before synthesizing speech, query the speaker library to fetch available voice models, supported locales, and emotional styles:

curl -X GET "https://api.genny.lovo.ai/api/v1/speakers" \
     -H "X-API-KEY: your_api_key_here" \
     -H "Accept: application/json"

The response returns a collection of speaker records containing their unique identifier (id), display name, supported languages, and available speakerStyles (such as neutral, happy, sad, or serious).

At 365Finds, we recommend caching this speaker manifest in your build tool or database. Querying the endpoint dynamically on every generation call adds unnecessary latency to automated CI/CD audio jobs.


2. Choosing Between Sync and Async Generation

Lovo.ai provides two generation endpoints:

For production pipelines producing entire scenes or dialogues, always use the asynchronous endpoint. Synchronous calls can block or timeout when processing long segments, complex emotional styles, or during peak queue loads.


3. Dispatching Asynchronous Voice Jobs with Style Controls

The asynchronous endpoint accepts parameters to define the voice ID, text script, playback speed, and specific emotion style:

POST /api/v1/tts
Host: api.genny.lovo.ai
X-API-KEY: your_api_key_here
Content-Type: application/json

{
  "speaker": "6032d8927d5328001d8e1f5d",
  "text": "System alert: Reactor core temperature exceeding baseline parameters.",
  "speakerStyle": "serious",
  "speed": 1.1
}

The server responds immediately with a tracking object:

{
  "id": "643e383551e2730025c5ae69",
  "status": "queued"
}

Polling for Completion

Poll GET /api/v1/tts/{jobId} until the job status resolves to completed:

{
  "id": "643e383551e2730025c5ae69",
  "type": "tts",
  "status": "completed",
  "audioUrl": "https://audiostorage.genny.lovo.ai/results/643e383551e2730025c5ae69.wav",
  "duration": 3.8
}

Keep in mind that the temporary download URL provided in audioUrl expires in 24 hours. Your automated pipeline must download and persist the audio file to your local asset storage or cloud bucket immediately.


4. Orchestrating Multi-Track WAV Stems

In game engines like Unreal Engine and Unity, or DAWs like Reaper and Pro Tools, dialogue tracks are structured as independent stems per character.

To automate this, define a dialogue manifest containing character assignments, cue timecodes, and speech parameters. Then, dispatch jobs concurrently and align the resulting WAV files onto a common timeline.

Dialogue Manifest (scene_01.json)

[
  {
    "track": "narrator",
    "speakerId": "6032d8927d5328001d8e1f5d",
    "startTime": 0.0,
    "speed": 1.0,
    "style": "neutral",
    "text": "Deep beneath Sector 4, the primary relay went dark."
  },
  {
    "track": "technician",
    "speakerId": "61b3cd528d227b001ef76391",
    "startTime": 3.5,
    "speed": 1.15,
    "style": "panicked",
    "text": "Relay offline! Manual override is not responding!"
  }
]

Automation Script (Python)

The following script dispatches generation requests for each dialogue block, polls for completion, downloads the lossless WAV audio, and creates track-specific directories:

import os
import time
import requests

API_KEY = os.getenv("LOVO_API_KEY")
BASE_URL = "https://api.genny.lovo.ai/api/v1"
HEADERS = {
    "X-API-KEY": API_KEY,
    "Content-Type": "application/json"
}

def dispatch_tts(speaker_id, text, speed=1.0, style=None):
    payload = {
        "speaker": speaker_id,
        "text": text,
        "speed": speed
    }
    if style:
        payload["speakerStyle"] = style

    res = requests.post(f"{BASE_URL}/tts", headers=HEADERS, json=payload)
    res.raise_for_status()
    return res.json()["id"]

def await_audio_url(job_id, timeout=120):
    start = time.time()
    while time.time() - start < timeout:
        res = requests.get(f"{BASE_URL}/tts/{job_id}", headers=HEADERS)
        res.raise_for_status()
        data = res.json()
        status = data.get("status")
        if status == "completed":
            return data["audioUrl"]
        elif status == "failed":
            raise RuntimeError(f"Job {job_id} failed: {data}")
        time.sleep(2)
    raise TimeoutError(f"Job {job_id} timed out.")

def download_audio(url, target_path):
    os.makedirs(os.path.dirname(target_path), exist_ok=True)
    res = requests.get(url, stream=True)
    res.raise_for_status()
    with open(target_path, "wb") as f:
        for chunk in res.iter_content(chunk_size=8192):
            f.write(chunk)

Time-Aligning Stems with FFmpeg

Once the raw WAV clips are downloaded, sound designers require full-length stems that align with project timecodes without manual repositioning. You can pad the silence before each clip using FFmpeg's adelay filter:

# Pad technician voice line to start exactly at 3500ms (3.5s)
ffmpeg -i technician_line_01.wav -af "adelay=3500|3500" -c:a pcm_s24le technician_stem.wav

By standardizing all stems to 24-bit 48kHz uncompressed PCM WAV, your engine or audio workstation can ingest them as synchronous layers on the main mix.


5. Engineering Considerations and Trade-offs

At 365Finds, our evaluation of the Lovo.ai Genny API highlights several operational factors:

Lovo.ai Genny provides expressive, studio-quality speech models. By wrapping its granular asynchronous endpoints in a manifest-driven build script, engineering teams can replace manual vocal cutdowns with a deterministic multi-track stem generation pipeline.


References