Let's make a voice slowly with Python

I want to use SofTalk from Python

environment

Preparation

Download SofTalk Please download the latest version from the following page https://w.atwiki.jp/softalk/pages/15.html

Try using SofTalk from the command line

There is also a way to use Softalk from the command line, as described in the included help.chm. Unzip the DL zip

start ..\softalk\Softalk.exe

This will start SofTalk itself and the following arguments will be available

SofTalk argument quick reference table

Excludes arguments that are not available in slow voice (only available in Aquestalk 10)

type value effect Details Remarks
/NM: String Voice designation Specify voice by name Example)/NM:Female 01
/M: 0~? Specify voice by number
/PR: String Preset specification Specify preset by name Example)/PR:Initial setting
/N: 0~? Specify presets by number
/O: 0~300 Interval 声のInterval If you lower it, the reading speed will only decrease, so there may not be much difference from the speed.
/P: reading reading追加 reading(Hiragana),word,all/Distinguish half-width(True/False) Example)/P:Tesuto,Test,True
Update previous words for registered words
/Q: 0~5 How to read 0:No hiragana conversion / no intonation Set for the selected library
1:No hiragana conversion / with intonation
2:With hiragana conversion, without intonation
3:Hiragana conversion Yes / Inflection Yes
4:With hiragana conversion, without intonation, with mishearing
5:Hiragana conversion Yes, Inflection Yes, Song Song Yes
/R: recording 読み上げた文章のrecording Example)/R:c:\test.wav
/S: 1~300 speed 読み上げのspeed
/T: 7~11 Library specification Library (engine) specification 0 for slow Reimu, 1 for slow Marisa voice
7:AquesTalk
8:SAPI
9:Speech Platform
10:AquesTalk2
11:AquesTalk10
/U: 0~? Voice designation Specify voice from library (engine) Set for the selected library
/V: 0~100 Volume 声のVolume
/W: Sentence Sentence 読み上げたいSentence このオプション以降の文字は全てSentenceとみなす
/X: 0~1 Screen display 0:Display 1:Hide Valid only at startup, when exiting/close
/Z: path XML output Output specifiable voice in XML format

It doesn't seem to be particularly difficult if you pay attention to the position of / W.

Try running from python

It's a hassle to type from the command line every time Let Python do the hassle

If you want to execute a command from Python, use the subprocess module [^ subprocess]

I didn't know until I wrote this article, but in Python 3.5 and later, you should use ``` subprocess.run () `` instead of subprocess.call () ``.

** The recommended way to start a subprocess is to use the run () function, which can handle all usages. ** For more advanced usage, you can also use the underlying Popen interface directly. ** The run () function was added in Python 3.5 **; If you need to maintain compatibility with previous versions, see the old high-level API section.

Try to write the code

yukkuri ├yukkuritest.py └softalk (decompressed folder)  └ SofTalk.exe

Imagine a directory structure like this

You can list the commands by space and pass them to the run () function. I thought ... but apparently I have to combine the lists once with a half-width space. So, in simple terms, it looks like this:

yukkuritest.py


import os
import subprocess

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

_start = "start ..\\yukkuri\\softalk\\SofTalk.exe"
_speed = "/S:120"
_word = "/W:Good morning"

_command = [_start, _speed, _word]

subprocess.run(' '.join(_command), shell=True)


Now you can slowly output your voice from Python

[^ subprocess]: subprocess --- Subprocess management https://docs.python.org/ja/3/library/subprocess.html

Recommended Posts

Let's make a voice slowly with Python
Let's make a GUI with python.
Let's make a graph with python! !!
Let's make a shiritori game with Python
Let's make a web framework with Python! (1)
Let's make a Twitter Bot with Python!
Let's make a web framework with Python! (2)
Make a fortune with Python
Let's replace UWSC with Python (5) Let's make a Robot
[Let's play with Python] Make a household account book
Let's make a simple game with Python 3 and iPhone
[Super easy] Let's make a LINE BOT with Python.
Make a recommender system with python
Let's make a supercomputer with xCAT
Let's analyze voice with Python # 1 FFT
Let's make a websocket client with Python. (Access token authentication)
Let's create a free group with Python
Let's make a simple language with PLY 1
[Python] Let's make matplotlib compatible with Japanese
Let's make a tic-tac-toe AI with Pylearn 2
Let's make a combination calculation in Python
Make a desktop app with Python with Electron
Let's make a web chat using WebSocket with AWS serverless (Python)!
Voice analysis with python
Voice analysis with python
Make a Twitter trend bot with heroku + Python
[Python] Make a game with Pyxel-Use an editor-
I want to make a game with Python
Try to make a "cryptanalysis" cipher with Python
[Python] Make a simple maze game with Pyxel
Try to make a dihedral group with Python
Let's make a module for Python using SWIG
[Ev3dev] Let's make a remote control program by Python with RPyC protocol
Make one repeating string with a Python regular expression.
Let's make a Discord Bot.
Try to make a command standby tool with python
Let's run Excel with Python
[Practice] Make a Watson app with Python! # 2 [Translation function]
[Practice] Make a Watson app with Python! # 1 [Language discrimination]
Make a simple Slackbot with interactive button in python
Let's make Othello with wxPython
Make a breakpoint on the c layer with python
Make Puyo Puyo AI with Python
Let's make dice with tkinter
Make a bookmarklet in Python
Let's make dependency management with pip a little easier
[For play] Let's make Yubaba a LINE Bot (Python)
Let's write python with cinema4d.
Make a CSV formatting tool with Python Pandas PyInstaller
Let's make a Mac app with Tkinter and py2app
Let's make a spherical grid with Rhinoceros / Grasshopper / GHPython
Create a directory with python
Let's make a rock-paper-scissors game
Let's build git-cat with Python
What is God? Make a simple chatbot with python
[Piyopiyokai # 1] Let's play with Lambda: Creating a Python script
If you want to make a discord bot with python, let's use a framework
Make a fire with kdeplot
[Practice] Make a Watson app with Python! # 3 [Natural language classification]
Associate Python Enum with a function and make it Callable
Let's create a script that registers with Ideone.com in Python.