teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

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

2018/05/06 03:39

投稿

tyobit
tyobit

スコア17

title CHANGED
File without changes
body CHANGED
@@ -1,6 +1,7 @@
1
1
  ### 前提・実現したいこと
2
2
 
3
3
  合成音声エンジンを用いてコマンドプロンプトに入力された文字を読み上げるプログラムをPythonを用いて作成中です。
4
+ 使用できる音声エンジンを表示し、使用する音声エンジン・音量・ピッチ・スピードを入力した後に読み上げる文章を打ち込む形となっています。
4
5
 
5
6
  ### 発生している問題・エラーメッセージ
6
7
 
@@ -35,14 +36,44 @@
35
36
 
36
37
  while 1:
37
38
  voiceNo = int(raw_input('Voice 0 to ' + str(voiceInfo.Count-1)+ ' : '))
39
+ print voiceInfo.Count
38
- if 0 <= voiceNo and voiceNo <= voiceInfo.Count:
40
+ if 0 <= voiceNo and voiceNo < voiceInfo.Count:
39
41
  print voiceNo
40
42
  break
41
43
 
42
- (中略)
43
44
 
45
+ while 1:
46
+ volume = int(raw_input('Volume 0 to 100 : '))
47
+ if 0 <= volume and volume<= 100:
48
+ print
49
+ break
50
+
51
+ while 1:
52
+ rate = int(raw_input('Rate -10 to 10 : '))
53
+ if -10 <= rate and rate <= 10:
54
+ print
55
+ break
56
+
57
+ while 1:
58
+ pitch = int(raw_input('Pitch -10 to 10 : '))
59
+ if -10 <= pitch and pitch <= 10:
60
+ print
61
+ break
62
+
44
63
  speech.Voice = voiceInfo.Item(voiceNo) #43行目
64
+ speech.Volume = volume
65
+ speech.Rate = rate
45
66
 
67
+ while 1:
68
+ str = raw_input("Input : ")
69
+ if len(str)==0:
70
+ sys.exit()
71
+ print str
72
+ str = str.replace("<","&lt;")
73
+ str = "<pitch absmiddle=\"%s\">%s</pitch>"%(pitch,str)
74
+ speech.Speak(str,SVSFlag)
75
+
76
+
46
77
  ```
47
78
 
48
79
  ### 試したこと