Text-to-speech service

Allows to use text-to-speech functions via the local bus

Installing/updating

Text-to-speech service is not included into EVA ICS distribution. To install/update it, either edit “eva/config/python-venv” registry key, specify the desired version in “extra” section (e.g. eva4-svc-tts>=0.0.1) and rebuild the Python virtual environment (/opt/eva4/sbin/venvmgr build). Or execute:

/opt/eva4/sbin/venvmgr add eva4-svc-tts
# or
/opt/eva4/sbin/venvmgr add eva4-svc-tts==N # where N = version number

The latest eva-shell version number can be obtained from https://pypi.org/project/eva4-svc-tts/

Setup

Use the template EVA_DIR/share/svc-tpl/svc-tpl-tts.yml:

# Text-to-speech service
#
# Requires https://pypi.org/project/eva4-svc-tts/ Python module installed
command: venv/bin/eva4-svc-tts
bus:
  path: var/bus.ipc
config:
  provider: gcloud # gcloud, polly or watson
  key_file: /path/to/key_file.json # provider key file
  ##
  ## WARNING! Before storing/caching audio files, refer to terms and conditions
  ## of the selected provider
  ###
  #storage_dir: /data/tts/sounds/ # directory where audio files are permanently stored
  #cache_dir: /data/tts/cache/ # directory where missing audio files are cached
  #cache_format: wav # cache file format
  options: # extra provider options, depending on the selected provider
    voice: en-US-Wavenet-F
  # playback device (list: /opt/eva4/venv/bin/python -m sounddevice)
  # if no external playback command is used
  #device: 0
  gain: 0 # default gain
  ## optional external playback command
  ## params passed: $1 = file to play, $2 = gain, e.g.
  ###!/bin/sh
  ##
  ##if [ -z "x$2" ]; then
  ## GAIN=$2
  ## else
  ## GAIN=0
  ##fi
  ##killall -9 play > /dev/null 2>&1 # stop current playback
  ##play $1 gain ${GAIN} > /dev/null 2>&1 # play a file with sox play
  #
  #playback_command: /data/play.sh
user: eva # make sure the user has access to audio device and file dirs

Create the service using eva-shell:

eva svc create eva.svc.tts.PROVIDER /opt/eva4/share/svc-tpl/svc-tpl-tts.yml

or using the bus CLI client:

cd /opt/eva4
cat DEPLOY.yml | ./bin/yml2mp | \
    ./sbin/bus ./var/bus.ipc rpc call eva.core svc.deploy -

(see eva.core::svc.deploy for more info)

EAPI methods

See EAPI commons for the common information about the bus, types, errors and RPC calls.

say

Description

Says a word or a phrase

Parameters

required

Returns

nothing

Parameters

Name

Type

Description

Required

text

String

Text to say

yes

other params

Any

Sent as-is to https://github.com/alttch/ttsbroker/ engine say fn

no