Skip to content

Commit

Permalink
Lexicon launch file option
Browse files Browse the repository at this point in the history
  • Loading branch information
BennyR committed May 9, 2014
1 parent e963037 commit 22b82b1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions cerevoice_tts/launch/tts.launch
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
license: $(env HOME)/cerevoice_sdk/voices/license.lic
- path: $(env HOME)/cerevoice_sdk/voices/cerevoice_heather_3.0.8_22k.voice
license: $(env HOME)/cerevoice_sdk/voices/cereproc_license.lic
lexicon: $(env HOME)/cerevoice_sdk/example_data/additional.lex
</rosparam>
<node name="cerevoice_tts_node" pkg="cerevoice_tts" type="cerevoice_tts_node" respawn="false" output="screen" />
</launch>
17 changes: 15 additions & 2 deletions cerevoice_tts/src/CerevoiceTts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@ bool CerevoiceTts::init()
{
std::string path = xml_value[i]["path"];
std::string license = xml_value[i]["license"];
std::string lexicon = xml_value[i]["lexicon"];

ROS_DEBUG("voice no. %d: %s", i + 1, path.c_str());
ROS_DEBUG("license no. %d: %s", i + 1, license.c_str());
ROS_DEBUG("lexicon no. %d: %s", i + 1, lexicon.c_str());

if(path.empty())
{
Expand All @@ -130,10 +132,21 @@ bool CerevoiceTts::init()
success = CPRCEN_engine_load_voice(engine_, license.c_str(), NULL, path.c_str(), CPRC_VOICE_LOAD);
if(!success)
{
ROS_ERROR("Unable to load voice file %s!", path.c_str());
ROS_ERROR("Unable to load voice file '%s'!", path.c_str());
return false;
}
ROS_INFO("Loaded voice %s.", CPRCEN_engine_get_voice_info(engine_, i * -1 + xml_value.size() - 1, "VOICE_NAME"));
int voice_index = i * -1 + xml_value.size() - 1;
ROS_INFO("Loaded voice %s.", CPRCEN_engine_get_voice_info(engine_, voice_index, "VOICE_NAME"));

if(!lexicon.empty())
{
if(!CPRCEN_engine_load_user_lexicon(engine_, voice_index, lexicon.c_str()))
ROS_ERROR("Could not load lexicon '%s'", lexicon.c_str());
else
ROS_INFO("Added lexicon '%s' to voice %s", lexicon.c_str(),
CPRCEN_engine_get_voice_info(engine_, voice_index, "VOICE_NAME"));

}
}
}
catch(XmlRpc::XmlRpcException &ex)
Expand Down

0 comments on commit 22b82b1

Please sign in to comment.