tts joinery
v1.0.4
TTS-Joinery는 Python 라이브러리 및 CLI 도구로 텍스트 음성 API의 길이 제한을 해결합니다.
현재 인기있는 API는 4096 자로 제한 되므로이 라이브러리는 다음과 같습니다.
현재 OpenAI API만이 지원되며 향후 더 많은 것을 추가 할 의도로 지원됩니다.
pip install tts-joinery 또는 pipx 사용하여 독립형 도구로 설치하십시오.
오디오 파일 처리에는 ffmpeg가 필요합니다 .
설치는 시스템에 따라 다를 수 있습니다. Linux에서는 시스템 패키지 관리자를 사용할 수 있습니다. Mac brew install ffmpeg 작동해야합니다.
CLI는 OPENAI_API_KEY 환경 변수 또는 .env 파일에서 OpenAI API 키를 찾을 것으로 예상합니다.
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 clearPython 프로젝트의 일부로 TTS-Joinery를 사용할 수도 있습니다.
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는 사전에 문제를 점검하고 PR을 열어 줄 수 있습니다. 코드는 검은 색으로 형식화됩니다.
테스트는 수동으로 실행할 수 있습니다. Suite에는 Live API 호출이있는 엔드 투 엔드 테스트가 포함되어 있으며 .env.test 에 OpenAi_api_key가 설정하고 pytest 실행해야합니다. pip install -e .[test]
특별한 감사 :
이 프로젝트는 MIT 라이센스에 따라 라이센스가 부여됩니다.
Copyright 2024, Adrien Delessert