[PYTHON] Create an audio file with the text-to-speech function with Google Text To Speak and check the text as a guide for the speech for 3 minutes.

Read aloud text with Google Text To Speak How to measure a rough speech time. I wrote an article because I had to give a speech for 3 minutes recently and I needed to find out how long it would take to read the manuscript roughly. First at the terminal

Put the voice reading package in and create an mp3 file with the reading function of hello.txt that describes the text. Since the file has the entire time information (how many minutes will it be displayed in the music app?) You can check the rough reading time of the 3-minute speech manuscript.


from gtts import gTTS

f = open('hello.txt','r',encoding="utf-8")
data1 = f.read()  #Returns the data read all the way to the end of the file
f.close()
tts = gTTS(text=data1, lang='ja')
tts.save("good.mp3")


Recommended Posts

Create an audio file with the text-to-speech function with Google Text To Speak and check the text as a guide for the speech for 3 minutes.
Zip-compress any file with the [shell] command to create a file and delete the original file.
Create a command to search for similar compounds from the target database with RDKit and check the processing time
Have Google Text-to-Speech create audio data (narration) for video material (with C # and Python samples)
[Python] If you create a file with the same name as the module to be imported, an Attribute Error will occur.
Create an alias for Route53 to CloudFront with the AWS API
Create a temporary file with django as a zip file and return it
Create and return a CP932 CSV file for Excel with Chalice
Create a large text file with shellscript
How to save the feature point information of an image in a file and use it for matching
Function to extract the maximum and minimum values ​​in a slice with Go
Attempt to launch another .exe and save the console output to a text file
Create a clean DB for testing with FastAPI and unittest the API with pytest
Save the object to a file with pickle
[Django] Test to send a file by POST and check the returned context [TDD]
Try to create a waveform (audio spectrum) that moves according to the sound with python
Create a function to visualize / evaluate the clustering result
How to create a submenu with the [Blender] plugin
Convert a text file with hexadecimal values to a binary file
Create a tweet heatmap with the Google Maps API
Check the argument type annotation when executing a function in Python and make an error
Parse the Researchmap API in Python and automatically create a Word file for the achievement list
I also tried to imitate the function monad and State monad with a generator in Python
Create a 2D array by adding a row to the end of an empty array with numpy