[PYTHON] Speaking Japanese with gTTS (reading a text file)

I did the same thing with gTTS. Japanese utterance with OpenJtalk (reading out text file)

kusamakura02.py


#! /usr/bin/python
#
#	kusamakura02.py
#
#						Nov/01/2020
#
# --------------------------------------------------------------------
from gtts import gTTS
import sys
# --------------------------------------------------------------------
sys.stderr.write("***start***\n")
file_in = sys.argv[1]
file_out = sys.argv[2]
#
fp_in = open(file_in,encoding='utf-8')
text_aa = fp_in.read()
fp_in.close()
#
tts = gTTS(text=text_aa, lang='ja')
tts.save(file_out)
sys.stderr.write("***End***\n")
# --------------------------------------------------------------------

Execution method

./kusamakura02.py in01.txt out01.mp3
#
mpg321 out01.mp3

Recommended Posts

Speaking Japanese with gTTS (reading a text file)
Speaking Japanese with OpenJtalk (reading a text file)
Create a large text file with shellscript
Speaking Japanese with OpenJtalk
Convert a text file with hexadecimal values to a binary file
Export a gzip-compressed text file
Build a deb file with Docker
Speak Japanese text with OpenJTalk + python
Create a file uploader with Django
Creating a simple PowerPoint file with Python
Extract lines that match the conditions from a text file with python
Extract Japanese text from PDF with PDFMiner
Create a VM with a YAML file (KVM)
Read a character data file with numpy
Create a matrix with PythonGUI (text box)
I made a configuration file with Python
I want to display only different lines of a text file with diff
Replace the named entity in the read text file with a label (using GiNZA)
Draw a graph with Japanese labels in Jupyter
Create a GUI executable file created with tkinter
CRLF becomes LF when reading a Python file
Create a PDF file with a random page size
"Inline" Sublime Text plugin callbacks with a generator
Create a python3 build environment with Sublime Text3
I tried reading a CSV file using Python
Save the object to a file with pickle
Draw a graph with matplotlib from a csv file
Extract zip with Python (Japanese file name support)
Create a Photoshop format file (.psd) with python
Wav file generation from numeric text with python
Read line by line from a file with Python
I want to write to a file with Python
Open a file dialog with a python GUI (tkinter.filedialog)
Create a cylinder with open3d + STL file output
When reading a csv file with read_csv of pandas, the first column becomes index
Japanese with matplotlib
[Blender] Complement Blender's Python API with a text editor
Make a function to describe Japanese fonts with OpenCV
Type after reading an excel file with pandas read_excel
I tried reading data from a file using Node.js.
Run a Python file with relative import in PyCharm
[Python] Create a Tkinter program distribution file with cx_Freeze
Create a Japanese OCR environment with Anaconda (tesseract + pyocr)
Set up a Python development environment with Sublime Text 2
Create a 2d CAD file ".dxf" with python [ezdxf]
When reading an image with SimpleITK, there is a problem if there is Japanese in the path