tts joinery
v1.0.4
TTS-JOINERYは、テキスト間APIの長さの制限を回避するためのPythonライブラリおよびCLIツールです。
現在人気の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-Goineryを使用することもできます。
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を自由に開くことができます。コードは黒でフォーマットされています。
テストは手動で実行できます。スイートには、ライブAPI呼び出しを備えたエンドツーエンドテストが含まれており、openai_api_keyが.env.testに設定されていることを確認し、 pytestを実行します。 pip install -e .[test]
特別な感謝:
このプロジェクトは、MITライセンスの下でライセンスされています。
Copyright 2024、Adrien Delessert