I want to use SofTalk from Python
Download SofTalk Please download the latest version from the following page https://w.atwiki.jp/softalk/pages/15.html
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
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.
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.
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