Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/692fcfd8-4b44-800f-a184-fa098175a6d5
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== 如果你還沒產生 audio 資料夾的 mp3,可以用這支: ==== <syntaxhighlight lang="python"># generate_audio_gtts.py """ 使用說明: # 先安裝 gTTS: pip install gTTS # 把此檔案放在和 hand_gesture_1_10.py 同一層。 # 執行: python generate_audio_gtts.py # 會在 audio/ 底下產生: * zh_1.mp3 ~ zh_10.mp3 (國語) * tai_1.mp3 ~ tai_10.mp3(暫用 zh-TW TTS 念 POJ 文字,之後可自行錄音覆蓋) """ from gtts import gTTS import os numbers_zh = { 1: "一", 2: "二", 3: "三", 4: "四", 5: "五", 6: "六", 7: "七", 8: "八", 9: "九", 10: "十", } numbers_tai = { 1: "it", 2: "nn̄g", 3: "saⁿ", 4: "sì", 5: "gō͘", 6: "la̍k", 7: "chhit", 8: "peh", 9: "káu", 10: "chap", } out_dir = "audio" if not os.path.exists(out_dir): os.makedirs(out_dir) === 國語 === for n, word in numbers_zh.items(): text = word tts = gTTS(text=text, lang="zh-TW") fn = os.path.join(out_dir, "zh_{}.mp3".format(n)) print("產生:", fn) tts.save(fn) === 「台語」(實際仍用 zh-TW 念 POJ 文字,可之後自行錄音覆蓋) === for n, word in numbers_tai.items(): text = "台語 {}".format(word) tts = gTTS(text=text, lang="zh-TW") fn = os.path.join(out_dir, "tai_{}.mp3".format(n)) print("產生:", fn) tts.save(fn) print("全部產生完成!") </syntaxhighlight>
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)