Class TtsPreprocessor
- Namespace
- AiDotNet.Audio.TextToSpeech
- Assembly
- AiDotNet.dll
Preprocesses text for text-to-speech synthesis.
public class TtsPreprocessor
- Inheritance
-
TtsPreprocessor
- Inherited Members
Remarks
This class handles text normalization and grapheme-to-phoneme (G2P) conversion to prepare text for acoustic model input.
For Beginners: Before TTS can synthesize speech, we need to convert written text into phonemes (speech sounds). This involves:
- Normalizing text (expanding abbreviations, numbers)
- Converting graphemes (letters) to phonemes (sounds)
Fields
EndPhoneme
public const int EndPhoneme = 101
Field Value
PadPhoneme
Special phoneme IDs.
public const int PadPhoneme = 0
Field Value
SilencePhoneme
public const int SilencePhoneme = 102
Field Value
StartPhoneme
public const int StartPhoneme = 100
Field Value
Methods
NormalizeText(string)
Normalizes text for TTS processing.
public string NormalizeText(string text)
Parameters
textstringThe text to normalize.
Returns
- string
Normalized text.
SplitIntoSentences(string)
Splits text into sentences for chunked synthesis.
public List<string> SplitIntoSentences(string text)
Parameters
textstringThe text to split.
Returns
TextToPhonemes(string)
Converts text to phoneme IDs.
public int[] TextToPhonemes(string text)
Parameters
textstringThe text to convert.
Returns
- int[]
Array of phoneme IDs.