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