texttospeech

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Implementation for text-to-speech

Implementation for text-to-speech

Implementation for text-to-speech

Index

Constants

View Source
const (
	SpeechVoiceNeutral = texttospeechpb.SsmlVoiceGender_NEUTRAL
	SpeechVoiceFemale  = texttospeechpb.SsmlVoiceGender_FEMALE
	SpeechVoiceMale    = texttospeechpb.SsmlVoiceGender_MALE

	DefaultLanguageCode string = "en-US"
)

Variables

View Source
var (
	// ErrInvalidInput required input was not found
	ErrInvalidInput = errors.New("required input was not found")
)

Functions

This section is empty.

Types

type Client

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

Client is the object which connects to a text-to-speech platform to generate an audio file

func New

func New(ctx context.Context, opts SpeechOpts) (*Client, error)

New creates a new text-to-speech Client

func (*Client) Mute

func (c *Client) Mute()

Mute silences the audio playback

func (*Client) Read

func (c *Client) Read() ([]byte, error)

Read gets the raw bits of audio playback

func (*Client) Start

func (c *Client) Start() error

Start begins the audio playback of the converted text

func (*Client) Stop

func (c *Client) Stop() error

Stop terminates the audio playback

func (*Client) Stream

func (c *Client) Stream(w io.Writer) error

Stream is a helper function to stream audio to a playback device

func (*Client) Unmute

func (c *Client) Unmute()

Unmute restores the plyaback audio

type SpeechOpts

type SpeechOpts struct {
	VoiceType    texttospeechpb.SsmlVoiceGender
	LanguageCode string
	Text         string
}

SpeechOpts contains options for the voice output

Directories

Path Synopsis
Interface for text-to-speech
Interface for text-to-speech

Jump to

Keyboard shortcuts

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