v1.3.3 Fixed errors due to audio encoding. Fixed minor widget issue.

- Fixed duration_seconds input
- Both duration settings are now shown by default
- Audio latent fix
This commit is contained in:
WhatDreamsCost
2026-05-15 17:35:11 -05:00
parent b8161d3cc0
commit e4db1fc892
10 changed files with 40 additions and 36 deletions

View File

@@ -378,7 +378,7 @@ class LTXDirector(io.ComfyNode):
return io.Schema(
node_id="LTXDirector",
display_name="LTX Director",
category="conditioning/prompt_relay",
category="WhatDreamsCost",
description=(
"Same as Prompt Relay Encode, but local prompts and segment lengths are edited "
"visually as draggable blocks on a timeline. The duration_frames input only sets the "
@@ -584,9 +584,11 @@ class LTXDirector(io.ComfyNode):
if audio_vae is not None:
# Helper to generate empty latent
def get_empty_latent():
# Support both raw AudioVAE objects and ComfyUI VAE wrappers.
inner = getattr(audio_vae, "first_stage_model", audio_vae)
z_channels = audio_vae.latent_channels
audio_freq = audio_vae.first_stage_model.latent_frequency_bins
num_audio_latents = audio_vae.first_stage_model.num_of_latents_from_frames(ltxv_length, float(frame_rate))
audio_freq = inner.latent_frequency_bins
num_audio_latents = inner.num_of_latents_from_frames(ltxv_length, float(frame_rate))
audio_latents = torch.zeros(
(1, z_channels, num_audio_latents, audio_freq),
device=comfy.model_management.intermediate_device(),
@@ -597,8 +599,23 @@ class LTXDirector(io.ComfyNode):
try:
if audio_out is not None:
# 1. Encode audio waveform into latent space
# VAE expects shape (batch, samples, channels), so we move dim 1 (channels) to the end
latent_samples = audio_vae.encode(audio_out["waveform"].movedim(1, -1))
waveform = audio_out["waveform"]
if waveform.ndim == 2:
waveform = waveform.unsqueeze(0)
if waveform.ndim != 3:
raise ValueError(
f"Expected custom audio waveform with 2 or 3 dims, got shape {tuple(waveform.shape)}"
)
# Wrapped ComfyUI VAE expects (batch, samples, channels);
# raw AudioVAE expects a dict with waveform in (batch, channels, samples).
if hasattr(audio_vae, "first_stage_model"):
latent_samples = audio_vae.encode(waveform.movedim(1, -1))
else:
latent_samples = audio_vae.encode({
"waveform": waveform,
"sample_rate": audio_out["sample_rate"],
})
if latent_samples.numel() == 0:
raise ValueError("Encoded audio latent is empty (0 elements).")
@@ -629,7 +646,8 @@ class LTXDirector(io.ComfyNode):
audio_latent = get_empty_latent()
log.info("[PromptRelay] Auto-generated empty audio latent.")
except Exception as e:
log.warning("[PromptRelay] Could not generate empty audio latent: %s", e)
log.error("[PromptRelay] Could not generate empty audio latent: %s", e)
raise e
return io.NodeOutput(patched, conditioning, latent, audio_latent, guide_data, float(frame_rate), audio_out)