Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What code makes your python challenge Wu Yifan rap

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

What code makes your python challenge Wu Yifan rap? I believe many inexperienced people are at a loss about it. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

It is said that python can do anything but have a baby.

So as a mature python, listening, speaking, reading and writing is a necessary skill. If you can let python read the specified content and achieve voice broadcasting function, combined with a keyboard with Braille, blind programming is just around the corner, or use python to do a rap to challenge Wu Yifan's position.

1.pyttsx3 library

Here, you only need to call the pyttsx3 library to code. It is very easy to install and enter pip install pyttsx3 in cmd. The following only needs four lines of code to complete the broadcast of the specified content by python.

Import pyttsx3 # Guide package

Engine = pyttsx3.init () # initialization

Engine.say ("I am a row of data") # set the reading content, both in Chinese and English

Engine.runAndWait () # run

two。 Advanced usage

1. Change the voice and color of the personnel

By setting the parameters of engine, you can change the timbre parameters, gender parameters, age parameters of broadcasters in various countries, including ordinary hair and Cantonese, which can be set directly as' com.apple.speech.synthesis.voice.sin-ji','.

Import pyttsx3

Engine = pyttsx3.init ()

Voices = engine.getProperty ('voices')

For voice in voices:

# engine.setProperty ('voice',' com.apple.speech.synthesis.voice.sin-ji') # Cantonese

Engine.setProperty ('voice', voice.id) # cycle to set the voice of various voice broadcasts

Engine.say ('row of data')

Engine.runAndWait ()

two。 Speed of speech

If you feel the speech speed is slow, you can directly use the 'rate' parameter in setProperty to adjust it.

Engine.setProperty ('rate', rate+50)

3. Volume adjustment

If you think the volume is low, you can directly use the 'volume' parameter in setProperty to adjust it.

Engine.setProperty ('volume', volume-0.25) 3. Challenge Wu Yifan

Finally, directly use these four lines of code to challenge Wu Yifan, attach the python dubbing version of the video, you can skip to the 31st second of the video.

Import pyttsx3

Engine = pyttsx3.init ()

Engine.say ("hinder, ready to run out of oil, mud is singing free, collapse, oil"

"long, oil style, wine singing late, collapse oil courtyard, greasy people, lai Li"

"Oh, Chi Rice, Jade, guilty, hate Hao crazy, hey, I cut sex, rebellion, Lai."

"here, Chi Pian, help, like, lie down and give the opponents wax noodles, and my aunt hates to open letters, ah."

")

Engine.runAndWait ()

After reading the above, do you have any code to make your python challenge Wu Yifan rap? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report