Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What code makes your python challenge Wu Yifan rap

Shulou Source: shulou.com Published: 2022-06-02 02:43:48 10月03日 Update

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!

Tags: Parameters Yifan content code Cantonese adjustment one line people skills data methods more video speed voice question volume four lines normal advanced Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Technology vpn Microsoft Apple