sound

package
v0.0.0-...-b5fa7f3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyMessage = errors.New("Empty message")
)
View Source
var SoundsList, SoundsMap = func() ([]SoundInfo, map[string]SoundInfo) {
	m := map[string]SoundInfo{}

	fis, _ := fs.ReadDir(files.Sounds, "sounds")
	for _, fi := range fis {
		fn := fi.Name()
		nm := fn[:len(fn)-len(path.Ext(fn))]
		m[nm] = SoundInfo{
			Name: nm,
		}
	}

	for nm, _ := range translate.Substites {
		m[nm] = SoundInfo{Name: nm}
	}

	l := make([]SoundInfo, 0, len(m))
	for _, si := range m {
		l = append(l, si)
	}
	sort.Slice(l, func(i, j int) bool { return l[i].Name < l[j].Name })
	return l, m
}()

Functions

func LoadSound

func LoadSound(name string) (*audio.Audio, error)

func ReadSound

func ReadSound(name string) (*memio.File, error)

func SoundOrTTS

func SoundOrTTS(tts *piper.TTS, cfg config.Config, username, text string) (au *audio.Audio, err error)

Types

type SoundInfo

type SoundInfo struct {
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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