Fish Speech developer on retainer: approximate ASR prompt_text diffuses forced-alignment cross-attention gate — prosodic transfer fails — speaker similarity 0.63 vs 0.84 — $90,000 — 3 months

fish-speech 1.5.0 (FishAudio) • PyTorch 2.3.0 • Python 3.11 • CUDA 12.2; prompt_text sourced from Google Speech-to-Text automatic transcript (12–18% token mismatch vs verbatim spoken text); Fish Speech 1.5 forced-alignment cross-attention gate: uniform attention weights at mismatch >8%; correct timbre, no prosodic transfer; every episode monotone; speaker similarity cosine 0.63 vs 0.84 target; fix: prompt_text from WhisperX word-level forced alignment on reference audio • Westfield FishSpeech Media Ltd. (3-person; 3 months; 1.5h)

Westfield FishSpeech Media Ltd. is a 3-person startup building a multilingual AI podcast narration API for independent content creators. Their product accepts a licensed voice actor’s reference recording and a script, and returns studio-quality narrated audio in that voice. The API was built on fish-speech 1.5.0, FishAudio’s open-source multilingual TTS model. Voice cloning in Fish Speech requires two conditioning inputs: reference_audio (the voice sample, 10–30 seconds) and prompt_text (the verbatim text spoken in that sample). The team sourced prompt_text from Google Speech-to-Text API v2 — a natural choice since they were already using it for other features. The reference recordings were 15-second clips from 8 licensed professional voice actors.

The cloned voice sounded correct in terms of timbre and pitch range — clients recognized it as the target voice actor. But every generated episode had the same flat, monotone delivery regardless of the script’s emotional content. A thriller script sounded the same as a meditation guide. Clients described it consistently as “sounds like them, but reading a phone book.” Speaker similarity (cosine distance between reference and generated speaker embeddings) measured 0.63, below the 0.80 target. The team spent three months adjusting reference clip duration, generation temperature, and conditioning weight before engaging the retainer.

# narrator_pipeline.py — Westfield FishSpeech Media Ltd.
# fish-speech 1.5.0; PyTorch 2.3.0; Python 3.11; CUDA 12.2

from fish_speech.inference import TTSInferenceEngine
from google.cloud import speech_v2 as speech

engine = TTSInferenceEngine.from_pretrained(
    "fishaudio/fish-speech-1.5",
    device="cuda",
    precision="bfloat16",
)

def get_prompt_text_from_asr(reference_audio_path: str) -> str:
    """Bug: Google STT returns approximate transcript, not verbatim text."""
    client = speech.SpeechClient()
    with open(reference_audio_path, "rb") as f:
        content = f.read()
    config = speech.RecognitionConfig(
        auto_decoding_config=speech.AutoDetectDecodingConfig(),
        language_codes=["en-US"],
        model="latest_long",
    )
    request = speech.RecognizeRequest(
        recognizer=f"projects/{PROJECT_ID}/locations/global/recognizers/_",
        config=config,
        content=content,
    )
    response = client.recognize(request=request)
    # Returns cleaned, post-processed text: filler words removed,
    # contractions normalized, proper nouns auto-corrected.
    # 'um', 'uh', 'you know', 'like' — all stripped.
    # "it's" vs "it is" normalized by ASR language model.
    # Mismatch vs verbatim spoken text: 12–18% of tokens.
    return response.results[0].alternatives[0].transcript

def narrate_podcast(script: str, reference_audio_path: str) -> bytes:
    # Bug: prompt_text from ASR — not verbatim
    prompt_text = get_prompt_text_from_asr(reference_audio_path)

    # Fish Speech 1.5: prompt_text must EXACTLY match reference_audio speech.
    # Forced-alignment cross-attention gate uses prompt_text tokens as anchors
    # to identify which audio frames carry stress, rhythm, and intonation.
    # At 12–18% token mismatch: gate loses alignment → uniform attention weights
    # → no prosodic transfer → monotone output at model default prosody.
    audio = engine.tts(
        text=script,
        reference_audio=reference_audio_path,
        prompt_text=prompt_text,  # ← approximate ASR transcript
        temperature=0.7,
        top_p=0.8,
    )
    return audio

# Token mismatch analysis — Westfield FishSpeech Media Ltd.:
#
# Reference audio: "So, um, I wanted to talk about — you know — the way
#   that modern podcasts, they just don't respect your time, right?"
#   (verbatim, 52 tokens after Fish Speech tokenizer)
#
# Google STT output: "So I wanted to talk about the way that modern
#   podcasts don't respect your time."
#   (post-processed: 36 tokens — 'um', 'you know', '—', 'they just'
#   removed; 'right?' dropped; punctuation changed)
#
# Token edit distance: 16 tokens / 52 tokens = 30.8% mismatch
# (this clip; average across 50 clips: 14.2%)
#
# Effect on forced-alignment cross-attention gate:
#   Gate input: (reference_audio_tokens: 150 frames, prompt_text_tokens: 36)
#   Expected: monotonic alignment (audio frame i → text token j)
#   At 30.8% mismatch: 10+ text tokens have no corresponding audio anchor
#   Gate produces near-uniform weights: each generated token attends
#   to all reference frames equally → averages out prosodic signal
#   → output prosody = model's learned average prosody (monotone)
#
# Speaker similarity cosine:
#   0.63 (approximate prompt_text) vs 0.84 (verbatim prompt_text)
#   UTMOS score: 2.9 vs 4.1 (prosodic naturalness component drives gap)

The root cause appeared immediately once the prompt_text was printed next to the actual reference audio transcript. The ASR system had silently cleaned the speech: filler words removed, contractions normalized, disfluencies stripped. Fish Speech’s forced-alignment gate was trying to match the cleaned text against the original speech, failing to find stable anchor points for 14% of tokens, and producing diffuse attention weights as a result. The fix was to replace Google STT with WhisperX word-level forced alignment, which produces verbatim output including fillers and disfluencies. Speaker similarity jumped from 0.63 to 0.84 on the first run after the change, and all eight voice talent profiles recovered their characteristic expressive delivery.

Fix: use WhisperX forced alignment for verbatim prompt_text

# Fixed narrator_pipeline.py — Westfield FishSpeech Media Ltd.

import whisperx
from fish_speech.inference import TTSInferenceEngine

engine = TTSInferenceEngine.from_pretrained(
    "fishaudio/fish-speech-1.5",
    device="cuda",
    precision="bfloat16",
)

# Load WhisperX models once at startup
_whisperx_model = whisperx.load_model("large-v2", device="cuda", language="en")
_align_model, _align_metadata = whisperx.load_align_model(
    language_code="en", device="cuda"
)

def get_verbatim_prompt_text(reference_audio_path: str) -> str:
    """Fix: WhisperX returns verbatim text including fillers and disfluencies."""
    audio = whisperx.load_audio(reference_audio_path)

    # Initial Whisper transcript (still cleaned, but we use it only for
    # the forced-alignment step, not as final prompt_text)
    result = _whisperx_model.transcribe(audio, batch_size=16)

    # Word-level forced alignment: aligns each word token to exact audio frame
    result = whisperx.align(
        result["segments"],
        _align_model,
        _align_metadata,
        audio,
        device="cuda",
        return_char_alignments=False,
    )

    # Reconstruct verbatim text from word-level segments
    # whisperx word segments preserve spoken order, including partial fillers
    words = []
    for segment in result["segments"]:
        for word_info in segment.get("words", []):
            words.append(word_info["word"].strip())

    verbatim_text = " ".join(words)
    return verbatim_text

def narrate_podcast(script: str, reference_audio_path: str) -> bytes:
    # Fix: verbatim prompt_text preserves fillers, rhythm, word boundaries
    prompt_text = get_verbatim_prompt_text(reference_audio_path)

    audio = engine.tts(
        text=script,
        reference_audio=reference_audio_path,
        prompt_text=prompt_text,  # ← verbatim, fillers preserved
        temperature=0.7,
        top_p=0.8,
    )
    return audio

# Results after fix — Westfield FishSpeech Media Ltd.:
#   Speaker similarity (cosine):   0.63  →  0.84   (target: ≥0.80  ✓)
#   UTMOS prosodic naturalness:    2.9   →  4.1
#   Client description:            "phone book monotone" → "natural, expressive"
#   Duration of investigation:     3 months → 1.5h retainer session
#
# If the reference audio was read from a known script:
#   Use the original script text directly as prompt_text — it is more
#   accurate than any ASR output because it matches the speaker's intended
#   words exactly. Only use WhisperX for spontaneous/conversational reference.
#
# For multilingual reference audio (Chinese, Japanese, Korean, German):
#   Use the language-specific WhisperX align model:
#   whisperx.load_align_model(language_code="zh", device="cuda")
#   Fish Speech 1.5 supports all languages with the same alignment requirement.
#
# Token mismatch sanity check (add to onboarding):
#   from fish_speech.tokenizer import FishTokenizer
#   tokenizer = FishTokenizer.from_pretrained("fishaudio/fish-speech-1.5")
#   t_verbatim = tokenizer.encode(verbatim_text)
#   t_asr = tokenizer.encode(asr_text)
#   from editdistance import distance
#   mismatch_rate = distance(t_verbatim, t_asr) / max(len(t_verbatim), len(t_asr))
#   assert mismatch_rate < 0.05, f"prompt_text mismatch {mismatch_rate:.1%} — use verbatim"

Related retainer posts


Track retainer hours without a client portal

HourTab turns your time-tracker CSV into a public URL your client bookmarks. No login. No portal. CSV in, URL out.

See pricing →