piper

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ModelToURL = map[string]string{
	"en_US-hfc_male-medium.onnx":              "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/hfc_male/medium/en_US-hfc_male-medium.onnx",
	"en_US-hfc_female-medium.onnx":            "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/hfc_female/medium/en_US-hfc_female-medium.onnx",
	"en_US-lessac-medium.onnx":                "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx",
	"en_GB-northern_english_male-medium.onnx": "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/northern_english_male/medium/en_GB-northern_english_male-medium.onnx",

	"zh_CN-huayan-medium.onnx": "https://huggingface.co/rhasspy/piper-voices/resolve/main/zh/zh_CN/huayan/medium/zh_CN-huayan-medium.onnx",
}

Piper has hundreds of pretrained models on the sample Website These are some of the best ones for English. However, as long as you have both the .onnx and .onnx.json files locally, you can use any model you want or even train your own.

Functions

func FindModels

func FindModels(dir string) ([]string, error)

Types

type PiperClient

type PiperClient struct {
	// contains filtered or unexported fields
}

func NewPiperClient

func NewPiperClient(model string) (*PiperClient, error)

func (PiperClient) Run

func (p PiperClient) Run(filename string, inputData io.Reader, outdir string, streamOutput bool) (bin.PipedOutput, string, error)

Run calls piper with the given model, using inputData as the text to be spoken.

If streamOutput == true, it returns a PipedOutput so the caller can read raw PCM from output.Stdout.

If streamOutput == false, we wait for piper to finish writing a .wav file and run the name of the .wav file as the output.

We log all of piper's stderr so that if there's an error, we see it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL