19 YARP_LOG_COMPONENT(GoogleSpeechSynthesizerParamsCOMPONENT,
"yarp.device.GoogleSpeechSynthesizer")
30 std::vector<std::string> params;
31 params.push_back(
"language_code");
32 params.push_back(
"voice_name");
33 params.push_back(
"voice_speed");
34 params.push_back(
"voice_pitch");
35 params.push_back(
"default_voices");
36 params.push_back(
"voice_fallback");
43 if (paramName ==
"language_code")
48 if (paramName ==
"voice_name")
53 if (paramName ==
"voice_speed")
58 if (paramName ==
"voice_pitch")
63 if (paramName ==
"default_voices")
67 if (paramName ==
"voice_fallback")
73 yError() <<
"parameter '" << paramName <<
"' was not found";
92 if (config.
check(
"help"))
101 if (config.
check(
"language_code"))
104 yCInfo(GoogleSpeechSynthesizerParamsCOMPONENT) <<
"Parameter 'language_code' using value:" <<
m_language_code;
108 yCError(GoogleSpeechSynthesizerParamsCOMPONENT) <<
"Mandatory parameter 'language_code' not found!";
109 yCError(GoogleSpeechSynthesizerParamsCOMPONENT) <<
"Description of the parameter: Language for speech synthesis (e.g. \"it-IT\", \"en-US\")";
112 prop_check.
unput(
"language_code");
117 if (config.
check(
"voice_name"))
120 yCInfo(GoogleSpeechSynthesizerParamsCOMPONENT) <<
"Parameter 'voice_name' using value:" <<
m_voice_name;
124 yCInfo(GoogleSpeechSynthesizerParamsCOMPONENT) <<
"Parameter 'voice_name' using DEFAULT value:" <<
m_voice_name;
126 prop_check.
unput(
"voice_name");
131 if (config.
check(
"voice_speed"))
134 yCInfo(GoogleSpeechSynthesizerParamsCOMPONENT) <<
"Parameter 'voice_speed' using value:" <<
m_voice_speed;
138 yCInfo(GoogleSpeechSynthesizerParamsCOMPONENT) <<
"Parameter 'voice_speed' using DEFAULT value:" <<
m_voice_speed;
140 prop_check.
unput(
"voice_speed");
145 if (config.
check(
"voice_pitch"))
148 yCInfo(GoogleSpeechSynthesizerParamsCOMPONENT) <<
"Parameter 'voice_pitch' using value:" <<
m_voice_pitch;
152 yCInfo(GoogleSpeechSynthesizerParamsCOMPONENT) <<
"Parameter 'voice_pitch' using DEFAULT value:" <<
m_voice_pitch;
154 prop_check.
unput(
"voice_pitch");
159 if (config.
check(
"default_voices"))
166 std::string tempBots = tempBot->
toString();
167 for (
size_t i=0; i<tempBot->
size(); i++)
174 yCError(GoogleSpeechSynthesizerParamsCOMPONENT) <<
"parameter 'default_voices' is not a properly formatted bottle";
177 yCInfo(GoogleSpeechSynthesizerParamsCOMPONENT) <<
"Parameter 'default_voices' using value:" <<
m_default_voices;
181 yCInfo(GoogleSpeechSynthesizerParamsCOMPONENT) <<
"Parameter 'default_voices' using DEFAULT value:" <<
m_default_voices;
183 prop_check.
unput(
"default_voices");
188 if (config.
check(
"voice_fallback"))
191 yCInfo(GoogleSpeechSynthesizerParamsCOMPONENT) <<
"Parameter 'voice_fallback' using value:" <<
m_voice_fallback;
195 yCInfo(GoogleSpeechSynthesizerParamsCOMPONENT) <<
"Parameter 'voice_fallback' using DEFAULT value:" <<
m_voice_fallback;
197 prop_check.
unput(
"voice_fallback");
232 doc = doc + std::string(
"\n=============================================\n");
233 doc = doc + std::string(
"This is the help for device: GoogleSpeechSynthesizer\n");
234 doc = doc + std::string(
"\n");
235 doc = doc + std::string(
"This is the list of the parameters accepted by the device:\n");
236 doc = doc + std::string(
"'language_code': Language for speech synthesis (e.g. \"it-IT\", \"en-US\")\n");
237 doc = doc + std::string(
"'voice_name': The voice set for speech synthesis. If not set, the device will pick the first available voice for the selected language code (This page holds the complete list of the available voices: https://cloud.google.com/text-to-speech/docs/voices)\n");
238 doc = doc + std::string(
"'voice_speed': Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal native speed supported by the specific voice. 2.0 is twice as fast, and 0.5 is half as fast.\n");
239 doc = doc + std::string(
"'voice_pitch': Speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20 semitones from the original pitch. -20 means decrease 20 semitones from the original pitch.\n");
240 doc = doc + std::string(
"'default_voices': A set of default voices to be automatically set when you change language. (This page holds the complete list of the available voices: https://cloud.google.com/text-to-speech/docs/voices)\n");
241 doc = doc + std::string(
"'voice_fallback': It enables/disables the automatic setting of the voice name to the first available one if the selected voice is not valid\n");
242 doc = doc + std::string(
"\n");
243 doc = doc + std::string(
"Here are some examples of invocation command with yarpdev, with all params:\n");
244 doc = doc +
" yarpdev --device googleSpeechSynthesizer --language_code <mandatory_value> --voice_name <optional_value> --voice_speed 1 --voice_pitch 0 --default_voices <optional_value> --voice_fallback 1\n";
245 doc = doc + std::string(
"Using only mandatory params:\n");
246 doc = doc +
" yarpdev --device googleSpeechSynthesizer --language_code <mandatory_value>\n";
247 doc = doc + std::string(
"=============================================\n\n");
return doc;
bool getParamValue(const std::string ¶mName, std::string ¶mValue) const override
Return the value (represented as a string) of the requested parameter.
std::string getConfiguration() const override
Return the configuration of the device.
std::string m_provided_configuration
std::vector< std::string > m_default_voices
std::vector< std::string > getListOfParams() const override
Return a list of all params used by the device.
GoogleSpeechSynthesizer_ParamsParser()
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
std::string getDocumentationOfDeviceParams() const override
Get the documentation of the DeviceDriver's parameters.
std::string m_language_code
A simple collection of objects that can be described and transmitted in a portable way.
size_type size() const
Gets the number of elements in the bottle.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
A class for storing options and configuration information.
void unput(const std::string &key)
Remove the association from the given key to a value, if present.
A base class for nested structures that can be searched.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
virtual std::string asString() const
Get string value.
#define yCInfo(component,...)
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)