In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "how to make Linux terminals read text aloud". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
For devices that can't read text aloud, there is a gadget that enables text-speaking converters. Write something in various languages and espeak can read it to you.
The system should have Espeak installed by default. If your system is not installed, you can use the following command to install it:
The code is as follows:
# apt-get install espeak (Debian)
# yum install espeak (CentOS)
# dnf install espeak (Fedora 22 and beyond)
You can ask espeak to accept interactive input from standard input and translate it into voice in time. As follows:
The code is as follows:
$espeak [press enter]
For more detailed output, you can do this:
The code is as follows:
$espeak-- stdout | aplay [press enter key] [enter again]
Espeak settings are flexible, and you can also read text files aloud. You can set it like this:
The code is as follows:
$espeak-- stdout / path/to/text/file/file_name.txt | aplay [Hit Enter]
Espeak can set the reading speed. The default speed is 160 words per minute. Use the-s parameter to set it.
Set the speed of 30 words per minute:
The code is as follows:
$espeak-s 30-f / path/to/text/file/file_name.txt | aplay
Set the speed of 200 words per minute:
The code is as follows:
$espeak-s 200-f / path/to/text/file/file_name.txt | aplay
You can use a variety of languages and let espeak read aloud in the language of your choice, as mentioned above. Use the following command to get a list of languages:
The code is as follows:
$espeak-voices
Let's share an example of calling espeak in a C language program:
Copy the content to the clipboard with Candlestick + Code
# include / / including the header file of espeak
# include
# include
Int main (int argc, char * * argv)
{
Char word [] = "eat grapes without spitting grape skins"
Espeak_Initialize (AUDIO_OUTPUT_PLAYBACK, 0, NULL, 0); / / initialize
Espeak_SetVoiceByName ("zh+f2"); / / set the sound source to Chinese female voice
Espeak_Synth (word, strlen (word) + 1, 0, POS_CHARACTER, 0
EspeakCHARS_UTF8, NULL, NULL); / / pronunciation
Sleep (3); / / wait a while, otherwise the program will exit immediately and can't hear the pronunciation.
Espeak_Terminate (); / / Recycling resources
}
This is the end of the content of "Tips for making Linux terminals read text aloud". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.