pipertts - v1.3.0
    Preparing search index...

    Class PiperNativeTTS

    Native Piper TTS voice with persistent ONNX session (mirrors piper1-gpl voice.py PiperVoice).

    Index
    • Returns the resolved local .onnx model path (downloaded first when the voice came from a URL or catalog reference).

      Returns string

      Absolute model path.

    • Converts text to phonemes with the voice's own phonemizer (espeak, text, hebrew, lithuanian, pinyin, thai, or japanese; Arabic ar voices are diacritized first unless disabled).

      Parameters

      • text: string

        Input text to phonemize.

      Returns Promise<string[][]>

      Phoneme arrays grouped by sentence.

    • Synthesizes text and returns the full audio: sentence chunks concatenated with sentenceSilence gaps, then encoded to outputFormat (wav by default) and optionally written to outputFile.

      Parameters

      • text: string

        Input text to synthesize.

      • options: NativeSynthesizeOptions = {}

        Per-call synthesis parameters, output format, and optional output file.

      Returns Promise<{ audio: Buffer; sampleRate: number; text: string }>

      Final audio with its sample rate and source text.

      When text is empty or no audio is produced.

    • Synthesizes text sentence by sentence, yielding raw PCM per sentence as it is produced.

      Parameters

      • text: string

        Input text to synthesize.

      • options: NativeSynthesizeOptions = {}

        Per-call synthesis parameters (scales, speaker, volume).

      Returns AsyncGenerator<NativeAudioChunk>

      Per-sentence { sampleRate, phonemes, phonemeIds, pcm16 } chunks.

      When text is empty.

    • Loads a voice from a local file, a direct URL, or a catalog reference.

      Resolution order: explicit modelPath, then modelUrl (downloaded once into modelsDir and cached), then model (rhasspy id, hub:<slug>, piperhub.org page URL, or bare PiperHub slug). The .onnx.json config defaults to the model sibling (<model>.json / <modelUrl>.json).

      Parameters

      • options: NativeTtsOptions

        Model source, session reuse, and phonemizer data locations.

      Returns Promise<PiperNativeTTS>

      A voice with a warm persistent ONNX session.

      When no usable source is provided, files are missing, or the config/phoneme type is unsupported.