synthesizer

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTranscriberAccent added in v0.2.387

func GetTranscriberAccent(w *ProcessedWord) int

GetTranscriberAccent return accent from ProcessedWord

Types

type AccentVariant

type AccentVariant struct {
	Accent   int     `json:"accent"`
	Accented string  `json:"accented"`
	Ml       string  `json:"ml"`
	Syll     string  `json:"syll"`
	Usage    float64 `json:"usage"`
}

AccentVariant - accenters's result

type Clitic added in v0.2.387

type Clitic struct {
	Type   CliticAccentEnum
	Accent int
}

Clitic structure

type CliticAccentEnum added in v0.2.387

type CliticAccentEnum int

CliticAccentEnum contains types of possible clitics

const (
	//CliticsUnused - clitics does not apply for the word
	CliticsUnused CliticAccentEnum = iota

	//CliticsNone - not a clitic
	CliticsNone

	//CliticsCustom - custom clitic type
	CliticsCustom
)

type MainWorker

type MainWorker struct {
	AllowCustomCode bool
	// contains filtered or unexported fields
}

MainWorker does synthesis work

func (*MainWorker) Add

func (mw *MainWorker) Add(pr Processor)

Add adds a processor to the end

func (*MainWorker) AddSSML added in v0.2.387

func (mw *MainWorker) AddSSML(pr Processor)

AddSSML adds a SSML processor to the end

func (*MainWorker) GetProcessorsInfo added in v0.2.407

func (mw *MainWorker) GetProcessorsInfo() string

GetProcessorsInfo return info about processors for testing

func (*MainWorker) GetSSMLProcessorsInfo added in v0.2.387

func (mw *MainWorker) GetSSMLProcessorsInfo() string

GetSSMLProcessorsInfo return info about processors for testing

func (*MainWorker) Work

func (mw *MainWorker) Work(input *api.TTSRequestConfig) (*api.Result, error)

Work is main method

type PartProcessor

type PartProcessor interface {
	Process(*TTSDataPart) error
}

PartProcessor interface

type PartRunner

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

PartRunner runs parts of the job

func NewPartRunner

func NewPartRunner(parallelWorker int) *PartRunner

NewPartRunner creates parallel runner

func (*PartRunner) Add

func (p *PartRunner) Add(pr PartProcessor)

Add adds a processor to the end

func (*PartRunner) Process

func (p *PartRunner) Process(data *TTSData) error

Process is main method

type ProcessedWord

type ProcessedWord struct {
	Tagged            TaggedWord
	UserTranscription string
	UserSyllables     string
	TranscriptionWord string
	AccentVariant     *AccentVariant
	UserAccent        int
	Clitic            Clitic
	Transcription     string
	Obscene           bool
	TextPart          *TTSTextPart
}

ProcessedWord keeps one word info

type Processor

type Processor interface {
	Process(*TTSData) error
}

Processor interface

type SSMLTypeEnum added in v0.2.387

type SSMLTypeEnum int

SSMLTypeEnum indicates part type: text, pause

const (
	// SSMLNone - not ssml part
	SSMLNone SSMLTypeEnum = iota
	// SSMLMain - main part
	SSMLMain
	// SSMLText - text part for synthesis
	SSMLText
	// SSMLPause - <p>, <break> part for synthesis
	SSMLPause
)

type TTSConfig

type TTSConfig struct {
	JustAM bool
	Input  *api.TTSRequestConfig

	Type  SSMLTypeEnum
	Voice string
	Speed float32

	PauseDuration time.Duration
}

TTSConfig some TTS configuration

type TTSData

type TTSData struct {
	Input        *api.TTSRequestConfig
	RequestID    string
	Cfg          TTSConfig
	OriginalText string
	PreviousText string // text of previous request loaded by requestID

	CleanedText []string // corresponds to OriginalTextParts

	NormalizedText  []string // text after normalization, array corresponds to OriginalTextParts
	Text            []string // text after cleaning and URL replacement
	TextWithNumbers []string

	AudioSuffix string // add audio suffix if var is set

	Words []*ProcessedWord
	Parts []*TTSDataPart

	Audio           string
	AudioMP3        string
	AudioLenSeconds float64

	OriginalTextParts []*TTSTextPart
	SSMLParts         []*TTSData
}

TTSData working data for one request

type TTSDataPart

type TTSDataPart struct {
	Text       string
	Cfg        *TTSConfig
	First      bool
	Words      []*ProcessedWord
	Spectogram string
	Audio      string
}

TTSDataPart partial tts data

type TTSTextPart added in v0.2.407

type TTSTextPart struct {
	Accented, Text, Syllables, UserOEPal string
}

TTSTextPart part of the text

type TaggedWord

type TaggedWord struct {
	Separator   string
	SentenceEnd bool
	Space       bool
	Word        string
	Mi          string
	Lemma       string
}

TaggedWord - tagger's result

func (TaggedWord) IsWord

func (tw TaggedWord) IsWord() bool

IsWord returns true if object indicates word

Jump to

Keyboard shortcuts

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