本文介绍了为什么我的espeak-ng程序没有说什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我想将一个字符串传递给espeak-ng,然后通过声音读取我的字符串! 我尝试了什么: 我搜索并找到了这个程序并做了一些修改,将它从意大利语改为英语,但没有用! I want to pass a string to espeak-ng and it reads my string by sound!What I have tried:I searched and find this program and did a little modification to change it to English from Italian, but didn't work!#include <string.h>#include <malloc.h>#include <espeak-ng/speak_lib.h>espeak_POSITION_TYPE position_type;espeak_AUDIO_OUTPUT output;char *path=NULL;int Buflength = 500, Options=0;void* user_data;t_espeak_callback *SynthCallback;espeak_PARAMETER Parm;//char Voice[] = {"lt+klatt2"};char text[30] = {"this is a english test"};unsigned int Size,position=0, end_position=0, flags=espeakCHARS_AUTO, *unique_identifier;int main(int argc, char* argv[] ) { output = AUDIO_OUTPUT_PLAYBACK; int I, Run = 1, L; espeak_Initialize(output, Buflength, path, Options ); //espeak_SetVoiceByName(Voice); //const char *langNativeString = "lt"; //Default to US English espeak_VOICE voice;memset(&voice, 0, sizeof(espeak_VOICE)); // Zero out the voice first//voice.languages = langNativeString;//voice.name = "klatt";voice.variant = 2;voice.gender = 1;espeak_SetVoiceByProperties(&voice); Size = strlen(text)+1; printf("Saying '%s'",text); espeak_Synth( text, Size, position, position_type, end_position, flags, unique_identifier, user_data ); espeak_Synchronize( ); printf("\n:Done\n"); return 0;} 然后我尝试更改这样的代码: Then I tried to change the code like this:#include <string.h>#include <malloc.h>#include <espeak-ng/speak_lib.h>espeak_POSITION_TYPE position_type;espeak_AUDIO_OUTPUT output;char *path=NULL;int Buflength = 500, Options=0;void* user_data;t_espeak_callback *SynthCallback;espeak_PARAMETER Parm;char Voice[] = {"English"};char text[30] = {"this is a english test"};unsigned int Size,position=0, end_position=0, flags=espeakCHARS_AUTO, *unique_identifier;int main(int argc, char* argv[] ) { output = AUDIO_OUTPUT_PLAYBACK; int I, Run = 1, L; espeak_Initialize(output, Buflength, path, Options ); espeak_SetVoiceByName(Voice); const char *langNativeString = "en"; //Default to US English espeak_VOICE voice; memset(&voice, 0, sizeof(espeak_VOICE)); // Zero out the voice first voice.languages = langNativeString; voice.name = "US"; voice.variant = 2; voice.gender = 1; espeak_SetVoiceByProperties(&voice); Size = strlen(text)+1; printf("Saying '%s'",text); espeak_Synth( text, Size, position, position_type, end_position, flags, unique_identifier, user_data ); espeak_Synchronize( ); printf("\n:Done\n"); return 0;} 推荐答案 你读过这个吗? https://github.com/espeak-ng/espeak-ng/blob/ master / docs / add_language.md [ ^ ] Did you read this ?https://github.com/espeak-ng/espeak-ng/blob/master/docs/add_language.md[^] 这篇关于为什么我的espeak-ng程序没有说什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-10 19:49