yosuke-i commited on
Commit
ced474d
·
verified ·
1 Parent(s): 83813d3

Update voice_create.py

Browse files
Files changed (1) hide show
  1. voice_create.py +5 -1
voice_create.py CHANGED
@@ -18,16 +18,20 @@ def text_to_speech(input_file):
18
  parts = re.split(r'(A:|B:)', row['script'])
19
  print(parts)
20
  ssml_parts = []
21
-
22
  # 交互に発言するAとBの内容を順に処理
23
  for i in range(1, len(parts), 2):
24
  if parts[i] == "A:":
25
  voice_name = row["voiceA"]
 
26
  elif parts[i] == "B:":
27
  voice_name = row["voiceB"]
28
  else:
 
29
  continue # A:またはB:で始まらない行は無視
 
30
  text = parts[i + 1].strip()
 
31
  # テキスト内の改行を1sの間に変換
32
  text = text.replace("\n", '<break time="1s"/>')
33
  ssml_parts.append(f'<voice name="{voice_name}"><prosody rate="{row["speed"]}"><p>{text}</p></prosody></voice>')
 
18
  parts = re.split(r'(A:|B:)', row['script'])
19
  print(parts)
20
  ssml_parts = []
21
+ print(parts)
22
  # 交互に発言するAとBの内容を順に処理
23
  for i in range(1, len(parts), 2):
24
  if parts[i] == "A:":
25
  voice_name = row["voiceA"]
26
+ print("A")
27
  elif parts[i] == "B:":
28
  voice_name = row["voiceB"]
29
  else:
30
+ print("空白")
31
  continue # A:またはB:で始まらない行は無視
32
+
33
  text = parts[i + 1].strip()
34
+ print("テキスト",text)
35
  # テキスト内の改行を1sの間に変換
36
  text = text.replace("\n", '<break time="1s"/>')
37
  ssml_parts.append(f'<voice name="{voice_name}"><prosody rate="{row["speed"]}"><p>{text}</p></prosody></voice>')