最後更新: 2015-08-18
asterisk text to speech engine
# Using Google Translate
http://zaf.github.io/asterisk-googletts/
# Festival
http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/ExternalServices_id291618.html
# espeak
目錄
- Asterisk-espeak Installation
- Asterisk-espeak Example
- espeak
Asterisk-espeak Installation
Installation is a 3-part process:
- installation of Asterisk's development header files,
- installation of the eSpeak TTS engine, and
- installation of the asterisk-espeak module.
Pre-install Package
apt-get install espeak
Manual Install
https://github.com/zaf/Asterisk-eSpeak/archive/master.zip
* Asterisk header files
* libsndfile libraries and header files
* libsamplerate libraries and header files
libsndfile1 - Library for reading/writing audio files
apt-get install libsndfile1 libsndfile1-dev
libresample1 - real-time audio resampling library - shared libraries
apt-get install libresample1 libresample1-dev
apt-get install libsamplerate0 libsamplerate0-dev
Espeak libraries and header files
apt-get install libespeak-dev
/usr/include/libresample.h
make
make install
make samples
Test
asterisk:
boxA*CLI> module load app_espeak.so
boxA*CLI> core show application espeak
Asterisk-espeak Example
extensions.conf
<1>
exten => 1234,n,Espeak("This is a simple espeak test in english.",any)
<2>
;;Read a text file from disk (relative to the channel language) ;;and play it with espeak using the asterisk channel language. exten => 1234,n,ReadFile(MYTEXT=/path/${LANGUAGE}/myfile,200) exten => 1234,n,Espeak("${MYTEXY}",any,${LANGUAGE})
Configure File
/etc/asterisk/espeak.conf
[general] ; The cache is never cleared by the application usecache=yes ; mkdir -p /var/lib/asterisk/espeakcache/ ; chmod 777 /var/lib/asterisk/espeakcache/ ; file: 7b6e76304f2e9c2c354ca113545a6d81.sln cachedir=/var/lib/asterisk/espeakcache/ [voice] voice=en ;speed=130 ;volume=100 ;wordgap=1 ;pitch=40
; 修改完 Setting 後
boxA*CLI> module reload app_espeak.so
espeak
espeak uses speech engine in the libespeak shared library
homepage: http://espeak.sourceforge.net/
Debian Package:
espeak-data - /usr/lib/x86_64-linux-gnu/espeak-data
testing
espeak "This is a test"
espeak -f <text file>
# Writes the speech output to a file in WAV format
保存 file
-w <wave file>
讀其他野
-v <voice filename>
; Sets a Voice for the speech
; -v <voice filename>[+<variant>]
; +m1 +m2 +m3 +m4 +m5 +m6 +m7 for male voices
; +f1 +f2 +f3 +f4 which simulate female voices
espeak -vaf
espeak woman voice
espeak -ven-us+f1 "This is a test" -w test.wav
P.S.
<voice filename> is a file within the espeak-data/voices directory.
# Get the list
espeak --voices
zh-yue Cantonese Chinese en standard default English voice. en-us American English. ..........................
廣東話
http://espeak.sourceforge.net/data/zhy_list.zip
Download this file and extract the zhy_list file into eSpeak's dictsource directory.
From within the dictsource directory, do:
espeak --compile=zh-yue
Full dictionary is not installed for 'zhy'
Can't access (r) file 'zhy_rules'
apt-get install libpulse-dev
wget http://sourceforge.net/projects/e-guidedog/files/eSpeak-Chinese/1.47.11/...
rm -rf espeak-1.47.11-source
tar xJvf espeak-1.47.11-source.tar.xz
cd espeak-1.47.11-source/dictsource
espeak --compile=zhy
Full dictionary is not installed for 'zhy' Using phonemetable: 'zhy' Compiling: 'zhy_list' 33744 entries Compiling: 'zhy_rules' 79 rules, 27 groups (0)
測試:
espeak -vzhy 123 -w test.wav