2025/08/18

espeak-ng

How To Install espeak-ng on CentOS 8 | Installati.one

How to install eSpeak on CentOS 8 / Ubuntu 20.04 / 18.04? - Linux Windows and android Tutorials

eSpeak NG 安装和配置指南-CSDN博客

eSpeak NG,適用於 Linux 的文本到語音合成器

eSpeak NG (Next Generation) Text-to-Speech 是 open source speech synthesizer。使用了共振峰合成方法,用比較小的程式提供多種語言的合成方法。

1995年 Jonathan Duddington 提出在 RISC OS 運作,支援 British English 的語音合成器,後來在 2006/2/17,speak 1.05 以 GPLv2 released。目前已重新命名為 eSpeak

2010/6/25 Reece Dunn 在 github 以 1.43.46 版發起 eSpeak 的 fork,致力於讓 eSpeak 運作在其他 POSIX plarforms。到了 2015/12/11 epeak-ng 啟動,支援更多語言,且做了更多 bug fix。

CLI

# espeak-ng --help
eSpeak NG text-to-speech: 1.49.2  Data at: /usr/share/espeak-ng-data

espeak-ng [options] ["<words>"]

-f <text file>   Text file to speak
--stdin    Read text input from stdin instead of a file

If neither -f nor --stdin, then <words> are spoken, or if none then text
is spoken from stdin, each line separately.

-a <integer>
       Amplitude, 0 to 200, default is 100
-d <device>
       Use the specified device to speak the audio on. If not specified, the
       default audio device is used.
-g <integer>
       Word gap. Pause between words, units of 10mS at the default speed
-k <integer>
       Indicate capital letters with: 1=sound, 2=the word "capitals",
       higher values indicate a pitch increase (try -k20).
-l <integer>
       Line length. If not zero (which is the default), consider
       lines less than this length as end-of-clause
-p <integer>
       Pitch adjustment, 0 to 99, default is 50
-s <integer>
       Speed in approximate words per minute. The default is 175
-v <voice name>
       Use voice file of this name from espeak-ng-data/voices
-w <wave file name>
       Write speech to this WAV file, rather than speaking it directly
-b       Input text encoding, 1=UTF8, 2=8 bit, 4=16 bit
-m       Interpret SSML markup, and ignore other < > tags
-q       Quiet, don't produce any speech (may be useful with -x)
-x       Write phoneme mnemonics to stdout
-X       Write phonemes mnemonics and translation trace to stdout
-z       No final sentence pause at the end of the text
--compile=<voice name>
       Compile pronunciation rules and dictionary from the current
       directory. <voice name> specifies the language
--compile-debug=<voice name>
       Compile pronunciation rules and dictionary from the current
       directory, including line numbers for use with -X.
       <voice name> specifies the language
--compile-mbrola=<voice name>
       Compile an MBROLA voice
--compile-intonations
       Compile the intonation data
--compile-phonemes=<phsource-dir>
       Compile the phoneme data using <phsource-dir> or the default phsource directory
--ipa      Write phonemes to stdout using International Phonetic Alphabet
--path="<path>"
       Specifies the directory containing the espeak-ng-data directory
--pho      Write mbrola phoneme data (.pho) to stdout or to the file in --phonout
--phonout="<filename>"
       Write phoneme output from -x -X --ipa and --pho to this file
--punct="<characters>"
       Speak the names of punctuation characters during speaking.  If
       =<characters> is omitted, all punctuation is spoken.
--sep=<character>
       Separate phonemes (from -x --ipa) with <character>.
       Default is space, z means ZWJN character.
--split=<minutes>
       Starts a new WAV file every <minutes>.  Used with -w
--stdout   Write speech output to stdout
--tie=<character>
       Use a tie character within multi-letter phoneme names.
       Default is U+361, z means ZWJ character.
--version  Shows version number and date, and location of espeak-ng-data
--voices=<language>
       List the available voices for the specified language.
       If <language> is omitted, then list all voices.
-h, --help Show this help.
# espeak-ng --voices
Pty Language       Age/Gender VoiceName          File                 Other Languages
 5  af              --/M      Afrikaans          gmw/af
 5  am              --/M      Amharic            sem/am
 5  an              --/M      Aragonese          roa/an
 5  ar              --/M      Arabic             sem/ar
 5  as              --/M      Assamese           inc/as
 5  az              --/M      Azerbaijani        trk/az
 5  bg              --/M      Bulgarian          zls/bg
 5  bn              --/M      Bengali            inc/bn
 5  bpy             --/M      Bishnupriya_Manipuri inc/bpy
 5  bs              --/M      Bosnian            zls/bs
 5  ca              --/M      Catalan            roa/ca
 5  cmn             --/M      Chinese_(Mandarin) sit/cmn              (zh-cmn 5)(zh 5)
 5  cs              --/M      Czech              zlw/cs
 5  cy              --/M      Welsh              cel/cy
 5  da              --/M      Danish             gmq/da
 5  de              --/M      German             gmw/de
 5  el              --/M      Greek              grk/el
 5  en-029          --/M      English_(Caribbean) gmw/en-029           (en 10)
 2  en-gb           --/M      English_(Great_Britain) gmw/en               (en 2)
 5  en-gb-scotland  --/M      English_(Scotland) gmw/en-GB-scotland   (en 4)
 5  en-gb-x-gbclan  --/M      English_(Lancaster) gmw/en-GB-x-gbclan   (en-gb 3)(en 5)
 5  en-gb-x-gbcwmd  --/M      English_(West_Midlands) gmw/en-GB-x-gbcwmd   (en-gb 9)(en 9)
 5  en-gb-x-rp      --/M      English_(Received_Pronunciation) gmw/en-GB-x-rp       (en-gb 4)(en 5)
 2  en-us           --/M      English_(America)  gmw/en-US            (en 3)
 5  eo              --/M      Esperanto          art/eo
 5  es              --/M      Spanish_(Spain)    roa/es
 5  es-419          --/M      Spanish_(Latin_America) roa/es-419           (es-mx 6)(es 6)
 5  et              --/M      Estonian           urj/et
 5  eu              --/M      Basque             eu
 5  fa              --/M      Persian            ira/fa
 5  fa-Latn         --/M      Persian_(Pinglish) ira/fa-Latn
 5  fi              --/M      Finnish            urj/fi
 5  fr-be           --/M      French_(Belgium)   roa/fr-BE            (fr 8)
 5  fr-ch           --/M      French_(Switzerland) roa/fr-CH            (fr 8)
 5  fr-fr           --/M      French_(France)    roa/fr               (fr 5)
 5  ga              --/M      Gaelic_(Irish)     cel/ga
 5  gd              --/M      Gaelic_(Scottish)  cel/gd
 5  gn              --/M      Guarani            sai/gn
 5  grc             --/M      Greek_(Ancient)    grk/grc
 5  gu              --/M      Gujarati           inc/gu
 5  hi              --/M      Hindi              inc/hi
 5  hr              --/M      Croatian           zls/hr               (hbs 5)
 5  hu              --/M      Hungarian          urj/hu
 5  hy              --/M      Armenian_(East_Armenia) ine/hy               (hy-arevela 5)
 5  hy-arevmda      --/M      Armenian_(West_Armenia) ine/hy-arevmda       (hy 8)
 5  ia              --/M      Interlingua        art/ia
 5  id              --/M      Indonesian         poz/id
 5  is              --/M      Icelandic          gmq/is
 5  it              --/M      Italian            roa/it
 5  ja              --/M      Japanese           jpx/ja
 5  jbo             --/M      Lojban             art/jbo
 5  ka              --/M      Georgian           ccs/ka
 5  kl              --/M      Greenlandic        esx/kl
 5  kn              --/M      Kannada            dra/kn
 5  ko              --/M      Korean             ko
 5  kok             --/M      Konkani            inc/kok
 5  ku              --/M      Kurdish            ira/ku
 5  ky              --/M      Kyrgyz             trk/ky
 5  la              --/M      Latin              itc/la
 5  lfn             --/M      Lingua_Franca_Nova art/lfn
 5  lt              --/M      Lithuanian         bat/lt
 5  lv              --/M      Latvian            bat/lv
 5  mi              --/M      poz/mi             poz/mi
 5  mk              --/M      Macedonian         zls/mk
 5  ml              --/M      Malayalam          dra/ml
 5  mr              --/M      Marathi            inc/mr
 5  ms              --/M      Malay              poz/ms
 5  mt              --/M      Maltese            sem/mt
 5  my              --/M      Burmese            sit/my
 5  nb              --/M      Norwegian_Bokmål  gmq/nb               (no 5)
 5  nci             --/M      Nahuatl_(Classical) azc/nci
 5  ne              --/M      Nepali             inc/ne
 5  nl              --/M      Dutch              gmw/nl
 5  om              --/M      Oromo              cus/om
 5  or              --/M      Oriya              inc/or
 5  pa              --/M      Punjabi            inc/pa
 5  pap             --/M      Papiamento         roa/pap
 5  pl              --/M      Polish             zlw/pl
 5  pt              --/M      Portuguese_(Portugal) roa/pt               (pt-pt 5)
 5  pt-br           --/M      Portuguese_(Brazil) roa/pt-BR            (pt 6)
 5  ro              --/M      Romanian           roa/ro
 5  ru              --/M      Russian            zle/ru
 5  sd              --/M      Sindhi             inc/sd
 5  si              --/M      Sinhala            inc/si
 5  sk              --/M      Slovak             zlw/sk
 5  sl              --/M      Slovenian          zls/sl
 5  sq              --/M      Albanian           ine/sq
 5  sr              --/M      Serbian            zls/sr
 5  sv              --/M      Swedish            gmq/sv
 5  sw              --/M      Swahili            bnt/sw
 5  ta              --/M      Tamil              dra/ta
 5  te              --/M      Telugu             dra/te
 5  tn              --/M      Setswana           bnt/tn
 5  tr              --/M      Turkish            trk/tr
 5  tt              --/M      Tatar              trk/tt
 5  ur              --/M      Urdu               inc/ur
 5  vi              --/M      Vietnamese_(Northern) aav/vi
 5  vi-vn-x-central --/M      Vietnamese_(Central) aav/vi-VN-x-central
 5  vi-vn-x-south   --/M      Vietnamese_(Southern) aav/vi-VN-x-south
 5  yue             --/M      Chinese_(Cantonese) sit/yue              (zh-yue 5)(zh 8)

espeak-ng-data 的路徑

ls /usr/share/espeak-ng-data
af_dict   ca_dict  eu_dict   hu_dict      kl_dict   lv_dict    ne_dict            phontab  sr_dict  voices
am_dict   cs_dict  fa_dict   hy_dict      kn_dict   mbrola_ph  nl_dict            pl_dict  sv_dict  zh_dict
an_dict   cy_dict  fi_dict   ia_dict      ko_dict   mi_dict    no_dict            pt_dict  sw_dict  zhy_dict
ar_dict   da_dict  fr_dict   id_dict      kok_dict  mk_dict    om_dict            ro_dict  ta_dict
as_dict   de_dict  ga_dict   intonations  ku_dict   ml_dict    or_dict            ru_dict  te_dict
az_dict   el_dict  gd_dict   is_dict      ky_dict   mr_dict    pa_dict            sd_dict  tn_dict
bg_dict   en_dict  grc_dict  it_dict      la_dict   ms_dict    pap_dict           si_dict  tr_dict
bn_dict   eo_dict  gu_dict   ja_dict      lang      mt_dict    phondata           sk_dict  tt_dict
bpy_dict  es_dict  hi_dict   jbo_dict     lfn_dict  my_dict    phondata-manifest  sl_dict  ur_dict
bs_dict   et_dict  hr_dict   ka_dict      lt_dict   nci_dict   phonindex          sq_dict  vi_dict

從已編譯的 espeak-ng 版本是 1.49.2 版,但安裝後發現該版本不支援中文

# rpm -qa|grep espeak
espeak-ng-1.49.2-4.el8.x86_64

到 github 下載 1.52 版

wget https://github.com/espeak-ng/espeak-ng/archive/refs/tags/1.52.0.tar.gz

直接編譯

ref: questions about mandarin data packet · Issue #1044 · espeak-ng/espeak-ng · GitHub

./autogen.sh
./configure --with-extdict-cmn

這邊最後要看到

        Extended Dictionaries:
            Russian:                   yes
            Chinese (Mandarin):        yes
            Chinese (Cantonese):       yes

編譯

make
make install

測試

espeak-ng -v cmn "english text 你好 more english text" -w test1.wav

沒有留言:

張貼留言