I :-)あなたを悩まため
engine = pyttsx.init()
voices = engine.getProperty('voices')
for voice in voices:
engine.setProperty('voice', voice.id)
engine.say('The quick brown fox jumped over the lazy dog.')
engine.runAndWait()
申し訳ありませんが、おかげでお役に立てれば。 私はpy7tsxをPythonでwin7 os、 で使用しています。私は音声出力としてpyttsxを使って、小さなAIで作業しています。
pyttsx音声選択クラスは、ここで見つけるSAPI5声、 でうまく動作します。スタートボタン、種類から と
Win7のregedit.exeを 'マイクロソフト\スピーチ\声\トークン\のHKEY_LOCAL_MACHINE \ SOFTWARE \' を実行しますが、マイクロソフトのちょうど1音声(MS-アンナ)
とともにパッケージれています選択肢が増えています。 http://www.microsoft.com/en-us/download/details.aspx?id=27224
MSSpeech_TTS_en-CA_Heather MSSpeech_TTS_en-GB_Hazel MSSpeech_TTS_en-IN_Heera MSSpeech_TTS_en-US_Helen MSSpeech_TTS_en-US_ZiraPro MSSpeech_TTS_en-AU_Hayley
しかし、あなたはまた、ダウンロードしてeSpeakをインストールすることができます。 のインストール中に多くのSAPI5の音声がインストールされていて、何回でもインストールを繰り返すことができます。 ディレクトリには良いドキュメントがあります。 pyttsxを使用すると、使用する音声を直接選択できます。 「トークン」ディレクトリにあるSAPI5音声IDを取得するには
speech_engine = pyttsx.init()
voices = speech_engine.getProperty('voices')
for voice in voices:
print 'voice', voice.id
#speech_engine.setProperty('voice', voice.id)
#speech_engine.say('The quick brown fox')
# here I find I have installed just 1 eSpeak voice into the Tokens DIR;
anna_voice = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Voices\\Tokens\\MS-Anna-1033-20-DSK'
male_voice_1 = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Voices\\Tokens\\eSpeak'
#=====
rate = speech_engine.getProperty('rate')
# the rate should be signed + for faster or - for slower
speech_engine.setProperty('rate', rate-85)
#=====
volume = speech_engine.getProperty('volume')
speech_engine.setProperty('volume', volume+1.0)
#=====
def speak(input_text):
global talking_yes_or_no
i = ''
txt_list = list(input_text)
if len(txt_list) > 0:
for i in txt_list:
if i == '':
txt_list.remove(i)
txt = ''.join(txt_list)
if txt != "":
speech_engine.say(txt)
speech_engine.runAndWait()
#=====
def use_anna_voice():
speech_engine.setProperty('voice', anna_voice)
#=====
def use_male_voice_1():
speech_engine.setProperty('voice', male_voice_1)
#=====
#use_male_voice()
#speak('hello')