質問編集履歴

1

プログラム全体を載せました

2018/05/06 03:39

投稿

tyobit
tyobit

スコア17

test CHANGED
File without changes
test CHANGED
@@ -3,6 +3,8 @@
3
3
 
4
4
 
5
5
  合成音声エンジンを用いてコマンドプロンプトに入力された文字を読み上げるプログラムをPythonを用いて作成中です。
6
+
7
+ 使用できる音声エンジンを表示し、使用する音声エンジン・音量・ピッチ・スピードを入力した後に読み上げる文章を打ち込む形となっています。
6
8
 
7
9
 
8
10
 
@@ -72,7 +74,9 @@
72
74
 
73
75
  voiceNo = int(raw_input('Voice 0 to ' + str(voiceInfo.Count-1)+ ' : '))
74
76
 
77
+ print voiceInfo.Count
78
+
75
- if 0 <= voiceNo and voiceNo <= voiceInfo.Count:
79
+ if 0 <= voiceNo and voiceNo < voiceInfo.Count:
76
80
 
77
81
  print voiceNo
78
82
 
@@ -80,11 +84,69 @@
80
84
 
81
85
 
82
86
 
87
+
88
+
89
+ while 1:
90
+
91
+ volume = int(raw_input('Volume 0 to 100 : '))
92
+
93
+ if 0 <= volume and volume<= 100:
94
+
83
- (中略)
95
+ print
96
+
97
+ break
98
+
99
+
100
+
101
+ while 1:
102
+
103
+ rate = int(raw_input('Rate -10 to 10 : '))
104
+
105
+ if -10 <= rate and rate <= 10:
106
+
107
+ print
108
+
109
+ break
110
+
111
+
112
+
113
+ while 1:
114
+
115
+ pitch = int(raw_input('Pitch -10 to 10 : '))
116
+
117
+ if -10 <= pitch and pitch <= 10:
118
+
119
+ print
120
+
121
+ break
84
122
 
85
123
 
86
124
 
87
125
  speech.Voice = voiceInfo.Item(voiceNo) #43行目
126
+
127
+ speech.Volume = volume
128
+
129
+ speech.Rate = rate
130
+
131
+
132
+
133
+ while 1:
134
+
135
+ str = raw_input("Input : ")
136
+
137
+ if len(str)==0:
138
+
139
+ sys.exit()
140
+
141
+ print str
142
+
143
+ str = str.replace("<","&lt;")
144
+
145
+ str = "<pitch absmiddle=\"%s\">%s</pitch>"%(pitch,str)
146
+
147
+ speech.Speak(str,SVSFlag)
148
+
149
+
88
150
 
89
151
 
90
152