Home  >  Article  >  Operation and Maintenance  >  Can tts be used in linux?

Can tts be used in linux?

青灯夜游
青灯夜游Original
2023-03-09 19:14:032430browse

Can. In Linux, you can use the Ekho software to implement the TTS (text-to-speech) function; you only need to download and install the Ekho software, and you can use the ekho command to convert text to speech, with the syntax "ekho "text"". Ekho is a free, open source Chinese speech synthesis software that supports Linux, Windows and Android platforms.

Can tts be used in linux?

The operating environment of this tutorial: linux7.3 system, Ekho 8.6, Dell G3 computer.

Linux system implements TTS (text to speech) function

1. Requirement background

In the process of user interaction software development, voice prompt requirements are often encountered. Voice prompts are a relatively direct way of interaction and can effectively improve user experience. Currently, the more common solutions include Baidu Voice Platform and iFlytek Voice Platform. These platforms generally call online services through APIs. The advantage is that the converted voice is relatively accurate, pronounced by real people, and there are a variety of voice package options. The disadvantage is that it relies on the Internet, cannot be used when the network is disconnected, requires a fee, and has a limit on the number of uses. Of course, you can choose offline SDK development for these platforms. Different platforms provide different SDK platforms. There is currently no support for the embedded arm platform. Of course, if the voice prompts are relatively few and relatively fixed, it is also a simple and fast solution to record the voice first and play the voice file directly when using it.

For the embedded arm platform, the Linux system is used. When there is no network and the voice prompt is uncertain, the TTS engine can only be used to solve the problem. After many searches, I finally found an open source Chinese TTS software Ekho (Yuyin) that is more suitable.

#2. Introduction to Ekho

Ekho (Yuyin) is a free, open source Chinese speech synthesis software. It currently supports Cantonese, Mandarin (Mandarin), Guangdong Taishan dialect, Zhao'an Hakka, Tibetan, Yayan (the lingua franca of ancient China) and Korean (under trial), and English is implemented indirectly through eSpeak or Festival. Ekho supports Linux, Windows and Android platforms.

Ekho download address: http://www.eguidedog.net/cn/ekho_cn.php

3. Ekho installation

3.1 Download Ekho

Can tts be used in linux?

##3.2 Installation Ekho

First install the third-party dependency files. Note that the latest version of ekho relies on the espeak-ng library instead of espeak, which has stopped maintenance.

sudo apt-get install espeak-ng  libespeak-ng-dev  libsndfile1-dev libpulse-dev libncurses5-dev libestools-dev festival-dev libvorbis-dev libmp3lame-dev libdotconf-dev texinfo pulseaudio libpulse-ocaml-dev

3.3 Compile and install
tar xJvf ekho-xxx.tar.xz
cd ekho-xxx
./configure
make  -j4
sudo make install

Note: Please replace xxx with the specific file path.

4. Test the Ekho effect

##Directly generate voice playback

ekho  "你好呀"
If the sound can not be played normally, there may be a problem with the system's sound card settings, please check. Another reason may be that the pulseaudio service has not been started.

pulseaudio -start

Execute ekho "Hello!" again, and you will hear a mechanical voice.

Generate voice files

ekho "你好。请继续保持努力!" -o holdon.wav
Finally set the pulseaudio service to automatically start at boot. This step is set as needed

pulseaudio --start --log-target=syslog

in /etc/rc.local Add

pulseaudio --start --log-target=syslog

to the file to set it to start automatically every time you turn on the computer. Related recommendations: "

Linux Video Tutorial

"

The above is the detailed content of Can tts be used in linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn