From 8805665a22669cf30b55d93879fe03e3b2059ac8 Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Sun, 5 Apr 2026 18:53:58 +0200 Subject: [PATCH] Add seed parameter to OmniVoice Generate for consistent voice across chunks OmniVoice chunks long text internally; each chunk is a separate diffusion pass with different random noise, causing voice drift between paragraphs. Setting the same seed before each generate() call anchors the RNG state and keeps the voice consistent. seed=0 means random (default behaviour). Co-Authored-By: Claude Sonnet 4.6 --- nodes/generator.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/nodes/generator.py b/nodes/generator.py index 82de292..5a89eaa 100644 --- a/nodes/generator.py +++ b/nodes/generator.py @@ -87,6 +87,15 @@ class OmniVoiceGenerate: "default": 32, "min": 1, "max": 100, "tooltip": "Diffusion steps. 32 = default quality. 16 = faster, slightly lower quality.", }), + "seed": ("INT", { + "default": 0, "min": 0, "max": 2**32 - 1, + "tooltip": ( + "Random seed for the diffusion sampler. " + "Set the same value across all Generate nodes in an audiobook pipeline " + "to keep the voice consistent between paragraphs/chapters. " + "0 = random (different each run)." + ), + }), }, } @@ -95,7 +104,9 @@ class OmniVoiceGenerate: FUNCTION = "generate" CATEGORY = "OmniVoice" - def generate(self, model, text, mode, ref_audio=None, ref_text="", instruct="", speed=1.0, num_step=32): + def generate(self, model, text, mode, ref_audio=None, ref_text="", instruct="", speed=1.0, num_step=32, seed=0): + if seed != 0: + torch.manual_seed(seed) kwargs = {"text": text, "speed": speed, "num_step": num_step} if mode == "voice_cloning" and ref_audio is None: