Skip to content

[TTS] Text preprocessing - remove special characters before sending to TTS engine #10395

@Ironship

Description

@Ironship

Problem

When generating TTS audio, special characters (HTML tags, markdown symbols, brackets, asterisks, etc.) are sent directly to the TTS engine, causing audio artifacts and mispronunciations.

Current behavior

Only UnbreakLine() and JSON encoding are applied before sending text to TTS engines (in TtsDownloadService.cs).

Proposed solution

Add a configurable TtsTextPreprocessor that:

  • Strips HTML tags (<i>, <b>, <font>, etc.)
  • Removes markdown formatting (*, **, #, etc.)
  • Removes brackets and their content [music], (laughing)
  • Strips non-pronounceable characters
  • Optionally converts numbers to words
  • Configurable per-engine in SeVideoTextToSpeech settings

Files affected

  • src/UI/Logic/Download/TtsDownloadService.cs - add preprocessing call
  • New: TtsTextPreprocessor.cs
  • src/UI/Logic/Config/SeVideoTextToSpeech.cs - add settings

Related upstream issues


Working on this: @Ironship

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions