c++ - How can I enumerate available voices and languages using espeak API? -
i using espeak api c++ simple text speech synthesis embedded app. currently, have copied line basic example on how started:
espeak_setvoicebyname("default");
this seems work fine, know espeak comes several voices in several different languages. how can enumerate , later select them using espeak api?
the documentation espeak api headerfile itself. can find here.
to enumerate existing voices, can use this:
const espeak_voice **list=espeak_listvoices(0); espeak_voice *voice=0; for(;*list!=0;++list){ voice=*list; if(0!=voice){ //look @ voice parameters such has voice->name here } }
later when have found voice want use, can set this:
if(0!=voice){ espeak_setvoicebyproperties(voice); }
the espeak_voice
struct defined this:
typedef struct { const char *name; // given name voice. utf8 string. const char *languages; // list of pairs of (byte) priority + (string) language (and dialect qualifier) const char *identifier; // filename voice within espeak-data/voices unsigned char gender; // 0=none 1=male, 2=female, unsigned char age; // 0=not specified, or age in years unsigned char variant; // used when passed parameter espeak_setvoicebyproperties unsigned char xx1; // internal use int score; // internal use void *spare; // internal use } espeak_voice;
Comments
Post a Comment