Estimated reading time at 200 wpm: 9 minutes
This article consolidates the full investigation into the metallic / echo‑like artefact encountered during long‑form text‑to‑speech narration in Google AI Studio, the diagnostic reasoning applied, the failed and successful mitigation attempts, and the final stable solution. This took too many hours of work. But it is now resolved after much work with three AIs. Hold on – the AIs did not find the solution. I did. I had to suggest alternatives like “Is there another way as it seems that text in quotations is what’s causing a problem“. The point is that AI often does not think outside the box! More often it would pursue a ‘rabbit hole’ that narrows and narrows and becomes constrictive to the point of nonsense.
Whether or not you agree our Fat Disclaimer applies
The solution is not important right now. It will be in a few months. Why? Currently Amazon has dominated Audiobook production with some strict requirements; the most serious being ‘No AI narration’ (except for two voices in select scenarios). And Elevenlabs and others have acted similarly. This is expected to change as these providers realise that they cannot maintain dominance forever. TTS is big and it’s happening all over the place. So, I’m ahead and now ready for when the big three or four cave in.
This is written as a procedural and conceptual record for my learning, so similar issues can be recognised and resolved efficiently in the future.
Initial problem description
Narrated audio generated via neural TTS exhibited a recurring artefact described subjectively as:
- metallic
- hollow
- tube‑like
- echo‑adjacent but without an audible reverb tail
The artefact was most noticeable:
- within words rather than between words
- on consonants, especially s, t, and ‑ed endings
- intermittently, not uniformly
The effect increased listener fatigue and degraded perceived naturalness.
Early hypotheses and eliminated causes
A structured process of elimination was applied – over many hours and over week.
The following were tested and ruled out as primary causes:
- playback device or browser cache
- gain structure or normalisation
- sample rate or bit depth
- sibilance alone
- conventional EQ imbalance
- post‑processing artefacts
Parametric EQ, de‑essing, and light diffusion were tested carefully and abandoned once they were shown either to worsen the sound or produce only marginal benefit at the cost of clarity.
Conclusion at this stage: the artefact was structural, not post‑processing related.
Key empirical discovery
Through controlled experimentation, it was observed that:
- the artefact did not reliably correlate with overall text length
- it did correlate strongly with the presence of long or repeated quoted dialogue
- sequences of speech enclosed in quotation marks consistently triggered the problem
This shifted the diagnosis decisively.
Correct diagnosis
Quotation marks were acting as a hard prosodic mode switch inside the TTS system.
When the model encountered sustained quoted dialogue, it entered a dialogue‑performance state characterised by:
- tightened articulation
- elevated consonant energy
- unstable internal timing and phase relationships
This instability manifested perceptually as metallic, tube‑like resonance within consonants.
The artefact was therefore caused at synthesis time, not added afterwards.
Breakthrough intervention
Quotation marks were removed from the TTS input and replaced with neutral delimiters, on my suggestion. None of the AIs came up with this idea.
Specifically:
- opening quotation marks were replaced with an em‑dash followed by a space
- closing quotation marks were replaced with a space followed by an em‑dash
This preserved semantic boundaries for the listener while preventing the TTS engine from switching into dialogue prosody mode.
Immediate results:
- metallic artefact disappeared
- consonant clarity returned
- overall delivery became calmer and more expressive
This confirmed the diagnosis conclusively.
Separation of concerns
A strict separation was established for automated modification of files to have quotation marks replaced by em-dashes.
- CHAPTERS_EBOOK: authoritative publication text (unchanged)
- CHAPTERS_TTS: narration‑specific, doctored text used only for synthesis
This avoided any compromise to editorial or typographic integrity while enabling reliable audio generation.
Automation via Python
To avoid manual editing across multiple chapters, an automated solution was implemented.
The following script is the exact automation used to generate CHAPTERS_TTS from CHAPTERS_EBOOK. It is included here verbatim for completeness and future reuse.
# tts_doctor_quotes.py
# Converts dialogue quotes into em-dash delimiters for TTS stability.
# Processes text-based files (default: .md) recursively and mirrors folder structure.
#
# Key feature: tolerates mixed encodings on Windows (UTF-8 first, then cp1252, then latin-1).
from __future__ import annotations
import argparse
from pathlib import Path
def doctor_quotes(text: str, include_straight_quotes: bool = True) -> str:
"""
Replace dialogue quotes with em-dash delimiters:
Opening quote -> "— "
Closing quote -> " —"
Handles curly quotes “ ” always.
Optionally also treats straight double quotes (") as dialogue quotes.
"""
quote_chars = {"“", "”"} | ({'"'} if include_straight_quotes else set())
out: list[str] = []
in_quote = False
for ch in text:
if ch in quote_chars:
if not in_quote:
out.append("— ")
in_quote = True
else:
out.append(" —")
in_quote = False
else:
out.append(ch)
result = "".join(out)
# Light normalisation: avoid accidental double-spaces around inserted dashes
while "— " in result:
result = result.replace("— ", "— ")
while " —" in result:
result = result.replace(" —", " —")
# Tidy common punctuation spacing that can arise in Markdown prose
result = (
result.replace(" ,", ",")
.replace(" .", ".")
.replace(" !", "!")
.replace(" ?", "?")
.replace(" :", ":")
.replace(" ;", ";")
)
return result
def read_text_with_fallbacks(path: Path) -> str:
"""
Read a text file using UTF-8 if possible, otherwise fall back to common Windows encodings.
"""
for enc in ("utf-8", "cp1252", "latin-1"):
try:
return path.read_text(encoding=enc)
except UnicodeDecodeError:
continue
# As a last resort, read bytes and replace undecodable sequences.
return path.read_bytes().decode("utf-8", errors="replace")
def write_text_utf8(path: Path, text: str) -> None:
"""
Write text out as UTF-8 consistently.
"""
path.write_text(text, encoding="utf-8")
def process_folder(input_dir: Path, output_dir: Path, exts: set[str], include_straight_quotes: bool) -> None:
output_dir.mkdir(parents=True, exist_ok=True)
converted = 0
skipped = 0
for path in input_dir.rglob("*"):
if not path.is_file():
continue
if path.suffix.lower() not in exts:
continue
rel = path.relative_to(input_dir)
out_path = output_dir / rel
out_path.parent.mkdir(parents=True, exist_ok=True)
try:
text = read_text_with_fallbacks(path)
doctored = doctor_quotes(text, include_straight_quotes=include_straight_quotes)
write_text_utf8(out_path, doctored)
print(f"Converted: {rel}")
converted += 1
except Exception as e:
# Continue processing other files even if one fails unexpectedly
print(f"Skipped: {rel} ({type(e).__name__}: {e})")
skipped += 1
print(f"\nDone. Converted: {converted}. Skipped: {skipped}.")
def main() -> None:
parser = argparse.ArgumentParser(
description="Doctor dialogue quotes for TTS by replacing them with em-dash delimiters."
)
parser.add_argument("input_dir", type=Path, help="Folder containing original chapters (text-based files).")
parser.add_argument("output_dir", type=Path, help="Folder to write TTS-doctored chapters into.")
parser.add_argument(
"--exts",
default=".md",
help="Comma-separated list of file extensions to process (default: .md).",
)
parser.add_argument(
"--no_straight_quotes",
action="store_true",
help='Do not treat straight double quotes (") as dialogue quotes; only convert curly quotes “ ”.',
)
args = parser.parse_args()
exts = {e.strip().lower() for e in args.exts.split(",") if e.strip()}
include_straight = not args.no_straight_quotes
process_folder(args.input_dir, args.output_dir, exts, include_straight)
if __name__ == "__main__":
main()
The Python script performs the following:
- recursively processes all text‑based chapter files
- replaces dialogue quotation marks with em‑dash delimiters
- preserves folder structure
- writes results exclusively to CHAPTERS_TTS
- leaves CHAPTERS_EBOOK untouched
Additional robustness was added to handle mixed file encodings commonly found in long‑running writing projects.
The final script:
- attempts UTF‑8 first
- falls back to Windows encodings where required
- writes all outputs consistently as UTF‑8
Execution result:
- all chapter files converted successfully
- no skipped files
- deterministic and repeatable behaviour
Why this solution works
The resolution succeeded because it:
- removed the trigger rather than treating symptoms
- operated at the text‑semantics layer rather than audio post‑processing
- aligned with known limitations of current neural prosody modelling
This approach is robust across voices, chapters, and future revisions.
Final operational guidance to self
For all future narration work:
- generate audio exclusively from CHAPTERS_TTS
- preserve CHAPTERS_EBOOK as the single editorial source of truth
- rerun the script whenever chapter text changes
- avoid post-processing except for minimal final cleanup
Quoted dialogue should never be fed directly to the TTS engine using speech marks.
Additional learning: preventing micro-elision
After stabilising dialogue prosody, a secondary behaviour was observed: micro-elision.
Micro-elision refers to the TTS engine subtly compressing or paraphrasing adjacent short, reflective sentences into a smoother internal prosodic unit. This can give the impression that the voice has “added” words, when in fact it is eliding closely related clauses already present in the input.
This behaviour tends to arise when:
- narration is in a relaxed, expressive mode
- several short sentences appear consecutively
- silence or restraint is implied rather than explicitly stated
Resolution strategy
Micro-elision is prevented by introducing a hard narrative boundary that declares intentional silence.
The preferred solution in this workflow is the use of a silent prosody anchor:
[]
This marker:
- is plain text (not SSML)
- is not spoken by the TTS engine
- interrupts prosodic smoothing
- prevents sentence-to-sentence compression
Example
He was so astute. I said nothing. [] There was nothing to say that would slide into commentary. I listened.
This approach preserves expressiveness while preventing unintended elision.
Usage guidance
- Use [] sparingly and only where silence or restraint is narratively meaningful
- Apply it in CHAPTERS_TTS only; never in CHAPTERS_EBOOK
- Treat it as a synthesis control marker, not punctuation
With this addition, the TTS pipeline gains fine-grained control over both dialogue prosody and reflective narration without reintroducing artefacts.
Closing note
This investigation demonstrates that many perceived “audio quality” issues in neural TTS are in fact semantic control issues. Once identified, they can often be resolved cleanly and permanently at the input level.
The solution reached here represents a stable endpoint, not a workaround.
I am now ready for the big boys. They’ll cave in in a few months and I’ll be ready with an efficient workflow for audiobook production.










PROVISIONAL ROMANTIC AGE-GAP COMPLIANCE AND CONSENT AGREEMENT
Captain Walker