Update voice_create.py
Browse files- voice_create.py +5 -1
voice_create.py
CHANGED
|
@@ -45,7 +45,11 @@ def text_to_speech(input_file):
|
|
| 45 |
# テキスト内の改行を1sの間に変換
|
| 46 |
text = text.replace("\n", '<break time="1s"/>')
|
| 47 |
text = text.replace(".", '.<break time="500ms"/>')
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
ssml_parts.append(f'<voice name="{voice_name}"><prosody rate="{row["speed"]}"><p>{text}</p></prosody></voice>')
|
| 50 |
print(ssml_parts)
|
| 51 |
ssml = '<speak>' + ''.join(ssml_parts)
|
|
|
|
| 45 |
# テキスト内の改行を1sの間に変換
|
| 46 |
text = text.replace("\n", '<break time="1s"/>')
|
| 47 |
text = text.replace(".", '.<break time="500ms"/>')
|
| 48 |
+
# 「,」で時間を空ける
|
| 49 |
+
if row["eikenn"] in ["5級","4級","3級","準2級","2級"]:
|
| 50 |
+
text = text.replace(",", '.<break time="300ms"/>')
|
| 51 |
+
else:
|
| 52 |
+
|
| 53 |
ssml_parts.append(f'<voice name="{voice_name}"><prosody rate="{row["speed"]}"><p>{text}</p></prosody></voice>')
|
| 54 |
print(ssml_parts)
|
| 55 |
ssml = '<speak>' + ''.join(ssml_parts)
|