speak

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

README

Speak Plugin for E:D Event Hub

TTS Systems to Use

espeak-ng

https://github.com/espeak-ng/espeak-ng/

Peter's Text to Speech aka ptts.exe

http://jampal.sourceforge.net/ptts.html

Windows Builtin TTS

As VBS script From stackoverflow

'say.vbs
set s = CreateObject("SAPI.SpVoice")
s.Speak Wscript.Arguments(0), 3
s.WaitUntilDone(1000)

call it as

cscript say.vbs "hello there"

Problem: One has (AFAIK) to guess the number for s.WaitUntilDone

With Powershell

AssemblyName System.Speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak('hello');"

With mshta.exe

mshta vbscript:Execute("CreateObject(""SAPI.SpVoice"").Speak(""Hello"")(window.close)")
wsay

Windows equivalent of macOS say on Github

Documentation

Overview

Example (DefaultEvent)
package main

import (
	"encoding/json"
	"fmt"
)

func must(err error) {
	if err != nil {
		log.Error(err.Error())
		panic(err)
	}
}

func main() {
	var evt = defaultEvent{}
	evt.Speak.Template = `From "{{.From}}": {{.Message}}`
	must(evt.Speak.configure("test"))
	jevt := make(map[string]any)
	must(json.Unmarshal([]byte(`{
		"From": "John Doe",
		"Message": "RoC Commander, o7!"
	}`), &jevt))
	txt, args := evt.message(nil, jevt)
	fmt.Println(txt, args)
}
Output:

From "John Doe": RoC Commander, o7! []

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLog added in v0.8.0

func SetLog(l *slog.Logger)

Types

type EventMsg added in v0.7.3

type EventMsg struct {
	Text     string
	Template string
	// contains filtered or unexported fields
}

type Speaker

type Speaker struct {
	TTSExe  string         `yaml:"TTSExe"`
	Args    []string       `json:",omitempty" yaml:"Args"`
	Verbose bool           `json:",omitempty" yaml:"Verbose"`
	Events  map[string]any `yaml:"Events"`
	// contains filtered or unexported fields
}

func (*Speaker) Close

func (spk *Speaker) Close() error

func (*Speaker) Configure added in v0.7.3

func (spk *Speaker) Configure() error

func (*Speaker) OnJournalEvent added in v0.6.4

func (spk *Speaker) OnJournalEvent(e watched.JounalEvent) error

func (*Speaker) OnStatusEvent added in v0.6.4

func (spk *Speaker) OnStatusEvent(e watched.StatusEvent) error

Jump to

Keyboard shortcuts

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