speech

package module
v0.0.0-...-75269d8 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 1 Imported by: 0

README

speech

Simple wrapper over text-to-speech service, previously Bing, currently AWS Polly.

Documentation

Overview

Package speech provides an interface, Speaker, that allows an application to access the basic function of a text-to-speech service, hiding the underlying provider, allowing migration (eg, from Bing to Polly). Call the provider-specific New function (eg, polly.NewPollyV1, polly.NewPollyV2) and assign the result to a Speaker variable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials struct {

	// ClientID is whatever is conventional as the ID finally presented to the service.
	ClientID string

	// Keys contains one or more service access keys.
	Keys []string
}

Credentials represents a common form of service credentials: a user ID string and then one or more keys to identify and authorise the service.

type Speaker

type Speaker interface {
	// Speak says something at a given speaking rate ("medium or "slow") within a locale, using a specified voice.
	Speak(text, speakingRate, locale, voice string) (*Spoken, error)
}

Speaker represents a session on a text-to-speech engine. The language, voice and speaking rate can be different on each call.

type Spoken

type Spoken struct {

	// Audio produces the stream of audio, sadly unseekable.
	Audio io.ReadCloser

	// TextLen is the length of the spoken text's recording format in bytes.
	TextLen int

	// Format names the recording format ("mp3", "ogg_vorbis", "pcm", "json").
	Format string

	// ContentType is the HTTP "Content-Type" header's value for the recording format.
	ContentType string
}

Spoken represents a stream of bytes in Audio, in the given Format.

Directories

Path Synopsis
Package polly provides speech.Speaker implementations for both versions of the AWS API (v1 and v2).
Package polly provides speech.Speaker implementations for both versions of the AWS API (v1 and v2).

Jump to

Keyboard shortcuts

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