1

C++のespeak APIを使用して、組み込みアプリから単純なテキストから音声への合成を行っています。現在、開始方法に関する基本的な例から次の行をコピーしました。

espeak_SetVoiceByName("default"); 

これはうまくいくようですが、espeak にはいくつかの異なる言語のいくつかの音声が付属していることを知っています。それらを列挙し、後でespeak APIを使用してそれらを選択するにはどうすればよいですか?

4

2 に答える 2

1

使用したespeak_SetVoiceByProperties関数のすぐ下に定義されている関数を使用します。

#ifdef __cplusplus
extern "C"
#endif
ESPEAK_API espeak_ERROR espeak_SetVoiceByName(const char *name);
/* Searches for a voice with a matching "name" field.  Language is not considered.
   "name" is a UTF8 string.

   Return: EE_OK: operation achieved
           EE_BUFFER_FULL: the command can not be buffered;
             you may try after a while to call the function again.
       EE_INTERNAL_ERROR.
*/

#ifdef __cplusplus
extern "C"
#endif
ESPEAK_API espeak_ERROR espeak_SetVoiceByProperties(espeak_VOICE *voice_spec);
/* An espeak_VOICE structure is used to pass criteria to select a voice.  Any of the following
   fields may be set:

   name     NULL, or a voice name

   languages  NULL, or a single language string (with optional dialect), eg. "en-uk", or "en"

   gender   0=not specified, 1=male, 2=female

   age      0=not specified, or an age in years

   variant  After a list of candidates is produced, scored and sorted, "variant" is used to index
            that list and choose a voice.
            variant=0 takes the top voice (i.e. best match). variant=1 takes the next voice, etc
*/

espeak_VOICE構造は定義され、そのすぐ上に文書化されています。

要求に応じて音声を列挙する関数は、引用したespeak_ListVoices関数のすぐ上に定義されています。

于 2015-03-28T21:32:58.040 に答える