RHEL7.2上基于eSpeak实现TTS
RHEL7.2上已經自帶了eSpeak庫。
eSpeak是一個小型的、開放源碼的語音合成系統,支持多種語言。eSpeak使用共振峰合成方法,這可以使提供的語言文件非常小。該系統支持Windows平臺上的SAPI5,所以能用于屏幕閱讀程序和其他支持Windows SAPI5接口的程序。eSpeak可以將文本轉換成音素代碼,因此它也可以用于另一個語音合成引擎的前端。
Mandarin Chinese
This speaks Pinyin text and Chinese characters. There is only a simple one-to-one translation of Chinese characters to a single Pinyin pronunciation. There is no attempt yet at recognising different pronunciations of Chinese characters in context, or of recognising sequences of characters as “words”. The eSpeak installation includes a basic set of Chinese characters. More are available in an additional data file for Mandarin Chinese at: http://espeak.sourceforge.net/data/.
直接上源碼:
#include "speak_lib.h" // 包括espeak的頭文件 #include <string.h> #include <unistd.h>int main(int argc, char **argv) {// 初始化espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, NULL, 0);char word[] = "這是我的工作站, 12345";// 設置音源為中文女聲espeak_SetVoiceByName("zh+f2");// 發音espeak_Synth(word, strlen(word) + 1, 0, POS_CHARACTER, 0, espeakCHARS_UTF8, NULL, NULL);// 等一段時間,否則程序會立即退出,聽不到發音sleep(4);char word2[] = "this is my workstation, 12345";// 設置音源為英文女聲espeak_SetVoiceByName("en+f2");// 發音espeak_Synth(word2, strlen(word2) + 1, 0, POS_CHARACTER, 0, espeakCHARS_UTF8, NULL, NULL);// 等一段時間,否則程序會立即退出,聽不到發音sleep(4);// 回收資源espeak_Terminate(); }總結
以上是生活随笔為你收集整理的RHEL7.2上基于eSpeak实现TTS的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: GPL协议 与 LGPL协议
- 下一篇: 物理题求解答