ming vor 3 Jahren
Ursprung
Commit
c8a0203386
1 geänderte Dateien mit 4 neuen und 5 gelöschten Zeilen
  1. 4 5
      main.py

+ 4 - 5
main.py

@@ -241,9 +241,8 @@ def file_prepare(name, name_hash,text_content,image_urls):
     text_file.close()
     text_file.close()
     print("text file made")
     print("text file made")
     #make mp3
     #make mp3
-    language = 'zh-tw'
-    output = gTTS(text=text_content, lang=language, slow=False)
-    output.save(dir_sound+name_hash+".mp3")
+    tts = zhtts.TTS() 
+    tts.text2wav(text_content,dir_sound+name_hash+".mp3")
     print("mp3 file made")
     print("mp3 file made")
     #make title as image
     #make title as image
     txt2image(name, dir_title+name_hash+".png")
     txt2image(name, dir_title+name_hash+".png")
@@ -311,8 +310,8 @@ def file_prepare_v2(name, name_hash,text_content,image_urls):
     language = 'zh-tw'
     language = 'zh-tw'
     txt_idx = 0
     txt_idx = 0
     for txt in text_content:
     for txt in text_content:
-        output = gTTS(text=txt, lang=language, slow=False)
-        output.save(dir_sound+name_hash+"/"+str(txt_idx)+".mp3")
+        tts = zhtts.TTS() 
+        tts.text2wav(txt,dir_sound+name_hash+"/"+str(txt_idx)+".mp3")
         txt_idx+=1
         txt_idx+=1
     print("mp3 file made")
     print("mp3 file made")
     #make title as image
     #make title as image