# The mary-generic output module is based on the generic plugin for Speech
# Dispatcher. It means there is no code written explicitly for
# this plugin, all the specifics are handled in this configuration
# and we call a simple command line client to perform the actual
# synthesis. Use this config file with the sd_generic output module.

# Debug turns debugging on or off
# See speechd.conf for information where debugging information is stored
Debug 0

# IMPORTANT: The audio output method relies on an audio playback
# utility (play, aplay, paplay for OSS, ALSA or Pulse)
# being installed. If this is not the case, consider installing it
# or replace the $PLAY_COMMAND string in the GenericExecuteString below
# with play, paplay or similar.
#
# GenericExecuteSynth is the shell command that should be
# executed in order to say some message. This command must
# stop saying the message on SIGKILL, otherwise it's useless.
# You can use the variables $LANGUAGE, $VOICE, $PITCH and $RATE
# which will be substituted for the appropriate value (you
# can modify this value, see other parameters).
# This line uses the command curl, so you might need to install
# curl if it isn't already installed.
# The command can be split into more lines, if necessary, using '\'.
GenericExecuteSynth \
"curl \"http://localhost:59125/process?INPUT_TEXT=`printf %s \'$DATA\'| xxd -plain | tr -d '\\n' | sed 's/\\\(..\\\)/%\\\1/g'`&INPUT_TYPE=TEXT&OUTPUT_TYPE=AUDIO&AUDIO=WAVE_FILE&LOCALE=$LANGUAGE&VOICE=$VOICE\" | sox -v $VOLUME $TMPDIR/mary-generic.wav tempo $RATE pitch $PITCH norm && $PLAY_COMMAND $TMPDIR/mary-generic.wav"

GenericCmdDependency "curl"
GenericPortDependency 59125
GenericSoundIconFolder "/usr/share/sounds/sound-icons/"

# The following three items control punctuation levels None, Some, and All.
# Each of these values will be substituted into the $PUNCT variable depending
# on the value passed to speech dispatcher from applications.
# Note that if an empty string is specified, then $PUNCT will be blank
# which is a default situation for espeak.

GenericPunctNone ""
GenericPunctSome "--punct=\"()[]{};:\""
GenericPunctMost "--punct=\"()[]{};:\""
GenericPunctAll "--punct"

# GenericStripPunctChars is a list (enclosed in doublequotes) of
# all the characters that should be replaced by whitespaces in
# order not to be badly handled by the output module or misinterpreted
# by shell.
#GenericStripPunctChars  ""

# If the language you need to pass in $LANGUAGE is different
# from the standard ISO language code, you can specify
# which string to use instead. If you wish to use
# other than ISO charset for the specified language,
# you can add it's name (as accepted by iconv) as a
# third parameter in doublequotes.

GenericLanguage  "en" "en_GB" "utf-8"
GenericLanguage  "en" "en_US" "utf-8"
GenericLanguage  "de" "de"    "utf-8"
GenericLanguage  "fr" "fr"    "utf-8"
GenericLanguage  "tr" "tr"    "utf-8"
GenericLanguage  "te" "te"    "utf-8"
GenericLanguage  "it" "it"    "utf-8"

# AddVoice specifies which $VOICE string should be assigned to
# each language and symbolic voice name. All the voices you want
# to use must be specified here. This list will likely not be
# up-to-date, please check your mary installation and add the voices
# you want to use.

#English GB
AddVoice        "en_GB"    "MALE1"         "dfki-spike"
AddVoice        "en_GB"    "FEMALE1"       "dfki-prudence"
AddVoice        "en_GB"    "CHILD_FEMALE"  "dfki-poppy"
AddVoice        "en_GB"    "MALE2"         "dfki-obadiah"

#English US
AddVoice        "en_US"    "MALE1"         "cmu-bdl"
AddVoice        "en_US"    "MALE2"         "cmu-rms"
AddVoice        "en_US"    "FEMALE1"       "cmu-slt"

#German
AddVoice        "de"    "MALE1"         "dfki-pavoque-styles"
AddVoice        "de"    "FEMALE1"       "bits1"
AddVoice        "de"    "MALE2"         "bits2"
AddVoice        "de"    "MALE3"         "bits3"
AddVoice        "de"    "FEMALE2"       "bits4"
AddVoice        "de"    "MALE4"         "dfki-pavoque-neutral"

#Turkish
AddVoice        "tr"    "MALE1"         "dfki-ot"

#French
AddVoice        "fr"    "FEMALE1"       "upmc-jessica"
AddVoice        "fr"    "MALE1"         "upmc-pierre"
AddVoice        "fr"    "FEMALE2"       "enst-camille"
AddVoice        "fr"    "MALE2"         "enst-dennys-hsmm"

#Telugu
AddVoice        "te"    "FEMALE1"       "cmu-nk-hsmm"

#Italian
AddVoice        "it"    "FEMALE1"       "istc-lucia-hsmm"

# Not installed yet
#marylux-lb

# DefaultVoice specifies which $VOICE string should be used if no voice is
# specified otherwise.

DefaultVoice    "dfki-spike"

# These parameters set _rate_, _pitch_, and _volume_ conversion. This is
# part of the core of the definition of this generic output
# module for this concrete synthesizer, it's not intended to
# be modified by common users.
# The resulting rate (or pitch) has the form:
#       (speechd_rate * GenericRateMultiply) + GenericRateAdd
# while speechd_rate is a value between -100 (lowest) and +100 (highest)
# You have to define some meaningful conversion for each synthesizer

# The SSIP defaults are actually controlled via DefaultRate, DefaultPitch, and
# DefaultVolume in the speechd.conf file.
# Specific values for Mary TTS

GenericRateAdd          1
GenericPitchAdd         1
GenericVolumeAdd        1

# (These values are multiplied by 100, because DotConf currently
# doesn't support floats. So you can write 0.85 as 85 and so on.)

GenericRateMultiply     1
GenericPitchMultiply 750
GenericVolumeMultiply 2

# If the client program can't handle floats, you will have to
# use these two options to force integers as the parameters
# 1 means force integers, 0 means do nothing (write floats).

GenericRateForceInteger     0
GenericPitchForceInteger    1
GenericVolumeForceInteger   0

# Note that SSIP rates < -50 are spoken at -50.


# Copyright (C) 2018 Florian Steinhardt <no.known.email@example.com>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.  See the GNU General Public License for more details (file
# COPYING in the root directory).
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
