TTS-JOINERY เป็นไลบรารี Python และเครื่องมือ CLI เพื่อแก้ไขข้อจำกัดความยาวใน API แบบข้อความเป็นคำพูด
เนื่องจาก API ที่ได้รับความนิยมในปัจจุบันถูก จำกัด ไว้ที่ 4096 อักขระไลบรารีนี้จะ:
ปัจจุบันมีเพียง OpenAI API เท่านั้นที่ได้รับการสนับสนุนโดยมีความตั้งใจที่จะเพิ่มมากขึ้นในอนาคต
pip install tts-joinery หรือใช้ pipx เพื่อติดตั้งเป็นเครื่องมือแบบสแตนด์อโลน
ต้องใช้ FFMPEG สำหรับการประมวลผลไฟล์เสียง
การติดตั้งอาจแตกต่างกันไปขึ้นอยู่กับระบบของคุณ บน Linux คุณสามารถใช้ System Package Manager ของคุณ บน Mac brew install ffmpeg ควรทำงาน
CLI คาดว่าจะค้นหาคีย์ OpenAI API ในตัวแปรสภาพแวดล้อม OPENAI_API_KEY หรือในไฟล์. ENV
ttsjoin [OPTIONS] [COMMAND]
Options:
--input-file FILENAME Plaintext file to process into speech, otherwise stdin
--output-file FILENAME MP3 result, otherwise stdout
--model TEXT Slug of the text-to-speech model to be used
--service TEXT API service (currently only supports openai)
--voice TEXT Slug of the voice to be used
--no-cache BOOLEAN Disable caching
--help Show this message and exit.
Commands:
cache [clear, show]
ttsjoin --input-file input.txt --output-file output.mp3 --model tts-1 --service openai --voice onyx echo " Your text to be processed " | ttsjoin > output.mp3ttsjoin --input-file input.txt --output-file output.mp3 --no-cachettsjoin cache clearนอกจากนี้คุณยังสามารถใช้ TTS-Joinery เป็นส่วนหนึ่งของโครงการ Python ของคุณ:
import nltk
from joinery . op import JoinOp
from joinery . api . openai import OpenAIApi
# Only need to download once, handled for you automatically in the CLI
nltk . download ( 'punkt_tab' , quiet = True )
tts = JoinOp (
text = 'This is only a test!' ,
api = OpenAIApi (
model = 'tts-1-hd' ,
voice = 'onyx' ,
api_key = OPENAI_API_KEY ,
),
)
tts . process_to_file ( 'output.mp3' )ยินดีต้อนรับการมีส่วนร่วมโดยเฉพาะอย่างยิ่ง TTS API อื่น ๆ ตรวจสอบปัญหาล่วงหน้าและอย่าลังเลที่จะเปิดการประชาสัมพันธ์ รหัสถูกจัดรูปแบบด้วยสีดำ
การทดสอบสามารถเรียกใช้ได้ด้วยตนเอง Suite รวมถึงการทดสอบแบบ end-to-end ด้วยการโทรสด API ตรวจสอบให้แน่ใจว่าคุณมีชุด openai_api_key ใน .env.test และเรียกใช้ pytest คุณสามารถติดตั้งการพัฒนาการพัฒนาด้วย pip install -e .[test]
ขอขอบคุณเป็นพิเศษ:
โครงการนี้ได้รับใบอนุญาตภายใต้ใบอนุญาต MIT
ลิขสิทธิ์ 2024, Adrien Delessert