Needs more documentation and code cleanup before being ready to use.

Remi Reuvekamp b6a53bb0fc Fix broken tests 2 years ago
pulse c3c6cb9614 Write test for pulse package 2 years ago
speak e5174eeaf5 Control volume with pulseaudio 2 years ago
speakc b6a53bb0fc Fix broken tests 2 years ago
.gitignore 4727ce1f6b Add speaker espeakMplayer 2 years ago
COPYING 5025f53f93 Release speakd under the GPL version 3 2 years ago
README 5025f53f93 Release speakd under the GPL version 3 2 years ago
config.go 43de21d3bc Move volume things of espeak to new speaker 2 years ago
handlers.go c3c6cb9614 Write test for pulse package 2 years ago
main.go 43de21d3bc Move volume things of espeak to new speaker 2 years ago
msgcallbacktype_string.go 736a544b5d Add callback support to speakc 2 years ago
speakbase.go 43de21d3bc Move volume things of espeak to new speaker 2 years ago
speakbase_test.go b6a53bb0fc Fix broken tests 2 years ago
speaker.go 43de21d3bc Move volume things of espeak to new speaker 2 years ago

README

NOTE: The Gogs web interface displays this file incorrectly.

NOTE: Readme files are out of date.
I'm currently working on part 4/4 of 'internet-of-st00fs'.
After finishing it I will have a look at speakd again, as it can also do with a bit of code cleanup.

speakd

== General information ==

Speakd is a daemon that maintains a queue around text-to-speech messages.
A separate program is required for text-to-speech functionality.
Currently espeak is the only supported program though it is easy to add support for others.
The daemon's message queue can be controlled with the API which is documented below.

See COPYING

== Features ==

Speakd messages have a priority which should be given when adding a message.
Either 'low', 'medium', 'high'.
Higher priority messages are spoken first.
When a higher priority message than the one currently playing is received, the play is immediately stopped and the new higher priority message is played instead.
If the stopped message is not of priority low, the stopped message will be added to the queue again for later play.
Thus, priority low should (only) be used for messages which are not important.

When adding a message an HTTP callback URL can be specified.
This URL will be called when the message is played, force stopped (see priorities) and completed.
With the HTTP call the following form fields are included:
type 'play', 'stop', 'complete'
id int
Message ID

== Configuration ==

On the first run, speakd creates a configuration file in JSON format in the current directory.
The name for this file can be set with the --config-filename option. It defaults to 'config.json'.

List of configuration options:
httpPort: HTTP port for the API to listen to. Default: 8001
speaker: Program to use for text-to-speech. Currently only espeak is supported. Default: espeak

== API ==

speakd currently supports these four HTTP endpoints.

= /add =

Add a message to the queue.

Parameters
message string (required)
priority 'low', 'medium' or 'high' (required)
language 'english' or 'dutch' (default: english)
Language for text-to-speech. Currently only English and Dutch are supported, but adding others is easy.
callback string (default: none)
HTTP URL to call when this message is played, stopped and completed.

Return
JSON string which includes the following fields
success bool
error string (optional)
message_id int

= /cancel =

Cancel a message from the queue or stop it if it is playing.

Parameters
id int (required)

Return
JSON string which includes the following fields
success bool
error string (optional)

= /current =

Get information on the currently played message.

Returns
JSON string which includes the following fields
success bool
message object (can be null)
id int
priority priority
As specified in /add
language language
As specified in /add
message string

= /queue =

Get information on the messages in the queue.

Returns
JSON string which includes the following fields
success bool
messages object[] (can be null)
id int
priority priority
As specified in /add
language language
As specified in /add
message string


== speakc ==

A Go package speakc is included which acts as a client library for interfacing with the daemon.
Speakc has its own readme file.


== Contact information ==

You can contact me by IRC: remi on freenode
Email is also possible: remi at remi d0t im