diff --git a/README.md b/README.md index 41473d6..4134abd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# πŸ”— Comfyui : Bjornulf_custom_nodes v0.67 πŸ”— +# πŸ”— Comfyui : Bjornulf_custom_nodes v0.68 πŸ”— A list of 120 custom nodes for Comfyui : Display, manipulate, create and edit text, images, videos, loras, generate characters and more. You can manage looping operations, generate randomized content, trigger logical conditions, pause and manually control your workflows and even work with external AI tools, like Ollama or Text To Speech. @@ -362,6 +362,7 @@ cd /where/you/installed/ComfyUI && python main.py - **0.65**: ❗Breaking changes : Combine Text inputs are now all optional (PLease remake your nodes, sorry.) Add 6 new nodes : any2int, any2float, load text from folder, load text from path, load lora from path. Also upgraded the Save text node. - **0.66**: Add lora hunyuan CIVIT ai + download, add TTS configuration node, edit requirements.txt - **0.67**: Add kokoro TTS node. +- **0.68**: Update kokoro TTS node with connect_to_workflow and same outputs as XTTS. # πŸ“ Nodes descriptions diff --git a/pyproject.toml b/pyproject.toml index 5251bb8..9bcc0f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "bjornulf_custom_nodes" description = "120 ComfyUI nodes : Display, manipulate, and edit text, images, videos, loras, generate characters and more. Manage looping operations, generate randomized content, use logical conditions and work with external AI tools, like Ollama or Text To Speech Kokoro, etc..." -version = "0.67" +version = "0.68" license = {file = "LICENSE"} [project.urls] diff --git a/screenshots/kokoro_tts.png b/screenshots/kokoro_tts.png index df488a0..2af81c2 100644 Binary files a/screenshots/kokoro_tts.png and b/screenshots/kokoro_tts.png differ diff --git a/text_to_speech_kokoro.py b/text_to_speech_kokoro.py index c8e1612..08ae484 100644 --- a/text_to_speech_kokoro.py +++ b/text_to_speech_kokoro.py @@ -2,6 +2,10 @@ import os import requests import random +class Everything(str): + def __ne__(self, __value: object) -> bool: + return False + VOICE_OPTIONS = { "af_bella": "Bella (American Female) - af_bella", "af_nicole": "Nicole (American Female) - af_nicole", @@ -61,16 +65,20 @@ class KokoroTTS: "save_audio": ("BOOLEAN", {"default": True}), "overwrite": ("BOOLEAN", {"default": False}), "seed": ("INT", {"default": 0}), + }, + "optional": { + "connect_to_workflow": (Everything("*"), {"forceInput": True}), } } - RETURN_TYPES = ("AUDIO",) + RETURN_TYPES = ("AUDIO", "STRING", "STRING", "FLOAT") + RETURN_NAMES = ("AUDIO", "audio_path", "audio_full_path", "audio_duration") FUNCTION = "generate_audio" CATEGORY = "Bjornulf/Kokoro" def generate_audio(self, text: str, voice: str, language: str, speed: float, autoplay: bool, save_audio: bool, - overwrite: bool, seed: int): + overwrite: bool, seed: int, connect_to_workflow: any = None): random.seed(seed) config = { @@ -138,8 +146,8 @@ class KokoroTTS: audio_tensor = torch.from_numpy(samples).unsqueeze(0) audio_output = {"waveform": audio_tensor.unsqueeze(0), "sample_rate": sample_rate} - return (audio_output,) + return (audio_output, save_path, full_path, len(samples) / sample_rate) except Exception as e: print(f"Error in Kokoro TTS: {e}") - return ({"waveform": torch.zeros(1, 1, 1), "sample_rate": 22050},) \ No newline at end of file + return ({"waveform": torch.zeros(1, 1, 1), "sample_rate": 22050}, "", "", 0.0)