[PYTHON] Have Aozora Bunko read slowly

Last time, I wrote how to make voice slowly from Python This time, let's have Aozora Bunko read slowly

environment

DL and shaping of Aozora Bunko text

I thought I'd write this from scratch, but some people have already done the same thing, so I'm grateful to use it.

I want to get the text from Aozora Bunko in Python --AI Artificial Intelligence Technology

The main () function of the code introduced on this site returns the character string of the body.

def main():
    #Omission
    return text

Have them read slowly

Let's actually read it slowly

If the text is broken, it will not be read after that, so let's loop for each line break and read it. It will be executed sequentially, so you will not be interrupted by the next text while reading.

Get the text of Aozora Bunko Place ʻaozora.py` in the same hierarchy

yukkuritest2.py


import os
import subprocess
import aozora

aozora_text_splitline = aozora.main().splitlines()

os.chdir(os.path.dirname(os.path.abspath(__file__)))

_start = "start ..\\yukkuri\\softalk\\SofTalk.exe"

_speed = "/S:120"

_word = "/W:"

for i in aozora_text_splitline:
    _command = [_start, _speed, _word + i]
    subprocess.run(' '.join(_command), shell=True)

This should read it As a short sentence, let's have Ryunosuke Akutagawa read it with Our Lady of Commerce [^ seibo].

...... The accuracy is very low.

[^ seibo]: Book card: Our Lady of Commerce https://www.aozora.gr.jp/cards/000879/card3813.html

Recommended Posts

Have Aozora Bunko read slowly
Have Aozora Bunko read slowly: More accurately
Have Aozora Bunko read slowly: Code improvement
Let's have Aozora Bunko summarized while talking with COTOHA
Have python read the command output