pipertts - v1.3.0
    Preparing search index...

    Class PiperTTS

    High-level TypeScript wrapper around the Piper CLI.

    Index
    • Returns the resolved executable path used to run Piper.

      Returns string

      Absolute executable path.

    • Returns the resolved model path used by this instance.

      Returns string

      Absolute model path.

    • Synthesizes speech for the given text and returns audio as Buffer.

      • outputFormat: "wav" (default): WAV bytes via a temp file (or directly to outputFile when set).
      • outputFormat: "raw": raw PCM bytes captured from stdout.
      • outputFormat: "mp3" | "ogg" | "opus": WAV internally, transcoded via ffmpeg (or pure-JS fallbacks: lamejs for mp3, opusscript for opus).

      Parameters

      • text: string

        Input text to synthesize.

      • callOptions: PiperInferenceOptions = {}

        Optional inference options for this call.

      Returns Promise<SynthesisResult>

      Synthesis result with audio buffer and metadata.

      When text is empty, options are invalid, or Piper fails.

    • Convenience helper that synthesizes directly to a file.

      Parameters

      • text: string

        Input text to synthesize.

      • outputPath: string

        Destination file path.

      • options: Omit<PiperInferenceOptions, "outputFile"> = {}

        Optional inference options for this call.

      Returns Promise<void>

      Promise resolved when the output file has been written.

    • Creates a new instance and performs a warm-up inference to validate setup.

      Pass skipWarmup: true to skip the validation inference.

      Parameters

      Returns Promise<PiperTTS>

      A fully initialized PiperTTS instance.

      When model resolution, binary resolution, or warm-up fails.