speak

package
v0.6.8 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2021 License: GPL-3.0 Imports: 6 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)")

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event added in v0.6.4

type Event struct {
	If    interface{} `json:",omitempty"`
	Flags []string    `json:",omitempty"`
	Speak struct {
		Format string
		Args   ggja.BareArr
	}
}

func (*Event) Check added in v0.6.4

func (evt *Event) Check(jevt ggja.Obj) bool

func (*Event) Text added in v0.6.4

func (evt *Event) Text(jevt ggja.Obj) string
Example
package main

import (
	"encoding/json"
	"fmt"
	"log"

	"git.fractalqb.de/fractalqb/ggja"
)

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

func main() {
	var evt = Event{
		If: [][]interface{}{
			[]interface{}{
				ggja.BareObj{
					"Chan": "npc",
				},
			},
		},
	}
	evt.Speak.Format = "From \"%s\": %s"
	evt.Speak.Args = ggja.BareArr{
		"From",
		ggja.BareArr{"Message_Localised", "Message"},
	}
	jevt := make(ggja.BareObj)
	must(json.Unmarshal([]byte(`{
		"From": "John Doe",
		"Message": "RoC Commander, o7!"
	}`), &jevt))
	txt := evt.Text(ggja.Obj{Bare: jevt})
	fmt.Println(txt)
}
Output:

From "John Doe": RoC Commander, o7!

type Speaker

type Speaker struct {
	Exe     string
	Args    []string `json:",omitempty"`
	Verbose bool     `json:",omitempty"`
	Events  map[string]*Event
}

func (*Speaker) Close

func (spk *Speaker) Close() error

func (*Speaker) OnJournalEvent added in v0.6.4

func (spk *Speaker) OnJournalEvent(e watched.JounalEvent) (err 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