以前、ドキュメントトーカーという音声エンジンソフトを購入しインストールしたときにAquesTalk(俗に言うゆっくりボイス)も一緒に入っていました。
はじめ、python2.7を用いて動作させていたときは使用できる音声エンジンの中にAquesTalkが含まれていたのですが、python3.6に変更してからは選択できなくなりました。
AquesTalkを使うことが必須、python3じゃないとダメ、ということはないので使えないならそれでもいいのですが不思議に感じました。
問い合わせに質問しようにもドキュメントトーカーさんかアクエストさんかどちらに問い合わせればいいかもわからずとりあえずここに投稿しました。
できればpython3でAquesTalkを使用したいので解決方法等ありましたらよろしくお願いします。
以下念の為コードを…
Python
1# -*- coding: utf-8; -*- 2 3from win32com.client import constants 4import win32com.client 5import sys 6 7#speech = win32com.client.Dispatch("Speech.SpVoice") 8speech = win32com.client.Dispatch("Sapi.SpVoice") 9SVSFlag = 11 # SVSFIsXML | SVSFlagsAsync | SVSFPurgeBeforeSpeak 10 11 12voiceInfo = speech.GetVoices() 13voices = 20*[''] 14for i in range(voiceInfo.Count): 15 voices[i] = voiceInfo.Item(i).GetAttribute("Name") 16 print ("(" + str(i) + ") " + voices[i]) 17 18while 1: 19 voiceNo = int(input('Voice 0 to ' + str(voiceInfo.Count-1)+ ' : ')) 20 print (voiceInfo.Count) 21 if 0 <= voiceNo and voiceNo < voiceInfo.Count: 22 print (voiceNo) 23 break 24 25 26while 1: 27 volume = int(input('Volume 0 to 100 : ')) 28 if 0 <= volume and volume<= 100: 29 print 30 break 31 32while 1: 33 rate = int(input('Rate -10 to 10 : ')) 34 if -10 <= rate and rate <= 10: 35 break 36 37while 1: 38 pitch = int(input('Pitch -10 to 10 : ')) 39 if -10 <= pitch and pitch <= 10: 40 break 41try: 42 speech.Voice = voiceInfo.Item(voiceNo) 43except: 44 print ("fail to set property (by assign)") 45 try: 46 speech.SetVoice(voiceInfo.Item(voiceNo)) 47 except: 48 print ("fail to set property (by SetXXX)") 49speech.Volume = volume 50speech.Rate = rate 51 52while 1: 53 str = input("Input : ") 54 if len(str)==0: 55 sys.exit() 56 print (str) 57 str = str.replace("<","<") 58 str = str.replace("[","<voice required=\"Gender = Male \">") 59 str = str.replace("]","</voice>") 60 str = "<pitch absmiddle=\"%s\">%s</pitch>"%(pitch,str) 61 speech.Speak(str,SVSFlag) 62
あなたの回答
tips
プレビュー