gopicotts

package module
v0.0.0-...-149cb8d Latest Latest
Warning

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

Go to latest
Published: May 17, 2017 License: MIT Imports: 5 Imported by: 3

README

gotts

Overview

gotts is just a simple wrapper around the pico text to speech engine. This allows performing text to speech offline.

See cmd/pico2wave for an example that generates WAV files and cmd/picosay for an example that uses portaudio for live audio playback.

Dependencies

  • libttspico-dev

Documentation

Overview

Package gopicotts provides a wrapper around the pico text to speech engine.

Index

Examples

Constants

This section is empty.

Variables

View Source
var DefaultOptions = Options{
	Language:    LanguageEnUS,
	LanguageDir: "/usr/share/pico/lang/",
}

Functions

func SupportedLanguages

func SupportedLanguages() []string

Types

type Engine

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

func NewEngine

func NewEngine(opts Options) (*Engine, error)

NewEngine creates a new Pico text to speech engine.

Example
eng, err := gopicotts.NewEngine(gopicotts.DefaultOptions)
defer eng.Close()
if err != nil {
	log.Fatalf("error intializing engine: %s", err)
}
eng.SetFileOutput("output.wav")
eng.SendText("hello world.")
eng.CloseFileOutput()
Output:

func (*Engine) Close

func (e *Engine) Close() error

Close shuts down the engine and frees resources

func (*Engine) CloseFileOutput

func (e *Engine) CloseFileOutput() error

func (*Engine) FlushSendText

func (e *Engine) FlushSendText() error

FlushSendText flushes the Pico input buffer, which might be waiting on an end of sentence before producing speech.

func (*Engine) SendText

func (e *Engine) SendText(s string) error

SendText sends 'text' encoded in UTF8 into the Pico text input buffer. The input text may also contain text-input commands to change, for example, speed or pitch of the resulting speech output. Sentence ends are automatically detected.

func (*Engine) SetFileOutput

func (e *Engine) SetFileOutput(filename string) error

SetFileOutput sets the output file for encoded speech. If the filename ends in .wav, it will be WAVE formatted, if it ends in .au, it will be .AU formatted, otherwise it will be raw headerless PCM audio.

func (*Engine) SetOutput

func (e *Engine) SetOutput(fn func(data []int16))

If fn is non-nil, it will be called with raw 16000hz mono generated audio

type Language

type Language byte
const (
	LanguageEnUS Language = iota
	LanguageEnGB
	LanguageDe
	LanguageEs
	LanguageFr
	LanguageIt
)

func ParseLanguageName

func ParseLanguageName(name string) Language

func (Language) String

func (i Language) String() string

type Options

type Options struct {
	Language    Language
	LanguageDir string
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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