diff --git a/apps/studio/src/auditionView.test.ts b/apps/studio/src/auditionView.test.ts
new file mode 100644
index 0000000..7802b5a
--- /dev/null
+++ b/apps/studio/src/auditionView.test.ts
@@ -0,0 +1,45 @@
+import { describe, expect, it } from "vitest";
+import {
+ FULL_VIEW,
+ globalToLocalRatio,
+ localToGlobalRatio,
+ slicePeaksForView,
+ timeAxisTicks,
+ zoomViewWindow,
+} from "./auditionView";
+
+describe("auditionView", () => {
+ it("zooms toward a pivot and stays in [0, 1]", () => {
+ const zoomed = zoomViewWindow(FULL_VIEW, 0.5, 0.25);
+ expect(zoomed.end - zoomed.start).toBeCloseTo(0.5, 5);
+ expect(zoomed.start).toBeGreaterThanOrEqual(0);
+ expect(zoomed.end).toBeLessThanOrEqual(1);
+ // Pivot at 0.25 of full view stays near 0.25 of new window.
+ const pivotGlobal = 0.25;
+ const local = globalToLocalRatio(pivotGlobal, zoomed);
+ expect(local).toBeCloseTo(0.25, 5);
+ });
+
+ it("maps local ↔ global ratios", () => {
+ const window = { start: 0.2, end: 0.6 };
+ expect(localToGlobalRatio(0, window)).toBeCloseTo(0.2);
+ expect(localToGlobalRatio(1, window)).toBeCloseTo(0.6);
+ expect(localToGlobalRatio(0.5, window)).toBeCloseTo(0.4);
+ expect(globalToLocalRatio(0.4, window)).toBeCloseTo(0.5);
+ });
+
+ it("slices peaks for the visible window", () => {
+ const peaks = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
+ expect(slicePeaksForView(peaks, FULL_VIEW)).toEqual(peaks);
+ const mid = slicePeaksForView(peaks, { start: 0.4, end: 0.7 });
+ // last=9 → floor(0.4*9)=3, ceil(0.7*9)=7
+ expect(mid[0]).toBe(3);
+ expect(mid[mid.length - 1]).toBe(7);
+ });
+
+ it("builds time-axis ticks for a window", () => {
+ const ticks = timeAxisTicks({ start: 0, end: 1 }, 2, 5);
+ expect(ticks.length).toBeGreaterThanOrEqual(2);
+ expect(ticks[0]?.label).toBeTruthy();
+ });
+});
diff --git a/apps/studio/src/auditionView.ts b/apps/studio/src/auditionView.ts
new file mode 100644
index 0000000..a68fb03
--- /dev/null
+++ b/apps/studio/src/auditionView.ts
@@ -0,0 +1,125 @@
+/** Shared transport audition view window (zoom / pan) — ratios of full clip [0, 1]. */
+
+export type ViewWindow = {
+ start: number;
+ end: number;
+};
+
+export const FULL_VIEW: ViewWindow = { start: 0, end: 1 };
+
+/** Minimum visible span as a fraction of clip (≈1 ms at 1 s; still usable when zooming samples). */
+export const MIN_VIEW_SPAN = 1 / 50_000;
+
+export function clamp(value: number, min: number, max: number): number {
+ return Math.min(max, Math.max(min, value));
+}
+
+export function viewSpan(window: ViewWindow): number {
+ return Math.max(MIN_VIEW_SPAN, window.end - window.start);
+}
+
+/** Zoom time window around a pivot in *view-local* ratio [0, 1]. factor < 1 zooms in. */
+export function zoomViewWindow(
+ window: ViewWindow,
+ factor: number,
+ pivotInView = 0.5,
+ minSpan = MIN_VIEW_SPAN,
+): ViewWindow {
+ const span = viewSpan(window);
+ const newSpan = clamp(span * factor, minSpan, 1);
+ const pivot = window.start + clamp(pivotInView, 0, 1) * span;
+ let start = pivot - clamp(pivotInView, 0, 1) * newSpan;
+ let end = start + newSpan;
+ if (start < 0) {
+ start = 0;
+ end = newSpan;
+ }
+ if (end > 1) {
+ end = 1;
+ start = 1 - newSpan;
+ }
+ return { start, end };
+}
+
+/** Map pointer ratio inside the visible plot → global clip ratio. */
+export function localToGlobalRatio(local: number, window: ViewWindow): number {
+ return window.start + clamp(local, 0, 1) * viewSpan(window);
+}
+
+/** Map global playhead → position inside the visible plot (may be outside 0–1). */
+export function globalToLocalRatio(global: number, window: ViewWindow): number {
+ const span = viewSpan(window);
+ if (span <= 0) return 0;
+ return (global - window.start) / span;
+}
+
+/** Slice peak envelope to the visible window (inclusive end index). */
+export function slicePeaksForView(peaks: number[], window: ViewWindow): number[] {
+ if (peaks.length === 0) return [];
+ if (window.start <= 0 && window.end >= 1) return peaks;
+ const last = peaks.length - 1;
+ const i0 = clamp(Math.floor(window.start * last), 0, last);
+ const i1 = clamp(Math.ceil(window.end * last), i0, last);
+ return peaks.slice(i0, i1 + 1);
+}
+
+export function formatAxisSeconds(sec: number): string {
+ if (!Number.isFinite(sec) || sec < 0) return "0.00";
+ if (sec < 60) return sec.toFixed(sec < 10 ? 2 : 1);
+ const m = Math.floor(sec / 60);
+ const s = sec - m * 60;
+ return `${m}:${s.toFixed(s < 10 ? 2 : 1).padStart(4, "0")}`;
+}
+
+export function timeAxisTicks(
+ window: ViewWindow,
+ durationSec: number,
+ maxTicks = 6,
+): Array<{ ratio: number; label: string }> {
+ if (!(durationSec > 0) || maxTicks < 2) return [];
+ const startSec = window.start * durationSec;
+ const endSec = window.end * durationSec;
+ const spanSec = Math.max(1e-9, endSec - startSec);
+ const rough = spanSec / (maxTicks - 1);
+ const nice = niceTimeStep(rough);
+ const first = Math.ceil(startSec / nice) * nice;
+ const ticks: Array<{ ratio: number; label: string }> = [];
+ for (let t = first; t <= endSec + nice * 1e-6; t += nice) {
+ if (t < startSec - nice * 1e-6) continue;
+ const ratio = (t - startSec) / spanSec;
+ if (ratio < -0.01 || ratio > 1.01) continue;
+ ticks.push({ ratio: clamp(ratio, 0, 1), label: formatAxisSeconds(t) });
+ }
+ if (ticks.length === 0) {
+ ticks.push(
+ { ratio: 0, label: formatAxisSeconds(startSec) },
+ { ratio: 1, label: formatAxisSeconds(endSec) },
+ );
+ }
+ return ticks;
+}
+
+function niceTimeStep(rough: number): number {
+ if (!(rough > 0)) return 0.01;
+ const exp = Math.floor(Math.log10(rough));
+ const base = Math.pow(10, exp);
+ const err = rough / base;
+ let mult = 1;
+ if (err > 5) mult = 10;
+ else if (err > 2) mult = 5;
+ else if (err > 1) mult = 2;
+ return mult * base;
+}
+
+export function clampAmpZoom(z: number): number {
+ return clamp(z, 1, 32);
+}
+
+export function clampFreqZoom(z: number): number {
+ return clamp(z, 1, 32);
+}
+
+/** Visible Nyquist fraction: 1 = full band, 2 = bottom half of spectrum, etc. */
+export function visibleMaxFreqHz(maxFreqHz: number, freqZoom: number): number {
+ return maxFreqHz / clampFreqZoom(freqZoom);
+}
diff --git a/apps/studio/src/components/ComplianceDrawer.tsx b/apps/studio/src/components/ComplianceDrawer.tsx
index 93d7143..f5c0c9c 100644
--- a/apps/studio/src/components/ComplianceDrawer.tsx
+++ b/apps/studio/src/components/ComplianceDrawer.tsx
@@ -690,8 +690,8 @@ export default function ComplianceDrawer({
) : (
{missingModelCount > 0
- ? `${missingModelCount} model${missingModelCount === 1 ? "" : "s"} will be installed, then the Preview branch will render. Click Play to audition.`
- : "Models are ready. The workflow will render only its Preview branch — click Play to audition."}
+ ? `${missingModelCount} model${missingModelCount === 1 ? "" : "s"} will be installed, then the PreviewAudio branch will render. Click Play to audition.`
+ : "Models are ready. The workflow will render only its PreviewAudio branch — click Play to audition."}
)}
{fastPathError ? (
@@ -720,8 +720,8 @@ export default function ComplianceDrawer({
onClick={() => void runFastPath()}
>
{missingModelCount > 0
- ? "Install chain & render Preview"
- : "Render Preview"}
+ ? "Install chain & render PreviewAudio"
+ : "Render PreviewAudio"}
)}
diff --git a/apps/studio/src/components/NodePalette.tsx b/apps/studio/src/components/NodePalette.tsx
index 35e8d54..8329ffa 100644
--- a/apps/studio/src/components/NodePalette.tsx
+++ b/apps/studio/src/components/NodePalette.tsx
@@ -104,6 +104,7 @@ const CORE_IO = new Set([
"SynthMidi",
"Mix",
"ChannelMerge",
+ "ChannelSplit",
"Note",
"Prompt",
]);
diff --git a/apps/studio/src/components/PreviewVideoTransport.tsx b/apps/studio/src/components/PreviewVideoTransport.tsx
index 2cdeb88..23fe745 100644
--- a/apps/studio/src/components/PreviewVideoTransport.tsx
+++ b/apps/studio/src/components/PreviewVideoTransport.tsx
@@ -55,6 +55,9 @@ export function PreviewVideoTransport({
const onEnded = () => {
setPlaying(false);
setCurrent(video.duration || 0);
+ // Remute after local play so the next transport A/B pass does not leave
+ // an unmuted native track that can click at EOF.
+ video.muted = true;
};
video.addEventListener("loadedmetadata", onMeta);
@@ -86,10 +89,13 @@ export function PreviewVideoTransport({
return;
}
if (video.paused || video.ended) {
+ // Local HTML5 audio only when Space has no PCM listen target (pure T2V).
+ // A/B PreviewVideo should use transport PCM via resolveNodeListenId.
video.muted = false;
void video.play().catch(() => {});
} else {
video.pause();
+ video.muted = true;
}
}, []);
diff --git a/apps/studio/src/components/SpectrogramMini.tsx b/apps/studio/src/components/SpectrogramMini.tsx
index 5c8c85e..90b2b75 100644
--- a/apps/studio/src/components/SpectrogramMini.tsx
+++ b/apps/studio/src/components/SpectrogramMini.tsx
@@ -1,13 +1,45 @@
import { useCallback, useEffect, useRef, useState } from "react";
import type { SpectrogramData } from "../api";
+import {
+ FULL_VIEW,
+ clampFreqZoom,
+ formatAxisSeconds,
+ globalToLocalRatio,
+ localToGlobalRatio,
+ timeAxisTicks,
+ visibleMaxFreqHz,
+ type ViewWindow,
+ zoomViewWindow,
+} from "../auditionView";
+
+export type SpectrogramCell = {
+ timeSec: number;
+ freqHz: number;
+ db: number;
+ col: number;
+ row: number;
+ /** Pointer position within the plot [0, 1] — used to place the readout. */
+ xPct: number;
+ yPct: number;
+};
type Props = {
data: SpectrogramData | null;
- /** Playback position 0–1; draws playhead and played/unplayed styling. */
+ /** Playback position 0–1 of the *full* clip. */
progress?: number;
- /** Click/drag seek callback with ratio 0–1. */
+ /** Click/drag seek callback with *global* ratio 0–1. */
onSeek?: (ratio: number, phase?: "start" | "move" | "end") => void;
+ /** Fired on click (after seek) with the STFT tile under the pointer. */
+ onCellSelect?: (cell: SpectrogramCell) => void;
+ /** Active cell readout (rendered at the selection point). */
+ selectedCell?: SpectrogramCell | null;
+ onCellClear?: () => void;
fitContainer?: boolean;
+ viewWindow?: ViewWindow;
+ onViewWindowChange?: (window: ViewWindow) => void;
+ /** Frequency-axis zoom (1 = full Nyquist, higher = low-band crop). */
+ freqZoom?: number;
+ onFreqZoomChange?: (zoom: number) => void;
className?: string;
};
@@ -36,6 +68,23 @@ function FreqScale({ maxFreqHz }: { maxFreqHz: number }) {
);
}
+function TimeAxis({ viewWindow, durationSec }: { viewWindow: ViewWindow; durationSec: number }) {
+ const ticks = timeAxisTicks(viewWindow, durationSec);
+ return (
+
+ {ticks.map((tick) => (
+
+ {tick.label}
+
+ ))}
+
+ );
+}
+
/** Scientific intensity → black / signal-red / white-hot (palette only; dB mapping unchanged). */
function dbToSignalRgb(db: number, minDb: number, maxDb: number, dim = 1): [number, number, number] {
const span = Math.max(1e-6, maxDb - minDb);
@@ -57,16 +106,50 @@ function dbToSignalRgb(db: number, minDb: number, maxDb: number, dim = 1): [numb
return [Math.round(r * dim), Math.round(g * dim), Math.round(b * dim)];
}
+function cellAtPointer(
+ data: SpectrogramData,
+ viewWindow: ViewWindow,
+ freqZoom: number,
+ clientX: number,
+ clientY: number,
+ rect: DOMRect,
+): SpectrogramCell | null {
+ if (rect.width <= 0 || rect.height <= 0 || data.width <= 0 || data.height <= 0) return null;
+ const localX = ratioFromPointer(clientX, rect);
+ const localY = Math.min(1, Math.max(0, (clientY - rect.top) / rect.height));
+ const globalRatio = localToGlobalRatio(localX, viewWindow);
+ const col = Math.min(data.width - 1, Math.max(0, Math.floor(globalRatio * data.width)));
+ const visibleRows = Math.max(1, Math.floor(data.height / clampFreqZoom(freqZoom)));
+ // STFT values: row 0 = DC. Plot bottom = 0 Hz, top = visibleMax.
+ const rowFromBottom = Math.min(visibleRows - 1, Math.max(0, Math.floor((1 - localY) * visibleRows)));
+ const valueIdx = rowFromBottom * data.width + col;
+ const db = data.values[valueIdx] ?? data.min_db;
+ const visibleMax = visibleMaxFreqHz(data.max_freq_hz, freqZoom);
+ const freqHz = ((rowFromBottom + 0.5) / visibleRows) * visibleMax;
+ const timeSec = ((col + 0.5) / data.width) * data.duration;
+ return { timeSec, freqHz, db, col, row: rowFromBottom, xPct: localX, yPct: localY };
+}
+
export default function SpectrogramMini({
data,
progress = 0,
onSeek,
+ onCellSelect,
+ selectedCell = null,
+ onCellClear,
fitContainer = false,
+ viewWindow = FULL_VIEW,
+ onViewWindowChange,
+ freqZoom = 1,
+ onFreqZoomChange,
className,
}: Props) {
const containerRef = useRef(null);
+ const scaleRef = useRef(null);
const canvasRef = useRef(null);
const [, setMeasureTick] = useState(0);
+ const zoom = clampFreqZoom(freqZoom);
+ const dragMoved = useRef(false);
useEffect(() => {
if (!fitContainer) return;
@@ -79,6 +162,33 @@ export default function SpectrogramMini({
return () => observer.disconnect();
}, [fitContainer]);
+ useEffect(() => {
+ const plot = containerRef.current;
+ if (!plot || !onViewWindowChange) return;
+ const onWheel = (event: WheelEvent) => {
+ event.preventDefault();
+ const rect = plot.getBoundingClientRect();
+ if (rect.width <= 0) return;
+ const pivot = ratioFromPointer(event.clientX, rect);
+ const factor = event.deltaY > 0 ? 1.15 : 1 / 1.15;
+ onViewWindowChange(zoomViewWindow(viewWindow, factor, pivot));
+ };
+ plot.addEventListener("wheel", onWheel, { passive: false });
+ return () => plot.removeEventListener("wheel", onWheel);
+ }, [onViewWindowChange, viewWindow]);
+
+ useEffect(() => {
+ const scale = scaleRef.current;
+ if (!scale || !onFreqZoomChange) return;
+ const onWheel = (event: WheelEvent) => {
+ event.preventDefault();
+ const factor = event.deltaY > 0 ? 1 / 1.12 : 1.12;
+ onFreqZoomChange(clampFreqZoom(zoom * factor));
+ };
+ scale.addEventListener("wheel", onWheel, { passive: false });
+ return () => scale.removeEventListener("wheel", onWheel);
+ }, [onFreqZoomChange, zoom]);
+
const draw = useCallback(() => {
const plot = containerRef.current;
const canvas = canvasRef.current;
@@ -95,27 +205,35 @@ export default function SpectrogramMini({
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
ctx.clearRect(0, 0, width, height);
+ const col0 = Math.max(0, Math.floor(viewWindow.start * data.width));
+ const col1 = Math.min(data.width, Math.ceil(viewWindow.end * data.width));
+ const srcW = Math.max(1, col1 - col0);
+ // values row 0 = DC (low). Zoom crops to the lowest `visibleRows` bins.
+ const visibleRows = Math.max(1, Math.floor(data.height / zoom));
+
const offscreen = document.createElement("canvas");
- offscreen.width = data.width;
- offscreen.height = data.height;
+ offscreen.width = srcW;
+ offscreen.height = visibleRows;
const offCtx = offscreen.getContext("2d");
if (!offCtx) return;
- const image = offCtx.createImageData(data.width, data.height);
+ const image = offCtx.createImageData(srcW, visibleRows);
const pixels = image.data;
const minDb = data.min_db;
const maxDb = data.max_db;
const clampedProgress = Math.min(1, Math.max(0, progress));
const playCol = Math.floor(clampedProgress * data.width);
- for (let y = 0; y < data.height; y++) {
- const srcY = data.height - 1 - y;
- for (let x = 0; x < data.width; x++) {
- const idx = srcY * data.width + x;
+ for (let y = 0; y < visibleRows; y++) {
+ // Display top (y=0) = highest bin in the visible low band.
+ const bandSrcY = visibleRows - 1 - y;
+ for (let x = 0; x < srcW; x++) {
+ const srcX = col0 + x;
+ const idx = bandSrcY * data.width + srcX;
const db = data.values[idx] ?? minDb;
- const dim = x <= playCol || onSeek == null ? 1 : 0.42;
+ const dim = srcX <= playCol || onSeek == null ? 1 : 0.42;
const [r, g, b] = dbToSignalRgb(db, minDb, maxDb, dim);
- const pixel = (y * data.width + x) * 4;
+ const pixel = (y * srcW + x) * 4;
pixels[pixel] = r;
pixels[pixel + 1] = g;
pixels[pixel + 2] = b;
@@ -124,8 +242,8 @@ export default function SpectrogramMini({
}
offCtx.putImageData(image, 0, 0);
ctx.imageSmoothingEnabled = false;
- ctx.drawImage(offscreen, 0, 0, data.width, data.height, 0, 0, width, height);
- }, [data, onSeek, progress, fitContainer]);
+ ctx.drawImage(offscreen, 0, 0, srcW, visibleRows, 0, 0, width, height);
+ }, [data, onSeek, progress, fitContainer, viewWindow, zoom]);
useEffect(() => {
draw();
@@ -135,12 +253,17 @@ export default function SpectrogramMini({
if (!onSeek || !containerRef.current) return;
const rect = containerRef.current.getBoundingClientRect();
if (rect.width <= 0) return;
- onSeek(ratioFromPointer(clientX, rect), phase);
+ const local = ratioFromPointer(clientX, rect);
+ onSeek(localToGlobalRatio(local, viewWindow), phase);
};
+ const visibleMax = visibleMaxFreqHz(data?.max_freq_hz ?? 24_000, zoom);
+ const showTime = Boolean(data && data.duration > 0 && onViewWindowChange);
+
const rootClass = [
"spectrogram-mini",
"spectrogram-mini--with-scale",
+ showTime ? "spectrogram-mini--with-time" : "",
onSeek ? "spectrogram-mini--seekable" : "",
className,
]
@@ -150,7 +273,9 @@ export default function SpectrogramMini({
if (!data?.values.length) {
return (
-
+
+
+
= 0 && localProgress <= 1;
+ const playheadPct = `${Math.min(1, Math.max(0, localProgress)) * 100}%`;
const plotProps = onSeek
? {
onPointerDown: (event: React.PointerEvent
) => {
if (event.button !== 0) return;
event.preventDefault();
+ dragMoved.current = false;
event.currentTarget.setPointerCapture(event.pointerId);
seekFromEvent(event.clientX, "start");
},
onPointerMove: (event: React.PointerEvent) => {
if (!event.currentTarget.hasPointerCapture(event.pointerId)) return;
+ dragMoved.current = true;
seekFromEvent(event.clientX, "move");
},
onPointerUp: (event: React.PointerEvent) => {
@@ -179,6 +307,11 @@ export default function SpectrogramMini({
event.currentTarget.releasePointerCapture(event.pointerId);
}
seekFromEvent(event.clientX, "end");
+ if (!dragMoved.current && onCellSelect && containerRef.current && data) {
+ const rect = containerRef.current.getBoundingClientRect();
+ const cell = cellAtPointer(data, viewWindow, zoom, event.clientX, event.clientY, rect);
+ if (cell) onCellSelect(cell);
+ }
},
onPointerCancel: (event: React.PointerEvent) => {
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
@@ -191,17 +324,63 @@ export default function SpectrogramMini({
return (
-
+
+
+
- {onSeek ?
: null}
+ {onSeek && playheadInView ? (
+
+ ) : null}
+ {selectedCell ? (
+
+
+
0.62 ? "spectrogram-mini__cell-label--left" : "",
+ selectedCell.yPct > 0.7 ? "spectrogram-mini__cell-label--above" : "",
+ ]
+ .filter(Boolean)
+ .join(" ")}
+ >
+ t={formatAxisSeconds(selectedCell.timeSec)}s · f=
+ {selectedCell.freqHz >= 1000
+ ? `${(selectedCell.freqHz / 1000).toFixed(2)}kHz`
+ : `${Math.round(selectedCell.freqHz)}Hz`}{" "}
+ · {selectedCell.db.toFixed(1)} dBFS
+ {onCellClear ? (
+
+ ×
+
+ ) : null}
+
+
+ ) : null}
+ {showTime ?
: null}
+ {showTime ? (
+
+
+
+ ) : null}
);
}
+
+export { formatAxisSeconds };
diff --git a/apps/studio/src/components/TransportBar.tsx b/apps/studio/src/components/TransportBar.tsx
index 17ae215..dafeb1b 100644
--- a/apps/studio/src/components/TransportBar.tsx
+++ b/apps/studio/src/components/TransportBar.tsx
@@ -1,6 +1,12 @@
import { useCallback, useEffect, useRef, useState } from "react";
-import { fetchSpectrogram, type SpectrogramData } from "../api";
-import SpectrogramMini from "./SpectrogramMini";
+import { fetchCacheMeta, fetchSpectrogram, type SpectrogramData } from "../api";
+import {
+ FULL_VIEW,
+ clampAmpZoom,
+ clampFreqZoom,
+ type ViewWindow,
+} from "../auditionView";
+import SpectrogramMini, { type SpectrogramCell } from "./SpectrogramMini";
import StatusLeds, { type StatusLedSpec } from "./StatusLeds";
import WaveformMini from "./WaveformMini";
import MidiRollMini, { type MidiRollNote } from "./MidiRollMini";
@@ -101,6 +107,12 @@ export default function TransportBar({
const [spectrogramLoading, setSpectrogramLoading] = useState(false);
const [spectrogramError, setSpectrogramError] = useState(null);
const [playbackError, setPlaybackError] = useState(null);
+ const [viewWindow, setViewWindow] = useState(FULL_VIEW);
+ const [ampZoom, setAmpZoom] = useState(1);
+ const [freqZoom, setFreqZoom] = useState(1);
+ const [sampleRate, setSampleRate] = useState(48_000);
+ const [specCell, setSpecCell] = useState(null);
+ const waveWrapRef = useRef(null);
const statusFailed = Boolean(
statusMessage?.toLowerCase().includes("fail") || statusMessage?.toLowerCase().startsWith("error"),
);
@@ -263,6 +275,11 @@ export default function TransportBar({
setSpectrogram(null);
setSpectrogramError(null);
setPlaybackError(null);
+ setViewWindow(FULL_VIEW);
+ setAmpZoom(1);
+ setFreqZoom(1);
+ setSpecCell(null);
+ setSampleRate(48_000);
stopRaf();
loadedCacheIdRef.current = null;
loadPromiseRef.current = null;
@@ -308,6 +325,23 @@ export default function TransportBar({
}
}, [waveformDuration]);
+ useEffect(() => {
+ if (!previewUrl || isMidiVisual) return;
+ const cacheId = cacheIdFromPreviewUrl(previewUrl);
+ if (!cacheId) return;
+ let cancelled = false;
+ fetchCacheMeta(cacheId)
+ .then((meta) => {
+ if (cancelled) return;
+ const sr = Number(meta.sample_rate);
+ if (Number.isFinite(sr) && sr > 0) setSampleRate(sr);
+ })
+ .catch(() => undefined);
+ return () => {
+ cancelled = true;
+ };
+ }, [previewUrl, isMidiVisual]);
+
useEffect(() => {
if (audioVisualMode !== "spectrogram" || isMidiVisual || !previewUrl) {
return;
@@ -456,6 +490,42 @@ export default function TransportBar({
return () => window.removeEventListener("keydown", onKey);
}, [running, togglePlayPause]);
+ const stepPlayheadBySamples = useCallback(
+ (deltaSamples: number) => {
+ const dur = timelineDuration();
+ if (!(dur > 0) || !previewUrl || isMidiVisual) return;
+ const sr = Math.max(1, sampleRate);
+ const nextSec = Math.min(dur, Math.max(0, playbackTime + deltaSamples / sr));
+ setPlayheadRatio(nextSec / dur, { commitAudio: true });
+ void ensureBlobLoaded()
+ .then(() => setPlayheadRatio(playheadRatioRef.current, { commitAudio: true }))
+ .catch(() => undefined);
+ },
+ [ensureBlobLoaded, isMidiVisual, playbackTime, previewUrl, sampleRate, setPlayheadRatio, timelineDuration],
+ );
+
+ useEffect(() => {
+ const wrap = waveWrapRef.current;
+ if (!wrap) return;
+ const onKey = (event: KeyboardEvent) => {
+ if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
+ if (event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement) return;
+ if (!previewUrl || isMidiVisual || running) return;
+ event.preventDefault();
+ const step = event.shiftKey ? Math.max(1, Math.round(sampleRate / 100)) : 1;
+ stepPlayheadBySamples(event.key === "ArrowRight" ? step : -step);
+ };
+ wrap.addEventListener("keydown", onKey);
+ return () => wrap.removeEventListener("keydown", onKey);
+ }, [isMidiVisual, previewUrl, running, sampleRate, stepPlayheadBySamples]);
+
+ const resetAuditionView = useCallback(() => {
+ setViewWindow(FULL_VIEW);
+ setAmpZoom(1);
+ setFreqZoom(1);
+ setSpecCell(null);
+ }, []);
+
const transportDisabled = running || !hasPreview;
const canPause = Boolean(previewUrl) && isPlaying && !running;
const canStop = Boolean(previewUrl) && (isPlaying || playbackProgress > 0) && !running;
@@ -522,7 +592,17 @@ export default function TransportBar({
-
+
waveWrapRef.current?.focus()}
+ aria-label={
+ hasPreview && !isMidiVisual
+ ? "Audition display. Scroll plot to zoom time, scroll amplitude/frequency scale to zoom Y. Arrow keys step one sample (Shift+arrow = 10 ms)."
+ : undefined
+ }
+ >
{!isMidiVisual && previewUrl ? (
setAudioVisualMode("spectrogram")}
+ onClick={() => {
+ setAudioVisualMode("spectrogram");
+ setSpecCell(null);
+ }}
title="Spectrogram"
>
Spec
+ {viewWindow.start > 0 ||
+ viewWindow.end < 1 ||
+ ampZoom > 1.01 ||
+ freqZoom > 1.01 ? (
+
+ 1:1
+
+ ) : null}
) : null}
@@ -567,7 +663,6 @@ export default function TransportBar({
fitContainer
className="transport__midi-roll"
/>
-
{emptyHint}
)
) : previewUrl ? (
@@ -576,7 +671,14 @@ export default function TransportBar({
data={spectrogram}
progress={playbackProgress}
onSeek={handleSeek}
+ onCellSelect={setSpecCell}
+ selectedCell={specCell}
+ onCellClear={() => setSpecCell(null)}
fitContainer
+ viewWindow={viewWindow}
+ onViewWindowChange={setViewWindow}
+ freqZoom={freqZoom}
+ onFreqZoomChange={(z) => setFreqZoom(clampFreqZoom(z))}
className="transport__spectrogram"
/>
) : (
@@ -586,13 +688,17 @@ export default function TransportBar({
onSeek={handleSeek}
fitContainer
showScale
+ viewWindow={viewWindow}
+ onViewWindowChange={setViewWindow}
+ ampZoom={ampZoom}
+ onAmpZoomChange={(z) => setAmpZoom(clampAmpZoom(z))}
+ durationSec={displayDuration}
className="transport__waveform"
/>
)
) : (
)}
{hasPreview && !isMidiVisual && audioVisualMode === "spectrogram" && spectrogramLoading ? (
@@ -602,14 +708,24 @@ export default function TransportBar({
{spectrogramError}
) : null}
- {hasPreview ? (
-
- {formatTimeTag(playbackTime)}
- /
- {formatTimeTag(displayDuration)}
-
- ) : null}
- {statusLine ?
{statusLine}
: null}
+
+ {hasPreview ? (
+
+ {formatTimeTag(playbackTime)}
+ /
+ {formatTimeTag(displayDuration)}
+ {!isMidiVisual ? (
+
+ {" "}
+ · n={Math.round(playbackTime * sampleRate)}
+
+ ) : null}
+
+ ) : (
+
{emptyHint}
+ )}
+ {statusLine ?
{statusLine}
: null}
+
{playbackError ? (
{playbackError}
diff --git a/apps/studio/src/components/WaveformMini.tsx b/apps/studio/src/components/WaveformMini.tsx
index bcbc035..a5daf3a 100644
--- a/apps/studio/src/components/WaveformMini.tsx
+++ b/apps/studio/src/components/WaveformMini.tsx
@@ -1,16 +1,34 @@
import { useEffect, useRef, useState } from "react";
+import {
+ FULL_VIEW,
+ clampAmpZoom,
+ globalToLocalRatio,
+ localToGlobalRatio,
+ slicePeaksForView,
+ timeAxisTicks,
+ type ViewWindow,
+ zoomViewWindow,
+} from "../auditionView";
type Props = {
peaks: number[];
/** Target bar count when resampling (overridden when fitContainer is true). */
displayWidth?: number;
- /** Playback position 0–1; draws playhead and played/unplayed styling. */
+ /** Playback position 0–1 of the *full* clip; draws playhead when inside the view. */
progress?: number;
- /** Click/drag seek callback with ratio 0–1. */
+ /** Click/drag seek callback with *global* ratio 0–1. */
onSeek?: (ratio: number, phase?: "start" | "move" | "end") => void;
fitContainer?: boolean;
/** Show linear peak-relative amplitude scale (1 … 0). */
showScale?: boolean;
+ /** Visible time window as ratios of the full clip. */
+ viewWindow?: ViewWindow;
+ onViewWindowChange?: (window: ViewWindow) => void;
+ /** Vertical amplitude magnification (1 = fit peaks to ±1). */
+ ampZoom?: number;
+ onAmpZoomChange?: (zoom: number) => void;
+ /** Full clip duration in seconds — enables time axis. */
+ durationSec?: number;
className?: string;
};
@@ -47,7 +65,7 @@ function WaveformBars({
return (
<>
{samples.map((peak, index) => {
- const amp = (peak / max) * (mid - 2);
+ const amp = Math.min(mid - 2, (peak / max) * (mid - 2));
const x = index + 0.5;
return (
1.01 ? (1 / ampZoom).toFixed(2) : "1";
return (
- +1
+ +{top}
0
- −1
+ −{top}
+
+ );
+}
+
+function TimeAxis({
+ viewWindow,
+ durationSec,
+}: {
+ viewWindow: ViewWindow;
+ durationSec: number;
+}) {
+ const ticks = timeAxisTicks(viewWindow, durationSec);
+ return (
+
+ {ticks.map((tick) => (
+
+ {tick.label}
+
+ ))}
);
}
@@ -82,11 +124,18 @@ export default function WaveformMini({
onSeek,
fitContainer = false,
showScale = false,
+ viewWindow = FULL_VIEW,
+ onViewWindowChange,
+ ampZoom = 1,
+ onAmpZoomChange,
+ durationSec = 0,
className,
}: Props) {
const containerRef = useRef(null);
+ const scaleRef = useRef(null);
const clipId = useRef(`waveform-clip-${Math.random().toString(36).slice(2, 9)}`);
const [containerWidth, setContainerWidth] = useState(displayWidth);
+ const zoom = clampAmpZoom(ampZoom);
useEffect(() => {
if (!fitContainer) {
@@ -102,11 +151,39 @@ export default function WaveformMini({
return () => observer.disconnect();
}, [displayWidth, fitContainer]);
+ useEffect(() => {
+ const plot = containerRef.current;
+ if (!plot || !onViewWindowChange) return;
+ const onWheel = (event: WheelEvent) => {
+ event.preventDefault();
+ const rect = plot.getBoundingClientRect();
+ if (rect.width <= 0) return;
+ const pivot = ratioFromPointer(event.clientX, rect);
+ const factor = event.deltaY > 0 ? 1.15 : 1 / 1.15;
+ onViewWindowChange(zoomViewWindow(viewWindow, factor, pivot));
+ };
+ plot.addEventListener("wheel", onWheel, { passive: false });
+ return () => plot.removeEventListener("wheel", onWheel);
+ }, [onViewWindowChange, viewWindow]);
+
+ useEffect(() => {
+ const scale = scaleRef.current;
+ if (!scale || !onAmpZoomChange) return;
+ const onWheel = (event: WheelEvent) => {
+ event.preventDefault();
+ const factor = event.deltaY > 0 ? 1 / 1.12 : 1.12;
+ onAmpZoomChange(clampAmpZoom(zoom * factor));
+ };
+ scale.addEventListener("wheel", onWheel, { passive: false });
+ return () => scale.removeEventListener("wheel", onWheel);
+ }, [onAmpZoomChange, zoom]);
+
const seekFromEvent = (clientX: number, phase: "start" | "move" | "end") => {
if (!onSeek || !containerRef.current) return;
const rect = containerRef.current.getBoundingClientRect();
if (rect.width <= 0) return;
- onSeek(ratioFromPointer(clientX, rect), phase);
+ const local = ratioFromPointer(clientX, rect);
+ onSeek(localToGlobalRatio(local, viewWindow), phase);
};
const plotProps = onSeek
@@ -136,6 +213,9 @@ export default function WaveformMini({
}
: {};
+ const showTime = durationSec > 0 && Boolean(onViewWindowChange || showScale);
+ const windowed = slicePeaksForView(peaks, viewWindow);
+
if (!peaks.length) {
return (
- {showScale ?
: null}
+ {showScale ? (
+
+
+
+ ) : null}
+ {showTime ?
: null}
+ {showTime ? (
+
+
+
+ ) : null}
);
}
- const samples = resamplePeaks(peaks, containerWidth);
- const max = Math.max(...samples, 0.001);
+ const samples = resamplePeaks(windowed, containerWidth);
+ const peakMax = Math.max(...samples, 0.001);
+ const max = peakMax / zoom;
const width = samples.length;
const height = 40;
const playbackMode = onSeek != null;
- const clampedProgress = Math.min(1, Math.max(0, progress));
+ const localProgress = globalToLocalRatio(progress, viewWindow);
+ const clampedProgress = Math.min(1, Math.max(0, localProgress));
+ const playheadInView = localProgress >= 0 && localProgress <= 1;
const playheadPct = `${clampedProgress * 100}%`;
const clipWidth = clampedProgress * width;
@@ -167,6 +261,7 @@ export default function WaveformMini({
"waveform-mini",
onSeek ? "waveform-mini--seekable" : "",
showScale ? "waveform-mini--with-scale" : "",
+ showTime ? "waveform-mini--with-time" : "",
className,
]
.filter(Boolean)
@@ -185,7 +280,7 @@ export default function WaveformMini({
-
+ {playheadInView ?
: null}
>
) : (
@@ -195,14 +290,25 @@ export default function WaveformMini({
return (
- {showScale ?
: null}
+ {showScale ? (
+
+
+
+ ) : null}
{plot}
+ {showTime ?
: null}
+ {showTime ? (
+
+
+
+ ) : null}
);
}
diff --git a/apps/studio/src/contributionMix.test.ts b/apps/studio/src/contributionMix.test.ts
index fa3f3a0..136447e 100644
--- a/apps/studio/src/contributionMix.test.ts
+++ b/apps/studio/src/contributionMix.test.ts
@@ -47,8 +47,8 @@ const schemas: Record = {
outputs: [{ name: "audio", type: "AUDIO" }],
widgets: [],
},
- Preview: {
- type: "Preview",
+ PreviewAudio: {
+ type: "PreviewAudio",
category: "GroovyUI/Core",
provenance_class: "human_edited",
provenance_passthrough: true,
@@ -90,7 +90,7 @@ describe("computeContributionMix", () => {
{ id: "a", type: "LoadAudio" },
{ id: "b", type: "Denoise" },
{ id: "c", type: "GenerateAudio" },
- { id: "d", type: "Preview" },
+ { id: "d", type: "PreviewAudio" },
{ id: "e", type: "Mix" },
]),
schemas,
diff --git a/apps/studio/src/creativeTabSession.test.ts b/apps/studio/src/creativeTabSession.test.ts
index 8de8858..a03439d 100644
--- a/apps/studio/src/creativeTabSession.test.ts
+++ b/apps/studio/src/creativeTabSession.test.ts
@@ -141,9 +141,9 @@ describe("creativeTabSession", () => {
{
id: "s-preview",
index: 2,
- title: "Preview",
+ title: "PreviewAudio",
rationale: "",
- action: { type: "add_node", node: { id: "n4", type: "Preview", widgets: {} } },
+ action: { type: "add_node", node: { id: "n4", type: "PreviewAudio", widgets: {} } },
},
{
id: "s-save",
@@ -273,9 +273,9 @@ describe("creativeTabSession", () => {
{
id: "s-preview",
index: 1,
- title: "Preview",
+ title: "PreviewAudio",
rationale: "",
- action: { type: "add_node", node: { id: "n3", type: "Preview", widgets: {} } },
+ action: { type: "add_node", node: { id: "n3", type: "PreviewAudio", widgets: {} } },
},
{
id: "s-save",
@@ -352,7 +352,7 @@ describe("creativeTabSession", () => {
});
it("keeps even hop spans and avoids overlapping an existing solid", () => {
- const blocking = { id: "nBlock", type: "Preview", pos: { x: 272, y: 140 }, widgets: {} };
+ const blocking = { id: "nBlock", type: "PreviewAudio", pos: { x: 272, y: 140 }, widgets: {} };
const workflow: Workflow = {
...emptyWorkflow,
nodes: [
diff --git a/apps/studio/src/creativeTabSession.ts b/apps/studio/src/creativeTabSession.ts
index dcfa679..a2eae6d 100644
--- a/apps/studio/src/creativeTabSession.ts
+++ b/apps/studio/src/creativeTabSession.ts
@@ -276,7 +276,7 @@ export function parallelBranchRanks(count: number): number[] {
* Score 0 = stay on the growing signal lane (Denoise, Normalize, Mix, …).
*/
function parallelSortScore(type: string): number {
- if (type === "Preview" || type === "PreviewImage" || type === "PreviewVideo") return -1;
+ if (type === "PreviewAudio" || type === "PreviewImage" || type === "PreviewVideo") return -1;
if (type === "SaveAudio") return 1;
return 0;
}
diff --git a/apps/studio/src/edgePlayback.test.ts b/apps/studio/src/edgePlayback.test.ts
index a5d0909..027693c 100644
--- a/apps/studio/src/edgePlayback.test.ts
+++ b/apps/studio/src/edgePlayback.test.ts
@@ -15,7 +15,7 @@ function chainWorkflow(): Workflow {
nodes: [
{ id: "n1", type: "LoadAudio", pos: { x: 0, y: 0 }, widgets: {} },
{ id: "n2", type: "Normalize", pos: { x: 200, y: 0 }, widgets: {} },
- { id: "n3", type: "Preview", pos: { x: 400, y: 0 }, widgets: {} },
+ { id: "n3", type: "PreviewAudio", pos: { x: 400, y: 0 }, widgets: {} },
],
links: [
{ id: "l1", from: ["n1", 0], to: ["n2", 0], type: "AUDIO" },
diff --git a/apps/studio/src/fastPath.test.ts b/apps/studio/src/fastPath.test.ts
index d7e939c..7a144bb 100644
--- a/apps/studio/src/fastPath.test.ts
+++ b/apps/studio/src/fastPath.test.ts
@@ -13,7 +13,7 @@ const workflow: Workflow = {
metadata: { title: "Fast path" },
nodes: [
{ id: "n1", type: "Denoise", widgets: { model: "model-a" } },
- { id: "n2", type: "Preview", widgets: {} },
+ { id: "n2", type: "PreviewAudio", widgets: {} },
],
links: [{ id: "l1", from: ["n1", 0], to: ["n2", 0], type: "AUDIO" }],
groups: [],
diff --git a/apps/studio/src/fastPath.ts b/apps/studio/src/fastPath.ts
index 3856343..02e0977 100644
--- a/apps/studio/src/fastPath.ts
+++ b/apps/studio/src/fastPath.ts
@@ -28,7 +28,7 @@ export function applyModelSwaps(
/** Select one listenable Preview sink so first audition does not render unrelated exports. */
export function resolveFastPathPreviewTarget(workflow: Workflow): string | null {
- const previews = workflow.nodes.filter((node) => node.type === "Preview");
+ const previews = workflow.nodes.filter((node) => node.type === "PreviewAudio");
const audioPreview = previews.find((preview) =>
workflow.links.some(
(link) => link.to[0] === preview.id && link.type === "AUDIO",
diff --git a/apps/studio/src/fixtures/node_schema_slots.json b/apps/studio/src/fixtures/node_schema_slots.json
index 1a0e6b0..11f1c83 100644
--- a/apps/studio/src/fixtures/node_schema_slots.json
+++ b/apps/studio/src/fixtures/node_schema_slots.json
@@ -417,6 +417,29 @@
"output_layout"
]
},
+ "ChannelSplit": {
+ "inputs": [
+ {
+ "name": "audio",
+ "type": "AUDIO",
+ "optional": false,
+ "slot": 0
+ }
+ ],
+ "outputs": [
+ { "name": "L", "type": "AUDIO", "slot": 0 },
+ { "name": "R", "type": "AUDIO", "slot": 1 },
+ { "name": "ch2", "type": "AUDIO", "slot": 2 },
+ { "name": "ch3", "type": "AUDIO", "slot": 3 },
+ { "name": "ch4", "type": "AUDIO", "slot": 4 },
+ { "name": "ch5", "type": "AUDIO", "slot": 5 },
+ { "name": "ch6", "type": "AUDIO", "slot": 6 },
+ { "name": "ch7", "type": "AUDIO", "slot": 7 }
+ ],
+ "widgets": [
+ "layout"
+ ]
+ },
"Clock": {
"inputs": [],
"outputs": [
@@ -756,9 +779,14 @@
],
"outputs": [
{
- "name": "output_0",
+ "name": "audio",
"type": "AUDIO",
"slot": 0
+ },
+ {
+ "name": "log",
+ "type": "GENERATE_LOG",
+ "slot": 1
}
],
"widgets": [
@@ -788,9 +816,14 @@
],
"outputs": [
{
- "name": "output_0",
+ "name": "audio",
"type": "AUDIO",
"slot": 0
+ },
+ {
+ "name": "log",
+ "type": "GENERATE_LOG",
+ "slot": 1
}
],
"widgets": [
diff --git a/apps/studio/src/generateRequestIssue.test.ts b/apps/studio/src/generateRequestIssue.test.ts
index 2559c85..8ce39c5 100644
--- a/apps/studio/src/generateRequestIssue.test.ts
+++ b/apps/studio/src/generateRequestIssue.test.ts
@@ -64,7 +64,7 @@ describe("prefillFromGenerateBlueprint", () => {
it("sets catalog-template when all nodes known", () => {
const wf: Workflow = {
...sampleWorkflow,
- nodes: [{ id: "n1", type: "Preview", widgets: {} }],
+ nodes: [{ id: "n1", type: "PreviewAudio", widgets: {} }],
links: [],
};
const prefill = prefillFromGenerateBlueprint("template me", {
diff --git a/apps/studio/src/index.css b/apps/studio/src/index.css
index 3deb2c5..8c97652 100644
--- a/apps/studio/src/index.css
+++ b/apps/studio/src/index.css
@@ -2975,12 +2975,90 @@ body {
gap: 0;
}
+.waveform-mini--with-time {
+ height: auto;
+ min-height: 48px;
+ grid-template-rows: minmax(40px, 1fr) 18px;
+ overflow: visible;
+}
+
+.waveform-mini--with-scale.waveform-mini--with-time {
+ display: grid;
+ grid-template-columns: var(--transport-yaxis-width, 40px) minmax(0, 1fr);
+ grid-template-rows: minmax(40px, 1fr) 18px;
+}
+
+.waveform-mini__scale-wrap {
+ grid-row: 1;
+ grid-column: 1;
+ min-height: 0;
+ height: 100%;
+}
+
+.waveform-mini--with-time .waveform-mini__plot {
+ grid-row: 1;
+ grid-column: 2;
+ min-height: 40px;
+ height: 100%;
+}
+
+.waveform-mini--with-scale.waveform-mini--with-time .waveform-mini__plot {
+ grid-column: 2;
+}
+
+.waveform-mini:not(.waveform-mini--with-scale).waveform-mini--with-time .waveform-mini__plot {
+ grid-column: 1 / -1;
+}
+
+.waveform-mini__time-gutter {
+ grid-row: 2;
+ grid-column: 1;
+ background: #080808;
+ border-top: 1px solid var(--border-dim);
+ border-right: 1px solid var(--border-dim);
+}
+
+.waveform-mini__time-wrap {
+ grid-row: 2;
+ grid-column: 2;
+ min-width: 0;
+ border-top: 1px solid var(--border-dim);
+ background: #080808;
+}
+
+.waveform-mini:not(.waveform-mini--with-scale) .waveform-mini__time-wrap {
+ grid-column: 1 / -1;
+}
+
+.waveform-mini__time-axis {
+ position: relative;
+ height: 18px;
+ width: 100%;
+ overflow: hidden;
+}
+
+.waveform-mini__time-tick {
+ position: absolute;
+ top: 2px;
+ transform: translateX(-50%);
+ font-size: 9px;
+ line-height: 1;
+ font-variant-numeric: tabular-nums;
+ font-family: var(--font-mono);
+ color: #6b7280;
+ white-space: nowrap;
+ pointer-events: none;
+ user-select: none;
+}
+
.waveform-mini__scale {
position: relative;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-end;
+ height: 100%;
+ min-height: 40px;
padding: 4px 4px 4px 2px;
font-size: 9px;
line-height: 1;
@@ -3079,6 +3157,61 @@ body {
overflow: hidden;
}
+.spectrogram-mini--with-time {
+ grid-template-rows: minmax(0, 1fr) 18px;
+ overflow: visible;
+ min-height: 90px;
+}
+
+.spectrogram-mini__scale-wrap {
+ grid-row: 1;
+ grid-column: 1;
+ min-height: 0;
+ height: 100%;
+}
+
+.spectrogram-mini--with-time .spectrogram-mini__plot {
+ grid-row: 1;
+ grid-column: 2;
+}
+
+.spectrogram-mini__time-gutter {
+ grid-row: 2;
+ grid-column: 1;
+ background: #080808;
+ border-top: 1px solid var(--border-dim);
+ border-right: 1px solid var(--border-dim);
+}
+
+.spectrogram-mini__time-wrap {
+ grid-row: 2;
+ grid-column: 2;
+ min-width: 0;
+ border-top: 1px solid var(--border-dim);
+ background: #080808;
+}
+
+.spectrogram-mini__time-axis {
+ position: relative;
+ height: 18px;
+ width: 100%;
+ overflow: hidden;
+}
+
+.spectrogram-mini__time-tick {
+ position: absolute;
+ top: 2px;
+ transform: translateX(-50%);
+ font-size: 9px;
+ line-height: 1;
+ font-variant-numeric: tabular-nums;
+ font-family: var(--font-mono);
+ color: #6b7280;
+ white-space: nowrap;
+ pointer-events: none;
+ user-select: none;
+}
+
.spectrogram-mini--empty {
height: 48px;
background: var(--bg-canvas);
@@ -3092,6 +3225,8 @@ body {
flex-direction: column;
justify-content: space-between;
align-items: flex-end;
+ height: 100%;
+ min-height: 48px;
padding: 4px 4px 4px 2px;
font-size: 9px;
line-height: 1;
@@ -3143,6 +3278,86 @@ body {
cursor: pointer;
}
+.curve-compare {
+ margin: 0;
+ min-width: 0;
+}
+
+.curve-compare--empty {
+ height: 52px;
+ background: var(--bg-recessed);
+ border: 1px solid var(--border-rule);
+}
+
+.curve-compare__legend {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: 6px 10px;
+ margin-bottom: 6px;
+ font-size: 11px;
+ color: var(--text-muted);
+}
+
+.curve-compare__swatch {
+ display: inline-block;
+ width: 10px;
+ height: 10px;
+ border-radius: 0;
+}
+
+.curve-compare__swatch--a {
+ background: #ff002b;
+}
+
+.curve-compare__swatch--b {
+ background: #5b8def;
+}
+
+.curve-compare__label {
+ max-width: 120px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.curve-compare__svg {
+ display: block;
+ width: 100%;
+ height: 120px;
+ background: #080808;
+ border: 1px solid var(--border-dim);
+}
+
+.curve-compare__grid {
+ stroke: #222;
+ stroke-width: 1;
+}
+
+.curve-compare__path--a {
+ stroke: #ff002b;
+ stroke-width: 2;
+}
+
+.curve-compare__path--b {
+ stroke: #5b8def;
+ stroke-width: 2;
+}
+
+.curve-compare__dot--a {
+ fill: #ff002b;
+}
+
+.curve-compare__dot--b {
+ fill: #5b8def;
+}
+
+.curve-compare__meta {
+ margin: 6px 0 0;
+ font-size: 11px;
+ color: var(--text-muted);
+}
+
.waveform-compare {
margin: 0;
min-width: 0;
@@ -4547,15 +4762,22 @@ body {
.transport__wave-wrap {
position: relative;
flex: 1;
- min-height: 72px;
+ min-height: 96px;
display: flex;
flex-direction: column;
+ outline: none;
+}
+
+.transport__wave-wrap:focus,
+.transport__wave-wrap:focus-visible {
+ outline: none;
+ box-shadow: none;
}
.transport__wave-visual {
position: relative;
flex: 1;
- min-height: 72px;
+ min-height: 88px;
width: 100%;
display: flex;
align-items: stretch;
@@ -4605,6 +4827,71 @@ body {
color: #e5e7eb;
}
+.transport__visual-reset {
+ border-left: 1px solid var(--border-dim) !important;
+ color: #d1d5db !important;
+}
+
+.transport__sample-tag {
+ color: var(--text-muted);
+ font-variant-numeric: tabular-nums;
+}
+
+.spectrogram-mini__cell-mark {
+ position: absolute;
+ z-index: 4;
+ transform: translate(-50%, -50%);
+ pointer-events: none;
+}
+
+.spectrogram-mini__cell-cross {
+ display: block;
+ width: 9px;
+ height: 9px;
+ border: 1px solid #fff;
+ box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.65);
+ background: transparent;
+}
+
+.spectrogram-mini__cell-label {
+ position: absolute;
+ top: 10px;
+ left: 8px;
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ max-width: min(280px, 70vw);
+ padding: 3px 6px;
+ font-size: 10px;
+ font-family: var(--font-mono);
+ font-variant-numeric: tabular-nums;
+ color: #e5e7eb;
+ white-space: nowrap;
+ background: rgba(8, 8, 8, 0.92);
+ border: 1px solid var(--border-dim);
+ pointer-events: auto;
+}
+
+.spectrogram-mini__cell-label--left {
+ left: auto;
+ right: 8px;
+}
+
+.spectrogram-mini__cell-label--above {
+ top: auto;
+ bottom: 10px;
+}
+
+.spectrogram-mini__cell-label button {
+ border: 0;
+ background: transparent;
+ color: #9ca3af;
+ cursor: pointer;
+ padding: 0 2px;
+ font-size: 12px;
+ line-height: 1;
+}
+
.transport__visual-loading {
position: absolute;
left: 36px;
@@ -4889,40 +5176,54 @@ body {
pointer-events: none;
}
-.transport__wave-empty .transport__empty {
- position: absolute;
- inset: 0;
- display: grid;
- place-items: center;
+.transport__wave-meta {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+ min-height: 22px;
+ padding: 4px 0 0;
+ margin-left: var(--transport-yaxis-width, 40px);
+ border-top: 0;
+}
+
+.transport__wave-meta .transport__empty {
margin: 0;
- pointer-events: none;
+ font-size: 10px;
+ color: var(--text-muted);
+ letter-spacing: 0.04em;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.transport__status-meta {
+ flex-shrink: 0;
+ max-width: 55%;
+ text-align: right;
+}
+
+.transport__status-meta .transport__status {
+ margin: 0;
+ padding: 0;
+ background: transparent;
+ border: 0;
+ text-align: right;
}
.transport__time-tag {
- position: absolute;
- /* Same inset for waveform / spectrogram / MIDI — right of shared y-axis column. */
- left: calc(var(--transport-yaxis-width, 40px) + 8px);
- bottom: 6px;
display: flex;
align-items: center;
gap: 4px;
- padding: 2px 6px;
+ min-width: 0;
+ padding: 0;
font-family: var(--font-mono);
font-size: 10px;
letter-spacing: 0.04em;
color: var(--text-secondary);
- background: rgba(5, 5, 5, 0.72);
- border: 1px solid var(--border-dim);
- border-radius: 0;
+ background: transparent;
+ border: 0;
pointer-events: none;
- z-index: 2;
-}
-
-/* MIDI: keep timecode in the plot (top-left), clear of footer zoom controls on the right. */
-.transport__wave-wrap--midi .transport__time-tag {
- top: 6px;
- bottom: auto;
- right: auto;
}
.transport__time-current {
@@ -4933,22 +5234,6 @@ body {
color: var(--text-muted);
}
-.transport__status-overlay {
- position: absolute;
- right: 8px;
- bottom: 6px;
- pointer-events: none;
-}
-
-.transport__status-overlay .transport__status {
- margin: 0;
- padding: 2px 6px;
- background: rgba(5, 5, 5, 0.72);
- border: 1px solid var(--border-dim);
- border-radius: 0;
- text-align: right;
-}
-
.transport__playback-error {
position: absolute;
left: 8px;
@@ -6655,6 +6940,24 @@ body {
position: relative;
}
+.param-stepped__select {
+ width: 100%;
+ border: 1px solid var(--border-silver);
+ background: var(--bg-elevated);
+ color: var(--text-primary);
+ font-family: var(--font-mono);
+ font-size: 11px;
+ letter-spacing: 0.04em;
+ padding: 6px 8px;
+ border-radius: 0;
+ cursor: pointer;
+}
+
+.param-stepped__select:disabled {
+ opacity: 0.5;
+ cursor: default;
+}
+
.param-stepped__label {
border: 1px solid var(--border-silver);
background: var(--bg-elevated);
diff --git a/apps/studio/src/nodeMinimalPatches.ts b/apps/studio/src/nodeMinimalPatches.ts
index 995e5a7..f19d29f 100644
--- a/apps/studio/src/nodeMinimalPatches.ts
+++ b/apps/studio/src/nodeMinimalPatches.ts
@@ -162,6 +162,27 @@ const PATCH_RECIPES: Record = {
link("l4", "n3", "n5", "AUDIO"),
],
},
+ ChannelSplit: {
+ title: "Channel Split",
+ description:
+ "Merge two mono sources to stereo, then demux to true mono L / R (inverse of ChannelMerge).",
+ focusNodeId: "n4",
+ nodes: [
+ load("n1", 0, 0),
+ load("n2", 0, 140),
+ { id: "n3", type: "ChannelMerge", x: 260, widgets: { output_layout: "stereo" } },
+ { id: "n4", type: "ChannelSplit", x: 520, widgets: { layout: "auto" } },
+ preview("n5", 780, 0),
+ preview("n6", 780, 140),
+ ],
+ links: [
+ link("l1", "n1", "n3", "AUDIO", 0, 0),
+ link("l2", "n2", "n3", "AUDIO", 0, 1),
+ link("l3", "n3", "n4", "AUDIO"),
+ link("l4", "n4", "n5", "AUDIO", 0, 0),
+ link("l5", "n4", "n6", "AUDIO", 1, 0),
+ ],
+ },
Normalize: {
title: "Normalize",
description: "Load audio and normalize to −16 LUFS.",
diff --git a/apps/studio/src/planModelSanitize.test.ts b/apps/studio/src/planModelSanitize.test.ts
index 654b6d2..98795b5 100644
--- a/apps/studio/src/planModelSanitize.test.ts
+++ b/apps/studio/src/planModelSanitize.test.ts
@@ -16,7 +16,7 @@ describe("planModelSanitize", () => {
metadata: { title: "plan" },
nodes: [
{ id: "n3", type: "GenerateSpeech", widgets: { model: "coqui/XTTS-v2" } },
- { id: "n4", type: "Preview", widgets: {} },
+ { id: "n4", type: "PreviewAudio", widgets: {} },
],
links: [],
};
diff --git a/apps/studio/src/provenanceLayout.test.ts b/apps/studio/src/provenanceLayout.test.ts
index e7be991..8d67c3a 100644
--- a/apps/studio/src/provenanceLayout.test.ts
+++ b/apps/studio/src/provenanceLayout.test.ts
@@ -23,7 +23,7 @@ describe("lineageFromEntry", () => {
root_cache_id: "out",
nodes: [
{ cache_id: "src", node: { node_id: "n1", node_type: "LoadAudio" } },
- { cache_id: "out", node: { node_id: "n2", node_type: "Preview" } },
+ { cache_id: "out", node: { node_id: "n2", node_type: "PreviewAudio" } },
],
edges: [{ from_cache_id: "src", to_cache_id: "out" }],
};
@@ -45,7 +45,7 @@ describe("lineageFromEntry", () => {
chain: [
{
cache_id: "c3",
- node: { node_id: "n3", node_type: "Preview" },
+ node: { node_id: "n3", node_type: "PreviewAudio" },
contribution: { class: "human_edited" },
},
{
@@ -89,7 +89,7 @@ describe("layoutProvenanceGraph", () => {
},
{
cache_id: "c3",
- node: { node_id: "n3", node_type: "Preview" },
+ node: { node_id: "n3", node_type: "PreviewAudio" },
contribution: { class: "human_edited" },
},
],
diff --git a/apps/studio/src/templateUi.test.ts b/apps/studio/src/templateUi.test.ts
index 7c5213d..51b27d2 100644
--- a/apps/studio/src/templateUi.test.ts
+++ b/apps/studio/src/templateUi.test.ts
@@ -446,6 +446,10 @@ describe("isNodeVisibleInStudio", () => {
expect(STANDARD_BUNDLED_TEMPLATE_IDS).toContain("text-to-video");
expect(STANDARD_MODE_NODE_TYPES).toContain("EmbedWatermark");
expect(STANDARD_MODE_NODE_TYPES).toContain("DetectWatermark");
+ expect(STANDARD_MODE_NODE_TYPES).toContain("ChannelMerge");
+ expect(STANDARD_MODE_NODE_TYPES).toContain("ChannelSplit");
+ expect(isNodeVisibleInStudio("ChannelSplit")).toBe(true);
+ expect(isNodeVisibleInStudio("ChannelMerge")).toBe(true);
});
it("hides Video2Audio from palette even in studio dev mode", () => {
diff --git a/apps/studio/src/templateUi.ts b/apps/studio/src/templateUi.ts
index e44a7d1..9bd4252 100644
--- a/apps/studio/src/templateUi.ts
+++ b/apps/studio/src/templateUi.ts
@@ -241,6 +241,9 @@ export const STANDARD_MODE_NODE_TYPES = [
"TranslateText",
"VoiceConvert",
"WhisperSTT",
+ // Channel I/O (pair): visible in Core without studio-dev mode
+ "ChannelMerge",
+ "ChannelSplit",
] as const;
/**
diff --git a/apps/studio/src/transportVideoSync.ts b/apps/studio/src/transportVideoSync.ts
index f82f846..e30cbab 100644
--- a/apps/studio/src/transportVideoSync.ts
+++ b/apps/studio/src/transportVideoSync.ts
@@ -65,6 +65,9 @@ export function attachTransportVideoSync(): () => void {
stopRaf();
for (const video of nodeVideos()) {
video.pause();
+ // Keep muted so a later local ▶ on one node does not briefly unmute a
+ // sibling that still has the previous transport seek position (A/B click).
+ video.muted = true;
}
syncVideosTo(audio, true);
};
diff --git a/apps/studio/src/workflow.test.ts b/apps/studio/src/workflow.test.ts
index 5f4c8b3..effd582 100644
--- a/apps/studio/src/workflow.test.ts
+++ b/apps/studio/src/workflow.test.ts
@@ -1391,6 +1391,34 @@ describe("resolveNodeListenId", () => {
expect(nodeHasListenableOutput(workflow, "n3", outputs)).toBe(true);
});
+ it("auditions PreviewVideo via LoadVideo sibling SplitVideo AUDIO", () => {
+ const workflow: Workflow = {
+ ...sampleWorkflow(),
+ nodes: [
+ { id: "n0", type: "LoadVideo", widgets: { path: "a.mp4" } },
+ { id: "n1", type: "SplitVideo", widgets: {} },
+ { id: "n5", type: "PreviewVideo", widgets: {} },
+ ],
+ links: [
+ { id: "l0", from: ["n0", 0], to: ["n1", 0], type: "VIDEO" },
+ { id: "l1", from: ["n0", 0], to: ["n5", 0], type: "VIDEO" },
+ ],
+ };
+ const outputs: Record = {
+ n0: { type: "VIDEO", path: ".groovy/cache/src.mp4" },
+ n1: {
+ type: "MULTI",
+ outputs: [
+ { type: "VIDEO", path: ".groovy/cache/silent.mp4" },
+ { type: "AUDIO", cache_id: "demux-pcm" },
+ ],
+ },
+ n5: { type: "VIDEO", path: ".groovy/cache/src.mp4" },
+ };
+ expect(resolveNodeListenId(workflow, "n5", outputs)).toBe("demux-pcm");
+ expect(nodeHasListenableOutput(workflow, "n5", outputs)).toBe(true);
+ });
+
it("listens to AUDIO slot on SAMPLE_CHECK+AUDIO MULTI (VerifySamples)", () => {
const workflow: Workflow = {
...sampleWorkflow(),
diff --git a/apps/studio/src/workflow.ts b/apps/studio/src/workflow.ts
index 82c5aa3..5d72650 100644
--- a/apps/studio/src/workflow.ts
+++ b/apps/studio/src/workflow.ts
@@ -36,9 +36,32 @@ function listenOutputFromInboundLinks(
return undefined;
}
+/**
+ * LoadVideo → SplitVideo AUDIO (outlet 1): use demuxed PCM when PreviewVideo is
+ * wired only to the LoadVideo picture (no Mux / no AUDIO inlet on the preview).
+ */
+function listenOutputFromSplitOfVideoSource(
+ workflow: Workflow,
+ videoSourceId: string,
+ outputs: Record,
+): JobOutput | undefined {
+ for (const link of workflow.links) {
+ if (link.type !== "VIDEO" || link.from[0] !== videoSourceId) continue;
+ const sink = workflow.nodes.find((node) => node.id === link.to[0]);
+ if (sink?.type !== "SplitVideo") continue;
+ const splitOut = outputs[sink.id];
+ // SplitVideo RETURN_TYPES = (VIDEO, AUDIO) → MULTI slot 1 is AUDIO.
+ const audio = jobOutputAtSlot(splitOut, 1);
+ if (audio && previewListenId(audio, 0)) return audio;
+ }
+ return undefined;
+}
+
/**
* PreviewVideo ← VIDEO ← MuxVideo ← AUDIO: transport should audition the muxed PCM,
* not the VIDEO path (HTML5 video lives on-canvas / Node Helper).
+ * PreviewVideo ← LoadVideo (+ SplitVideo sibling): audition SplitVideo AUDIO so Space
+ * / waveform work for original vs rescored A/B without relying on HTML5 native audio.
*/
function listenOutputFromVideoChain(
workflow: Workflow,
@@ -49,10 +72,14 @@ function listenOutputFromVideoChain(
if (depth > 8) return undefined;
const audioOrMidi = listenOutputFromInboundLinks(workflow, nodeId, outputs);
if (audioOrMidi) return audioOrMidi;
+ const fromSplitHere = listenOutputFromSplitOfVideoSource(workflow, nodeId, outputs);
+ if (fromSplitHere) return fromSplitHere;
for (const link of workflow.links) {
if (link.to[0] !== nodeId || link.type !== "VIDEO") continue;
const upstream = listenOutputFromVideoChain(workflow, link.from[0], outputs, depth + 1);
if (upstream) return upstream;
+ const fromSplit = listenOutputFromSplitOfVideoSource(workflow, link.from[0], outputs);
+ if (fromSplit) return fromSplit;
}
return undefined;
}
@@ -773,6 +800,29 @@ const NODE_SOCKET_FALLBACKS: Record<
{ name: "log", type: "GENERATE_LOG", slot: 1 },
],
},
+ // Keep GENERATE_LOG attachable before /api/nodes schemas load (rescore pack, TTS).
+ GenerateAudio: {
+ inputs: [
+ { name: "text", type: "TEXT", optional: true, slot: 0 },
+ { name: "midi", type: "MIDI", optional: true, slot: 1 },
+ { name: "reference_audio", type: "AUDIO", optional: true, slot: 2 },
+ { name: "lyrics", type: "TEXT", optional: true, slot: 3 },
+ ],
+ outputs: [
+ { name: "audio", type: "AUDIO", slot: 0 },
+ { name: "log", type: "GENERATE_LOG", slot: 1 },
+ ],
+ },
+ GenerateSpeech: {
+ inputs: [
+ { name: "transcript", type: "TEXT", optional: true, slot: 0 },
+ { name: "reference_audio", type: "AUDIO", optional: true, slot: 1 },
+ ],
+ outputs: [
+ { name: "audio", type: "AUDIO", slot: 0 },
+ { name: "log", type: "GENERATE_LOG", slot: 1 },
+ ],
+ },
SaveGenerateLog: {
inputs: [{ name: "log", type: "GENERATE_LOG", slot: 0 }],
outputs: [{ name: "path", type: "STRING", slot: 0 }],
@@ -2374,11 +2424,15 @@ export function estimateNodeSize(node: WorkflowNode): { width: number; height: n
}
case "Prompt":
case "Video2Audio":
- case "GenerateSpeech":
case "SingFromMIDI":
width = 210;
height = 100;
break;
+ case "GenerateSpeech":
+ // Named inlets + audio/log outlets.
+ width = 210;
+ height = 112;
+ break;
case "GenerateVideo":
// Named inlets (prompt + image) + video/log outlets need a taller body.
width = 210;
@@ -2403,9 +2457,9 @@ export function estimateNodeSize(node: WorkflowNode): { width: number; height: n
height = 96;
break;
case "GenerateAudio":
- // Named inlets (prompt / midi / reference / lyrics) need a taller body.
+ // Named inlets (prompt / midi / reference / lyrics) + audio/log outlets.
width = 210;
- height = 128;
+ height = 140;
break;
case "DiarizeTranscribe":
case "WhisperSTT":
diff --git a/nodes/ai/src/groovy/nodes/ai/inference.py b/nodes/ai/src/groovy/nodes/ai/inference.py
index 7322aee..0cb0ffd 100644
--- a/nodes/ai/src/groovy/nodes/ai/inference.py
+++ b/nodes/ai/src/groovy/nodes/ai/inference.py
@@ -212,6 +212,9 @@ def run_diarize_transcribe(cache: CacheStore, kwargs: dict) -> list[dict]:
def run_tts(cache: CacheStore, kwargs: dict) -> list[dict]:
+ import time
+
+ from groovy.executor.generate_log import GenerateLogReport, probe_hardware
from groovy.nodes.ai.model_params import optional_seed, seed_param
text = str(kwargs.get("transcript") or kwargs.get("text") or "Hello from GroovyUI.")
@@ -226,21 +229,56 @@ def run_tts(cache: CacheStore, kwargs: dict) -> list[dict]:
ref_buf, reference_pcm = cache.load_audio(str(kwargs["audio_id"]))
reference_sample_rate = int(ref_buf.sample_rate) or sample_rate
sample_rate = reference_sample_rate
+ seed = optional_seed(kwargs)
+ stub_seed = seed_param(kwargs, fallback=text)
+ t0 = time.perf_counter()
pcm = synthesize_speech(
text,
sample_rate=sample_rate,
model_id=model_id,
- seed=optional_seed(kwargs),
- stub_seed=seed_param(kwargs, fallback=text),
+ seed=seed,
+ stub_seed=stub_seed,
reference_pcm=reference_pcm,
reference_sample_rate=reference_sample_rate,
reference_text=str(kwargs.get("reference_text") or ""),
language=language,
voice=voice,
)
+ elapsed_ms = int((time.perf_counter() - t0) * 1000)
out_buffer = AudioBuffer.from_planar(pcm, sample_rate, source_node_type="GenerateSpeech")
cache.write_audio(out_buffer, pcm)
- return [{"type": "AUDIO", "cache_id": out_buffer.id}]
+ frames = int(pcm.shape[-1]) if getattr(pcm, "ndim", 0) >= 1 else 0
+ report = GenerateLogReport.create(
+ {
+ "node_type": "GenerateSpeech",
+ "prompt": text,
+ "timing": {
+ "generate_ms": elapsed_ms,
+ "generate_s": round(elapsed_ms / 1000.0, 3),
+ },
+ "output": {
+ "media_type": "audio/pcm",
+ "cache_id": out_buffer.id,
+ "sample_rate": sample_rate,
+ "channels": int(pcm.shape[0]) if getattr(pcm, "ndim", 0) == 2 else 1,
+ "frames": frames,
+ "duration_s": round(frames / float(sample_rate), 3) if sample_rate else None,
+ },
+ "model_config": {
+ "model": model_id,
+ "language": language,
+ "voice": voice,
+ "seed": seed if seed is not None else stub_seed,
+ "has_reference_audio": reference_pcm is not None,
+ },
+ "hardware": probe_hardware(),
+ }
+ )
+ cache.write_generate_log(report)
+ return [
+ {"type": "AUDIO", "cache_id": out_buffer.id},
+ {"type": "GENERATE_LOG", "generate_log_id": report.id},
+ ]
def run_voice_convert(cache: CacheStore, kwargs: dict) -> list[dict]:
diff --git a/nodes/ai/src/groovy/nodes/ai/nodes.py b/nodes/ai/src/groovy/nodes/ai/nodes.py
index 8c654a0..55239b9 100644
--- a/nodes/ai/src/groovy/nodes/ai/nodes.py
+++ b/nodes/ai/src/groovy/nodes/ai/nodes.py
@@ -215,7 +215,9 @@ class GenerateSpeech(GroovyNode):
"gpt-sovits-v2",
"voxcpm2",
]
- RETURN_TYPES = ("AUDIO",)
+ # Slot 0 AUDIO + slot 1 GENERATE_LOG (parity with GenerateAudio / GenerateVideo).
+ RETURN_TYPES = ("AUDIO", "GENERATE_LOG")
+ OUTPUT_NAMES = ("audio", "log")
@classmethod
def INPUT_TYPES(cls):
@@ -253,6 +255,22 @@ def INPUT_TYPES(cls):
},
}
+ @classmethod
+ def describe(cls) -> dict:
+ schema = super().describe()
+ schema["outputs"] = [
+ {"name": "audio", "type": "AUDIO"},
+ {
+ "name": "log",
+ "type": "GENERATE_LOG",
+ "description": (
+ "Optional run log: prompt/transcript, timing, model config, and hardware. "
+ "Wire to SaveGenerateLog."
+ ),
+ },
+ ]
+ return schema
+
def run(self, **kwargs):
raise RuntimeError("GenerateSpeech must run in AI worker subprocess")
@@ -569,7 +587,9 @@ class GenerateAudio(GroovyNode):
"ace-step-1.5-sft",
"ace-step-1.5-2b-turbo",
]
- RETURN_TYPES = ("AUDIO",)
+ # Slot 0 AUDIO + slot 1 GENERATE_LOG (parity with GenerateVideo / inference.run_generate_audio).
+ RETURN_TYPES = ("AUDIO", "GENERATE_LOG")
+ OUTPUT_NAMES = ("audio", "log")
@classmethod
def INPUT_TYPES(cls):
@@ -643,6 +663,22 @@ def INPUT_TYPES(cls):
},
}
+ @classmethod
+ def describe(cls) -> dict:
+ schema = super().describe()
+ schema["outputs"] = [
+ {"name": "audio", "type": "AUDIO"},
+ {
+ "name": "log",
+ "type": "GENERATE_LOG",
+ "description": (
+ "Optional run log: prompt, timing, model config, and hardware. "
+ "Wire to SaveGenerateLog."
+ ),
+ },
+ ]
+ return schema
+
def run(self, **kwargs):
raise RuntimeError("GenerateAudio must run in AI worker subprocess")
diff --git a/nodes/core/src/groovy/nodes/core/nodes.py b/nodes/core/src/groovy/nodes/core/nodes.py
index 21b3085..6a55dee 100644
--- a/nodes/core/src/groovy/nodes/core/nodes.py
+++ b/nodes/core/src/groovy/nodes/core/nodes.py
@@ -80,6 +80,7 @@ def register_all() -> None:
LoadMIDI,
ChannelConvert,
ChannelMerge,
+ ChannelSplit,
Transcode,
MultichannelNormalize,
SignalGenerator,
@@ -2238,6 +2239,7 @@ class ChannelMerge(GroovyNode):
Intended path for SaveAudio after LoadAudio's per-channel outlets:
``LoadAudio L + R → ChannelMerge (stereo) → SaveAudio``.
+ Inverse of ``ChannelSplit`` (multichannel → mono outlets).
"""
PROVENANCE_PASSTHROUGH = True
@@ -2355,6 +2357,122 @@ def run(self, **kwargs) -> tuple[AudioBuffer]:
return (buffer,)
+@register_node
+class ChannelSplit(GroovyNode):
+ """Demux multichannel AUDIO into mono outlets (stereo → clear L / R).
+
+ Pair of ``ChannelMerge``. Architecture: fixed ``MAX_CHANNELS`` mono AUDIO
+ outlets so the canvas schema stays stable while input channel count varies.
+
+ - Stereo (2ch): outlet ``L`` = left plane, ``R`` = right plane (true mono).
+ - Mono (1ch): signal on ``L``; higher outlets are silent mono (same length).
+ - N-ch (≤8): plane ``i`` → outlet ``i`` as mono; unused higher outlets silent.
+ - >8 channels: error (raise ``MAX_CHANNELS`` later for 7.1.4 if needed).
+
+ Outlet labels: ``L``, ``R``, ``ch2``…``ch7`` (stereo-first UX). Meta on each
+ buffer records ``channel_index`` + layout map name (e.g. FL/FR for stereo).
+ """
+
+ PROVENANCE_PASSTHROUGH = True
+ CATEGORY = "GroovyUI/Core"
+ MAX_CHANNELS = 8
+ # Stereo-clear names on the first two sockets; ch2+ for surround / custom.
+ OUTPUT_NAMES = ("L", "R", "ch2", "ch3", "ch4", "ch5", "ch6", "ch7")
+ RETURN_TYPES = tuple("AUDIO" for _ in range(MAX_CHANNELS))
+
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {
+ "required": {"audio": ("AUDIO",)},
+ "optional": {
+ "layout": (
+ "STRING",
+ {
+ "default": "auto",
+ "description": (
+ "Channel map hint for outlet meta (auto|stereo|5.1|7.1|…). "
+ "Does not change which planes are extracted — plane index "
+ "order is always PCM row order. auto uses the buffer layout."
+ ),
+ },
+ ),
+ },
+ }
+
+ @classmethod
+ def describe(cls) -> dict:
+ schema = super().describe()
+ schema["outputs"] = [
+ {"name": name, "type": "AUDIO"} for name in cls.OUTPUT_NAMES
+ ]
+ return schema
+
+ def run(self, audio: AudioBuffer, layout: str = "auto", **kwargs) -> tuple[AudioBuffer, ...]:
+ if not self._ctx:
+ raise RuntimeError("Node context not bound")
+ layout_hint = str(kwargs.get("layout", layout) or "auto").strip() or "auto"
+ _, pcm = self._ctx.cache.load_audio(audio.id)
+ if pcm.ndim != 2 or pcm.shape[0] < 1:
+ raise ValueError("ChannelSplit expects planar audio (channels, frames)")
+
+ channel_count = int(pcm.shape[0])
+ frame_count = int(pcm.shape[1])
+ if channel_count > self.MAX_CHANNELS:
+ raise ValueError(
+ f"ChannelSplit supports up to {self.MAX_CHANNELS} channels "
+ f"(got {channel_count}). Insert ChannelConvert or trim channels first."
+ )
+
+ source_layout = str(audio.channel_layout or channel_layout_for_channels(channel_count))
+ map_layout = source_layout if layout_hint == "auto" else layout_hint
+ labels = channel_map_for_layout(map_layout, channel_count)
+ if len(labels) != channel_count:
+ labels = [f"ch{i}" for i in range(channel_count)]
+
+ sample_rate = int(audio.sample_rate)
+ buffers: list[AudioBuffer] = []
+ for index in range(self.MAX_CHANNELS):
+ if index < channel_count:
+ plane = np.asarray(pcm[index], dtype=np.float64).reshape(1, -1)
+ else:
+ plane = np.zeros((1, max(1, frame_count)), dtype=np.float64)
+
+ buffer = AudioBuffer.from_planar(
+ plane,
+ sample_rate,
+ source_node_type="ChannelSplit",
+ channel_layout="mono",
+ )
+ inherit_format_meta(
+ buffer,
+ audio,
+ channel_map=["M"],
+ encoding_scheme=(
+ f"ChannelSplit ({source_layout} → mono "
+ f"{self.OUTPUT_NAMES[index]}"
+ + (f"/{labels[index]}" if index < channel_count else "/silent")
+ + ")"
+ ),
+ layout_order=None,
+ )
+ self._ctx.cache.write_audio(buffer, plane)
+ meta_path = self._ctx.cache.cache_dir / f"{buffer.id}.meta.json"
+ meta = json.loads(meta_path.read_text()) if meta_path.exists() else {}
+ meta.update(
+ {
+ "channel_index": index if index < channel_count else None,
+ "channel_name": labels[index] if index < channel_count else None,
+ "outlet": self.OUTPUT_NAMES[index],
+ "split_from_layout": source_layout,
+ "split_active": index < channel_count,
+ }
+ )
+ meta_path.write_text(json.dumps(meta, indent=2))
+ buffers.append(buffer)
+
+ return tuple(buffers)
+
+
@register_node
class Transcode(GroovyNode):
PROVENANCE_PASSTHROUGH = True
diff --git a/packages/executor/src/groovy/executor/signal_integrity.py b/packages/executor/src/groovy/executor/signal_integrity.py
index e5fee16..5a1b780 100644
--- a/packages/executor/src/groovy/executor/signal_integrity.py
+++ b/packages/executor/src/groovy/executor/signal_integrity.py
@@ -25,6 +25,7 @@
{
"ChannelConvert",
"ChannelMerge",
+ "ChannelSplit",
"Granulate",
"LoadAudio",
"Pan",
diff --git a/packages/model-registry/src/groovy/registry/agent/creative_agent.py b/packages/model-registry/src/groovy/registry/agent/creative_agent.py
index bae24ea..a92536c 100644
--- a/packages/model-registry/src/groovy/registry/agent/creative_agent.py
+++ b/packages/model-registry/src/groovy/registry/agent/creative_agent.py
@@ -76,8 +76,9 @@
"audioload": "LoadAudio",
"loadaudiofile": "LoadAudio",
"audioinput": "LoadAudio",
- "audiopreview": "Preview",
- "previewaudio": "Preview",
+ "audiopreview": "PreviewAudio",
+ "previewaudio": "PreviewAudio",
+ "preview": "PreviewAudio",
"audionormalize": "Normalize",
"loudnorm": "Normalize",
"lufsnormalize": "Normalize",
diff --git a/packages/model-registry/src/groovy/registry/agent/node_enricher.py b/packages/model-registry/src/groovy/registry/agent/node_enricher.py
index 4ce2533..6fb7554 100644
--- a/packages/model-registry/src/groovy/registry/agent/node_enricher.py
+++ b/packages/model-registry/src/groovy/registry/agent/node_enricher.py
@@ -134,17 +134,29 @@
},
},
"GenerateSpeech": {
- "description": "Synthesize speech from a text prompt using a TTS model. Wire reference_audio for zero-shot voice cloning (F5-TTS / GPT-SoVITS).",
+ "description": (
+ "Synthesize speech from a text prompt using a TTS model. "
+ "Wire reference_audio for zero-shot voice cloning (F5-TTS / GPT-SoVITS). "
+ "Second outlet is an optional GENERATE_LOG for SaveGenerateLog."
+ ),
"inputs": {
"transcript": "Optional TEXT wire; overrides the local text widget when connected.",
"reference_audio": "Optional speaker reference clip for clone models (F5-TTS, GPT-SoVITS).",
},
+ "outputs": {
+ "audio": "Synthesized AUDIO.",
+ "log": (
+ "Optional GENERATE_LOG: transcript, timing, model config, hardware — "
+ "wire to SaveGenerateLog."
+ ),
+ },
"widgets": {
"model": "Text-to-speech model (Kokoro for plain speech; F5-TTS / GPT-SoVITS for cloning).",
"text": "Script or prompt to speak.",
"language": "ISO 639-1 for Kokoro (en, zh, es, fr, ja…). Mandarin = zh (needs misaki[zh]).",
"voice": "Optional Kokoro voice id (e.g. zf_xiaobei). Empty = language default.",
"seed": "Random seed (−1 = random).",
+ "reference_text": "Transcript of the reference clip when cloning.",
},
},
"VoiceConvert": {
@@ -196,7 +208,10 @@
},
},
"GenerateAudio": {
- "description": "Generate music or soundscapes from a text prompt (optional MIDI conditioning).",
+ "description": (
+ "Generate music or soundscapes from a text prompt (optional MIDI conditioning). "
+ "Second outlet is an optional GENERATE_LOG for SaveGenerateLog."
+ ),
"inputs": {
"text": "Style / sound prompt (TEXT). When wired, overrides the local prompt widget.",
"lyrics": "Optional lyrics (TEXT). ACE-Step: [verse] / [chorus]; leave empty for instrumental.",
@@ -210,6 +225,13 @@
"Duration matches the source. MusicGen Melody uses MIDIToAudio instead."
),
},
+ "outputs": {
+ "audio": "Generated AUDIO clip.",
+ "log": (
+ "Optional GENERATE_LOG: prompt, timing, model config, hardware — "
+ "wire to SaveGenerateLog."
+ ),
+ },
"widgets": {
"model": "Text-to-audio model (MusicGen, Stable Audio Open / SA3 Small Music|SFX, or ACE-Step).",
"prompt": "Style / sound prompt when the text inlet is unwired.",
@@ -271,11 +293,14 @@
},
"SaveGenerateLog": {
"description": (
- "Export a GenerateVideo / GenerateImage / GenerateMidi GENERATE_LOG as "
- "timestamped JSON (behavior, performance, hardware)."
+ "Export a Generate* GENERATE_LOG as timestamped JSON "
+ "(behavior, performance, hardware)."
),
"inputs": {
- "log": "GENERATE_LOG from GenerateVideo / GenerateImage / GenerateMidi .log.",
+ "log": (
+ "GENERATE_LOG from GenerateAudio / GenerateSpeech / GenerateVideo / "
+ "GenerateImage / GenerateMidi .log."
+ ),
},
"widgets": {
"path": "Folder under the project (e.g. exports).",
@@ -564,6 +589,22 @@
"seed": "RNG seed for scatter/pitch/pan (fixed seed → repeatable cloud).",
},
},
+ "ChannelSplit": {
+ "summary": (
+ "Demux multichannel AUDIO into mono outlets. Stereo → clear L / R true-mono; "
+ "up to 8 planes (ch2…ch7). Pair of ChannelMerge. Unused higher outs are silent."
+ ),
+ "inputs": {"audio": "Stereo or multichannel AUDIO (plane order = PCM rows)."},
+ "outputs": {
+ "L": "Mono left (or ch0).",
+ "R": "Mono right (or ch1).",
+ "ch2": "Mono plane 2 (silent if input has fewer channels).",
+ },
+ "tips": [
+ "Wire GenerateAudio / Mix stereo directly into ChannelSplit for L/R inspect.",
+ "LoadAudio stereo already emits masked MULTI outs — merge first if you need a true stereo buffer then re-split.",
+ ],
+ },
"ChannelConvert": {
"description": "Explicit upmix or downmix between channel layouts (ITU-R BS.775 for 5.1→stereo).",
"widgets": {"layout": "Target layout: mono, stereo, 5.1, etc."},
diff --git a/packages/model-registry/src/groovy/registry/agent/template_generator.py b/packages/model-registry/src/groovy/registry/agent/template_generator.py
index 44fec09..7b517af 100644
--- a/packages/model-registry/src/groovy/registry/agent/template_generator.py
+++ b/packages/model-registry/src/groovy/registry/agent/template_generator.py
@@ -18,7 +18,7 @@ def _infer_tags(workflow: Workflow) -> list[str]:
tags: set[str] = set()
for node in workflow.nodes:
tags.add(node.type.lower())
- if node.type in {"LoadAudio", "Preview"}:
+ if node.type in {"LoadAudio", "PreviewAudio"}:
continue
category = node.type.replace("Node", "").lower()
if category:
diff --git a/scripts/qa_help_examples_offline.py b/scripts/qa_help_examples_offline.py
index 640869a..003243e 100644
--- a/scripts/qa_help_examples_offline.py
+++ b/scripts/qa_help_examples_offline.py
@@ -21,6 +21,7 @@
"Benchmark",
"ChannelConvert",
"ChannelMerge",
+ "ChannelSplit",
"Clock",
"Comparator",
"ControlCurve",
diff --git a/tests/golden/test_reproducibility.py b/tests/golden/test_reproducibility.py
index a6fa685..ff8f167 100644
--- a/tests/golden/test_reproducibility.py
+++ b/tests/golden/test_reproducibility.py
@@ -61,7 +61,7 @@
"seed": 7,
},
},
- {"id": "n4", "type": "Preview", "pos": {"x": 720, "y": 0}, "widgets": {}},
+ {"id": "n4", "type": "PreviewAudio", "pos": {"x": 720, "y": 0}, "widgets": {}},
],
"links": [
{"id": "l1", "from": ["n1", 0], "to": ["n2", 0], "type": "AUDIO"},
diff --git a/tests/golden/test_stem_split.py b/tests/golden/test_stem_split.py
index 79042a8..e933f55 100644
--- a/tests/golden/test_stem_split.py
+++ b/tests/golden/test_stem_split.py
@@ -86,10 +86,10 @@ def test_legacy_stems_node_cache_feeds_four_preview_slots(project_dir: Path) ->
**workflow.model_dump(),
"nodes": [
*workflow.nodes,
- {"id": "p1", "type": "Preview", "pos": {"x": 520, "y": -60}, "widgets": {}},
- {"id": "p2", "type": "Preview", "pos": {"x": 520, "y": 0}, "widgets": {}},
- {"id": "p3", "type": "Preview", "pos": {"x": 520, "y": 60}, "widgets": {}},
- {"id": "p4", "type": "Preview", "pos": {"x": 520, "y": 120}, "widgets": {}},
+ {"id": "p1", "type": "PreviewAudio", "pos": {"x": 520, "y": -60}, "widgets": {}},
+ {"id": "p2", "type": "PreviewAudio", "pos": {"x": 520, "y": 0}, "widgets": {}},
+ {"id": "p3", "type": "PreviewAudio", "pos": {"x": 520, "y": 60}, "widgets": {}},
+ {"id": "p4", "type": "PreviewAudio", "pos": {"x": 520, "y": 120}, "widgets": {}},
],
"links": [
{"id": "l1", "from": ["n1", 0], "to": ["n2", 0], "type": "AUDIO"},
diff --git a/tests/test_agent_plan.py b/tests/test_agent_plan.py
index 1ed8ae8..77ff23d 100644
--- a/tests/test_agent_plan.py
+++ b/tests/test_agent_plan.py
@@ -168,7 +168,7 @@ def test_plan_llm_composes_workflow_without_catalog(
from groovy.registry.agent import llm_planner
registry = ModelRegistry(tmp_path)
- known = {"LoadAudio", "Denoise", "Preview", "SaveAudio", "SeparateStems", "WhisperSTT"}
+ known = {"LoadAudio", "Denoise", "PreviewAudio", "SaveAudio", "SeparateStems", "WhisperSTT"}
def fake_call(*, api_key: str, system: str, user: str, model: str) -> str:
assert api_key == "sk-ant-test-not-a-real-key"
@@ -194,7 +194,7 @@ def fake_call(*, api_key: str, system: str, user: str, model: str) -> str:
"widgets": {"model": "deepfilternet-v3"},
},
{"id": "n3", "type": "FantasyStemAI", "widgets": {}},
- {"id": "n4", "type": "Preview", "widgets": {}},
+ {"id": "n4", "type": "PreviewAudio", "widgets": {}},
],
"links": [
{"id": "e1", "from": ["n1", 0], "to": ["n2", 0], "type": "AUDIO"},
@@ -243,7 +243,7 @@ def test_remap_public_model_ref_to_local_registry(tmp_path: Path) -> None:
"nodes": [
{"id": "n1", "type": "Prompt", "widgets": {"text": "hi"}},
{"id": "n3", "type": "GenerateSpeech", "widgets": {"model": "coqui/XTTS-v2"}},
- {"id": "n4", "type": "Preview", "widgets": {}},
+ {"id": "n4", "type": "PreviewAudio", "widgets": {}},
],
"links": [
{"id": "e1", "from": ["n1", 0], "to": ["n3", 0], "type": "TEXT"},
@@ -251,7 +251,7 @@ def test_remap_public_model_ref_to_local_registry(tmp_path: Path) -> None:
],
},
index=0,
- known_node_types={"Prompt", "GenerateSpeech", "Preview"},
+ known_node_types={"Prompt", "GenerateSpeech", "PreviewAudio"},
catalog=registry.catalog,
node_model_defaults={"GenerateSpeech": "kokoro-82m"},
)
@@ -277,12 +277,12 @@ def test_fill_empty_load_audio_path(tmp_path: Path) -> None:
"summary": "Load draft",
"nodes": [
{"id": "n1", "type": "LoadAudio", "widgets": {}},
- {"id": "n2", "type": "Preview", "widgets": {}},
+ {"id": "n2", "type": "PreviewAudio", "widgets": {}},
],
"links": [{"id": "e1", "from": ["n1", 0], "to": ["n2", 0], "type": "AUDIO"}],
},
index=0,
- known_node_types={"LoadAudio", "Preview"},
+ known_node_types={"LoadAudio", "PreviewAudio"},
catalog=registry.catalog,
)
assert reason == ""
@@ -354,7 +354,7 @@ def fake_call(*, api_key: str, system: str, user: str, model: str) -> str:
"nodes": [
{"id": "n1", "type": "LoadAudio", "widgets": {}},
{"id": "n2", "type": "Denoise", "widgets": {"model": "deepfilternet-v3"}},
- {"id": "n3", "type": "Preview", "widgets": {}},
+ {"id": "n3", "type": "PreviewAudio", "widgets": {}},
],
"links": [
{"id": "e1", "from": ["n1", 0], "to": ["n2", 0], "type": "AUDIO"},
@@ -371,7 +371,7 @@ def fake_call(*, api_key: str, system: str, user: str, model: str) -> str:
templates_fallback=templates,
api_key="sk-ant-test-not-a-real-key",
catalog=registry.catalog,
- known_node_types={"LoadAudio", "Denoise", "Preview", secret_node},
+ known_node_types={"LoadAudio", "Denoise", "PreviewAudio", secret_node},
node_model_defaults={"Denoise": secret_model},
)
assert result["mode"] == "llm"
@@ -399,7 +399,7 @@ def fake_call(*, api_key: str, system: str, user: str, model: str) -> str:
"nodes": [
{"id": "n1", "type": "LoadAudio", "widgets": {}},
{"id": "n2", "type": "FantasyNode", "widgets": {}},
- {"id": "n3", "type": "Preview", "widgets": {}},
+ {"id": "n3", "type": "PreviewAudio", "widgets": {}},
],
"links": [
{"id": "e1", "from": ["n1", 0], "to": ["n2", 0], "type": "AUDIO"},
@@ -416,7 +416,7 @@ def fake_call(*, api_key: str, system: str, user: str, model: str) -> str:
templates_fallback=templates,
api_key="sk-ant-test-not-a-real-key",
catalog=registry.catalog,
- known_node_types={"LoadAudio", "Denoise", "Preview"},
+ known_node_types={"LoadAudio", "Denoise", "PreviewAudio"},
)
assert result["mode"] == "llm"
assert result["source"] == "llm"
@@ -444,7 +444,7 @@ def fake_call(*, api_key: str, system: str, user: str, model: str) -> str:
templates_fallback=templates,
api_key="sk-ant-test-not-a-real-key",
catalog=registry.catalog,
- known_node_types={"LoadAudio", "Denoise", "Preview"},
+ known_node_types={"LoadAudio", "Denoise", "PreviewAudio"},
)
assert result["mode"] == "templates"
assert result.get("fallback_reason") == "llm_empty"
diff --git a/tests/test_channel_split.py b/tests/test_channel_split.py
new file mode 100644
index 0000000..9295215
--- /dev/null
+++ b/tests/test_channel_split.py
@@ -0,0 +1,171 @@
+"""ChannelSplit — multichannel AUDIO → mono L/R (…ch7) outlets."""
+
+from __future__ import annotations
+
+from pathlib import Path
+
+import numpy as np
+import soundfile as sf
+
+from groovy.executor import Executor
+from groovy.node import NODE_REGISTRY
+from groovy.nodes.core import register_all as register_core
+from groovy.schema.models import Workflow
+
+register_core()
+
+
+def _write_stereo(path: Path, *, sr: int = 48000, duration_s: float = 0.05) -> None:
+ frames = int(sr * duration_s)
+ t = np.linspace(0, duration_s, frames, endpoint=False)
+ left = 0.25 * np.sin(2 * np.pi * 440.0 * t)
+ right = 0.25 * np.sin(2 * np.pi * 880.0 * t)
+ path.parent.mkdir(parents=True, exist_ok=True)
+ sf.write(path, np.stack([left, right], axis=1), sr)
+
+
+def _write_mono(path: Path, *, sr: int = 48000, duration_s: float = 0.05) -> None:
+ frames = int(sr * duration_s)
+ t = np.linspace(0, duration_s, frames, endpoint=False)
+ mono = 0.25 * np.sin(2 * np.pi * 330.0 * t)
+ path.parent.mkdir(parents=True, exist_ok=True)
+ sf.write(path, mono, sr)
+
+
+def test_channel_split_schema_stereo_first() -> None:
+ node = NODE_REGISTRY["ChannelSplit"]
+ assert node.RETURN_TYPES == tuple(["AUDIO"] * 8)
+ assert node.OUTPUT_NAMES[0] == "L"
+ assert node.OUTPUT_NAMES[1] == "R"
+ described = node.describe()
+ assert [o["name"] for o in described["outputs"]] == list(node.OUTPUT_NAMES)
+
+
+def test_channel_split_stereo_true_mono_lr(tmp_path: Path) -> None:
+ rel = "assets/samples/split-stereo.wav"
+ _write_stereo(tmp_path / rel)
+
+ # Load via ChannelConvert identity path: use a tiny graph that loads stereo as one buffer.
+ # LoadAudio emits MULTI per-channel masked outs — feed ChannelMerge→ChannelSplit instead
+ # so the split input is a true stereo buffer.
+ workflow = Workflow.model_validate(
+ {
+ "schema_version": "1.0.0",
+ "groovy_version": "0.1.0",
+ "id": "test-channel-split-stereo",
+ "metadata": {"title": "channel-split-stereo", "description": ""},
+ "nodes": [
+ {"id": "load", "type": "LoadAudio", "widgets": {"path": rel}},
+ {
+ "id": "merge",
+ "type": "ChannelMerge",
+ "widgets": {"output_layout": "stereo"},
+ },
+ {"id": "split", "type": "ChannelSplit", "widgets": {"layout": "auto"}},
+ {"id": "prev_l", "type": "PreviewAudio", "widgets": {}},
+ {"id": "prev_r", "type": "PreviewAudio", "widgets": {}},
+ ],
+ "links": [
+ {"id": "l0", "from": ["load", 0], "to": ["merge", 0], "type": "AUDIO"},
+ {"id": "l1", "from": ["load", 1], "to": ["merge", 1], "type": "AUDIO"},
+ {"id": "l2", "from": ["merge", 0], "to": ["split", 0], "type": "AUDIO"},
+ {"id": "l3", "from": ["split", 0], "to": ["prev_l", 0], "type": "AUDIO"},
+ {"id": "l4", "from": ["split", 1], "to": ["prev_r", 0], "type": "AUDIO"},
+ ],
+ "groups": [],
+ }
+ )
+
+ result = Executor(tmp_path).execute(workflow, target_nodes=["prev_l", "prev_r"])
+ assert result.status == "completed", result.error
+
+ split_out = result.outputs["split"]
+ assert split_out["type"] == "MULTI"
+ slots = split_out["outputs"]
+ assert len(slots) == 8
+ assert slots[0]["type"] == "AUDIO" and slots[1]["type"] == "AUDIO"
+
+ ex = Executor(tmp_path)
+ left_buf, left_pcm = ex.cache.load_audio(slots[0]["cache_id"])
+ right_buf, right_pcm = ex.cache.load_audio(slots[1]["cache_id"])
+ assert left_buf.channels == 1
+ assert right_buf.channels == 1
+ assert left_buf.channel_layout == "mono"
+ assert right_buf.channel_layout == "mono"
+ assert left_pcm.shape[0] == 1 and right_pcm.shape[0] == 1
+ # 440 Hz L vs 880 Hz R — peaks present and spectra differ via zero-crossing density
+ assert float(np.max(np.abs(left_pcm))) > 0.05
+ assert float(np.max(np.abs(right_pcm))) > 0.05
+ left_zcr = float(np.mean(left_pcm[0, :-1] * left_pcm[0, 1:] < 0))
+ right_zcr = float(np.mean(right_pcm[0, :-1] * right_pcm[0, 1:] < 0))
+ assert right_zcr > left_zcr
+
+ # Higher outlets exist but are silent pads for stereo input
+ _, silent = ex.cache.load_audio(slots[2]["cache_id"])
+ assert float(np.max(np.abs(silent))) < 1e-9
+
+
+def test_channel_split_mono_on_l(tmp_path: Path) -> None:
+ rel = "assets/samples/split-mono.wav"
+ _write_mono(tmp_path / rel)
+ workflow = Workflow.model_validate(
+ {
+ "schema_version": "1.0.0",
+ "groovy_version": "0.1.0",
+ "id": "test-channel-split-mono",
+ "metadata": {"title": "channel-split-mono", "description": ""},
+ "nodes": [
+ {"id": "load", "type": "LoadAudio", "widgets": {"path": rel}},
+ {"id": "split", "type": "ChannelSplit", "widgets": {}},
+ {"id": "prev", "type": "PreviewAudio", "widgets": {}},
+ ],
+ "links": [
+ {"id": "l0", "from": ["load", 0], "to": ["split", 0], "type": "AUDIO"},
+ {"id": "l1", "from": ["split", 0], "to": ["prev", 0], "type": "AUDIO"},
+ ],
+ "groups": [],
+ }
+ )
+ result = Executor(tmp_path).execute(workflow, target_nodes=["prev"])
+ assert result.status == "completed", result.error
+ slots = result.outputs["split"]["outputs"]
+ ex = Executor(tmp_path)
+ left_buf, left_pcm = ex.cache.load_audio(slots[0]["cache_id"])
+ _, right_pcm = ex.cache.load_audio(slots[1]["cache_id"])
+ assert left_buf.channels == 1
+ assert float(np.max(np.abs(left_pcm))) > 0.05
+ assert float(np.max(np.abs(right_pcm))) < 1e-9
+
+
+def test_channel_split_roundtrip_merge(tmp_path: Path) -> None:
+ rel = "assets/samples/split-roundtrip.wav"
+ _write_stereo(tmp_path / rel)
+ workflow = Workflow.model_validate(
+ {
+ "schema_version": "1.0.0",
+ "groovy_version": "0.1.0",
+ "id": "test-channel-split-roundtrip",
+ "metadata": {"title": "roundtrip", "description": ""},
+ "nodes": [
+ {"id": "load", "type": "LoadAudio", "widgets": {"path": rel}},
+ {"id": "merge_in", "type": "ChannelMerge", "widgets": {"output_layout": "stereo"}},
+ {"id": "split", "type": "ChannelSplit", "widgets": {}},
+ {"id": "merge_out", "type": "ChannelMerge", "widgets": {"output_layout": "stereo"}},
+ ],
+ "links": [
+ {"id": "l0", "from": ["load", 0], "to": ["merge_in", 0], "type": "AUDIO"},
+ {"id": "l1", "from": ["load", 1], "to": ["merge_in", 1], "type": "AUDIO"},
+ {"id": "l2", "from": ["merge_in", 0], "to": ["split", 0], "type": "AUDIO"},
+ {"id": "l3", "from": ["split", 0], "to": ["merge_out", 0], "type": "AUDIO"},
+ {"id": "l4", "from": ["split", 1], "to": ["merge_out", 1], "type": "AUDIO"},
+ ],
+ "groups": [],
+ }
+ )
+ result = Executor(tmp_path).execute(workflow, target_nodes=["merge_out"])
+ assert result.status == "completed", result.error
+ ex = Executor(tmp_path)
+ _, pcm_in = ex.cache.load_audio(result.outputs["merge_in"]["cache_id"])
+ _, pcm_out = ex.cache.load_audio(result.outputs["merge_out"]["cache_id"])
+ assert pcm_in.shape == pcm_out.shape
+ assert float(np.max(np.abs(pcm_in - pcm_out))) < 1e-9
diff --git a/tests/test_creative_agent.py b/tests/test_creative_agent.py
index 86905ba..a709f1b 100644
--- a/tests/test_creative_agent.py
+++ b/tests/test_creative_agent.py
@@ -105,7 +105,7 @@ def test_sanitize_steps_allowlist_and_lock_unknown() -> None:
"action": {"type": "propose_note", "message": "Try A/B next"},
},
],
- known_node_types={"Denoise", "LoadAudio", "Preview"},
+ known_node_types={"Denoise", "LoadAudio", "PreviewAudio"},
catalog=None,
)
assert any("unsupported" in s for s in skipped)
@@ -129,7 +129,7 @@ def test_sanitize_steps_allowlist_and_lock_unknown() -> None:
},
}
],
- known_node_types={"Denoise", "LoadAudio", "Preview"},
+ known_node_types={"Denoise", "LoadAudio", "PreviewAudio"},
)
assert aliased[0]["action"]["node"]["type"] == "Denoise"
assert aliased[0]["remapped_from"] == "DeepFilterNet"
@@ -173,7 +173,7 @@ def fake_call(*, api_key: str, system: str, user: str, model: str) -> str:
prompt="clean this podcast",
api_key="sk-ant-test-not-a-real-key",
canvas={"nodes": [{"id": "n1", "type": "LoadAudio"}], "links": []},
- known_node_types={"LoadAudio", "Denoise", "Preview"},
+ known_node_types={"LoadAudio", "Denoise", "PreviewAudio"},
)
assert result["mode"] == "plan"
assert len(result["steps"]) == 2
diff --git a/tests/test_license_scanner.py b/tests/test_license_scanner.py
index 4e0b201..2333237 100644
--- a/tests/test_license_scanner.py
+++ b/tests/test_license_scanner.py
@@ -190,7 +190,7 @@ def test_batch_render_multiple_files(tmp_path: Path) -> None:
metadata=WorkflowMetadata(title="Batch test"),
nodes=[
NodeInstance(id="n1", type="LoadAudio", widgets={"path": "assets/batch_in/clip_1.wav"}),
- NodeInstance(id="n2", type="Preview", widgets={}),
+ NodeInstance(id="n2", type="PreviewAudio", widgets={}),
],
links=[
Link(id="l1", from_=["n1", 0], to=["n2", 0], type="AUDIO"),
diff --git a/tests/test_meter_node.py b/tests/test_meter_node.py
index cb5be95..043b414 100644
--- a/tests/test_meter_node.py
+++ b/tests/test_meter_node.py
@@ -113,7 +113,7 @@ def test_meter_node_via_executor(tmp_path: Path) -> None:
"pos": {"x": 200, "y": 0},
"widgets": {"layout": "auto", "edge_fraction": 0.05},
},
- {"id": "n3", "type": "Preview", "pos": {"x": 400, "y": 0}, "widgets": {}},
+ {"id": "n3", "type": "PreviewAudio", "pos": {"x": 400, "y": 0}, "widgets": {}},
],
"links": [
{"id": "l1", "from": ["n1", 0], "to": ["n2", 0], "type": "AUDIO"},
diff --git a/tests/test_node_cache.py b/tests/test_node_cache.py
index 495754a..6e81cae 100644
--- a/tests/test_node_cache.py
+++ b/tests/test_node_cache.py
@@ -37,7 +37,7 @@
"pos": {"x": 240, "y": 0},
"widgets": {"mode": "peak", "target_peak_db": -1.0},
},
- {"id": "n3", "type": "Preview", "pos": {"x": 480, "y": 0}, "widgets": {}},
+ {"id": "n3", "type": "PreviewAudio", "pos": {"x": 480, "y": 0}, "widgets": {}},
],
"links": [
{"id": "l1", "from": ["n1", 0], "to": ["n2", 0], "type": "AUDIO"},
@@ -116,7 +116,7 @@ def test_executor_skips_unchanged_nodes(tmp_path: Path) -> None:
"pos": {"x": 240, "y": 0},
"widgets": {"gain": 1.0},
},
- {"id": "n4", "type": "Preview", "pos": {"x": 480, "y": 0}, "widgets": {}},
+ {"id": "n4", "type": "PreviewAudio", "pos": {"x": 480, "y": 0}, "widgets": {}},
],
"links": [
{"id": "l1", "from": ["n2", 0], "to": ["n3", 0], "type": "AUDIO"},
diff --git a/tests/test_pan_node.py b/tests/test_pan_node.py
index f5d72da..65f64b7 100644
--- a/tests/test_pan_node.py
+++ b/tests/test_pan_node.py
@@ -87,7 +87,7 @@ def test_mono_to_stereo_pan_template(tmp_path: Path) -> None:
"pos": {"x": 400, "y": 0},
"widgets": {"pan": 0.0, "output_layout": "stereo"},
},
- {"id": "n5", "type": "Preview", "pos": {"x": 600, "y": 0}, "widgets": {}},
+ {"id": "n5", "type": "PreviewAudio", "pos": {"x": 600, "y": 0}, "widgets": {}},
],
"links": [
{"id": "l1", "from": ["n1", 0], "to": ["n2", 0], "type": "AUDIO"},
diff --git a/tests/test_preview_text.py b/tests/test_preview_text.py
index 3e93d75..00b7520 100644
--- a/tests/test_preview_text.py
+++ b/tests/test_preview_text.py
@@ -38,7 +38,7 @@ def test_preview_passthrough_audio(project_dir: Path) -> None:
"pos": {"x": 0, "y": 0},
"widgets": {"path": "assets/samples/tone.wav"},
},
- {"id": "n2", "type": "Preview", "pos": {"x": 260, "y": 0}, "widgets": {}},
+ {"id": "n2", "type": "PreviewAudio", "pos": {"x": 260, "y": 0}, "widgets": {}},
],
"links": [{"id": "l1", "from": ["n1", 0], "to": ["n2", 0], "type": "AUDIO"}],
"groups": [],
@@ -64,7 +64,7 @@ def test_preview_passthrough_text(project_dir: Path) -> None:
"pos": {"x": 0, "y": 0},
"widgets": {"text": "hello from prompt"},
},
- {"id": "n2", "type": "Preview", "pos": {"x": 260, "y": 0}, "widgets": {}},
+ {"id": "n2", "type": "PreviewAudio", "pos": {"x": 260, "y": 0}, "widgets": {}},
],
"links": [{"id": "l1", "from": ["n1", 0], "to": ["n2", 1], "type": "TEXT"}],
"groups": [],
@@ -96,7 +96,7 @@ def test_preview_audio_and_text_attaches_transcript(project_dir: Path) -> None:
"pos": {"x": 0, "y": 120},
"widgets": {"text": "side transcript"},
},
- {"id": "n3", "type": "Preview", "pos": {"x": 280, "y": 40}, "widgets": {}},
+ {"id": "n3", "type": "PreviewAudio", "pos": {"x": 280, "y": 40}, "widgets": {}},
{
"id": "n4",
"type": "SaveAudio",
@@ -137,7 +137,7 @@ def test_save_audio_rejects_text_preview(project_dir: Path) -> None:
"pos": {"x": 0, "y": 0},
"widgets": {"text": "not audio"},
},
- {"id": "n2", "type": "Preview", "pos": {"x": 260, "y": 0}, "widgets": {}},
+ {"id": "n2", "type": "PreviewAudio", "pos": {"x": 260, "y": 0}, "widgets": {}},
{
"id": "n3",
"type": "SaveAudio",
diff --git a/tests/test_provenance.py b/tests/test_provenance.py
index 4a51e85..2bee27d 100644
--- a/tests/test_provenance.py
+++ b/tests/test_provenance.py
@@ -74,7 +74,7 @@ def test_provenance_chain_has_parents(project_dir: Path) -> None:
preview_id = result.outputs["n4"]["cache_id"]
chain = build_lineage_chain(executor.cache, preview_id)
assert len(chain) >= 2
- assert chain[0]["node"]["node_type"] in {"Normalize", "Preview"}
+ assert chain[0]["node"]["node_type"] in {"Normalize", "PreviewAudio"}
disclosure = disclosure_summary(chain)
assert "AI" in disclosure or "ai" in disclosure.lower()
diff --git a/tests/test_rescore_video.py b/tests/test_rescore_video.py
index 1d65fec..c064485 100644
--- a/tests/test_rescore_video.py
+++ b/tests/test_rescore_video.py
@@ -124,18 +124,19 @@ def test_rescore_video_template_schema_and_stub_render(tmp_path: Path, monkeypat
assert by_id["n0"]["widgets"]["path"] == "assets/samples/Cyberpunk-station.mp4"
assert by_id["n3"]["widgets"]["model"] == "ace-step-1.5-sft"
assert by_id["n3"]["widgets"]["num_inference_steps"] == 72
- assert by_id["n3"]["widgets"]["guidance_scale"] == 11.0
+ assert by_id["n3"]["widgets"]["guidance_scale"] == 9.0
assert by_id["n3"]["widgets"]["seconds_total"] == 2.0
+ assert by_id["n3"]["widgets"]["seed"] == 43
assert by_id["n2"]["widgets"]["text"] == (
- "immersive rainy cyberpunk transit soundscape, soft rain on umbrellas and wet asphalt, "
- "layered distant quadcopter drone whirrs, low industrial hum and steam vents, "
- "muffled multilingual crowd murmur, faint neon electrical buzz, sparse melancholic "
- "dark synth pads, slow attack long decay reverb, atmospheric documentary bed, "
- "instrumental, no vocals, no drums, no melody hook"
+ "cinematic transit underscore: one close multirotor flyby with clear Doppler pitch "
+ "swoop, dark velvet pad with slow bloom underneath, soft rain air far in the mix, "
+ "neon megastation atmosphere, open present stereo, instrumental, no vocals, no drums, "
+ "no melody hook, no musical drone pedal, no muffled, no underwater dullness"
)
assert by_id["n3"]["widgets"]["prompt"] == by_id["n2"]["widgets"]["text"]
- assert by_id["n3"]["widgets"]["lyrics_text"] == ""
+ assert by_id["n3"]["widgets"]["lyrics_text"] == "[Instrumental]"
assert by_id["n3"]["widgets"]["audio_cover_strength"] == 0.18
+ assert len(by_id["n3"]["widgets"]["prompt"]) <= 512
note_a = by_id["note-a"]
note_b = by_id["note-b"]
n5 = by_id["n5"]
@@ -148,6 +149,8 @@ def test_rescore_video_template_schema_and_stub_render(tmp_path: Path, monkeypat
assert by_id["n6"]["type"] == "PreviewVideo"
assert by_id["n8"]["type"] == "PreviewAudio"
assert by_id["n9"]["type"] == "PreviewAudio"
+ assert by_id["n10"]["type"] == "ChannelSplit"
+ assert by_id["n11"]["type"] == "PreviewAudio"
assert by_id["n-log"]["type"] == "SaveGenerateLog"
links = data["links"]
@@ -160,13 +163,21 @@ def test_rescore_video_template_schema_and_stub_render(tmp_path: Path, monkeypat
link["from"] == ["n4", 0] and link["to"] == ["n6", 0] and link["type"] == "VIDEO"
for link in links
)
- # Audio Previews for Inspector A/B
+ # Original demux audio + GenerateAudio → ChannelSplit → L/R PreviewAudio
assert any(
link["from"] == ["n1", 1] and link["to"] == ["n8", 0] and link["type"] == "AUDIO"
for link in links
)
assert any(
- link["from"] == ["n3", 0] and link["to"] == ["n9", 0] and link["type"] == "AUDIO"
+ link["from"] == ["n3", 0] and link["to"] == ["n10", 0] and link["type"] == "AUDIO"
+ for link in links
+ )
+ assert any(
+ link["from"] == ["n10", 0] and link["to"] == ["n9", 0] and link["type"] == "AUDIO"
+ for link in links
+ )
+ assert any(
+ link["from"] == ["n10", 1] and link["to"] == ["n11", 0] and link["type"] == "AUDIO"
for link in links
)
assert any(
@@ -197,7 +208,7 @@ def test_rescore_video_template_schema_and_stub_render(tmp_path: Path, monkeypat
registry = ModelRegistry(tmp_path)
registry.installer.install("ace-step-1.5-sft")
out = Executor(tmp_path).execute(
- workflow, target_nodes=["n3", "n5", "n6", "n7", "n8", "n9", "n-log"]
+ workflow, target_nodes=["n3", "n5", "n6", "n7", "n8", "n9", "n10", "n11", "n-log"]
)
assert out.status == "completed", out.error
assert out.outputs["n3"]["type"] == "MULTI"
@@ -207,7 +218,11 @@ def test_rescore_video_template_schema_and_stub_render(tmp_path: Path, monkeypat
assert out.outputs["n6"]["type"] == "VIDEO"
assert out.outputs["n7"]["type"] == "STRING"
assert out.outputs["n8"]["type"] == "AUDIO"
+ assert out.outputs["n10"]["type"] == "MULTI"
+ assert len(out.outputs["n10"]["outputs"]) == 8
+ assert all(slot["type"] == "AUDIO" for slot in out.outputs["n10"]["outputs"])
assert out.outputs["n9"]["type"] == "AUDIO"
+ assert out.outputs["n11"]["type"] == "AUDIO"
assert out.outputs["n-log"]["type"] == "STRING"
saved = tmp_path / out.outputs["n7"]["path"]
assert saved.is_file()
diff --git a/tests/test_signal_generator.py b/tests/test_signal_generator.py
index baa8e61..fdc786a 100644
--- a/tests/test_signal_generator.py
+++ b/tests/test_signal_generator.py
@@ -34,7 +34,7 @@ def test_signal_generator_sine_tone(tmp_path: Path) -> None:
"sample_rate": 48000,
},
),
- NodeInstance(id="n2", type="Preview", pos={"x": 200, "y": 0}, widgets={}),
+ NodeInstance(id="n2", type="PreviewAudio", pos={"x": 200, "y": 0}, widgets={}),
],
links=[Link(id="l1", **{"from": ["n1", 0], "to": ["n2", 0], "type": "AUDIO"})],
)
@@ -81,7 +81,7 @@ def test_fm_from_oscillator_blocks(tmp_path: Path) -> None:
"sample_rate": sr,
},
),
- NodeInstance(id="out", type="Preview", pos={"x": 400, "y": 0}, widgets={}),
+ NodeInstance(id="out", type="PreviewAudio", pos={"x": 400, "y": 0}, widgets={}),
],
links=[
Link(id="l1", **{"from": ["mod", 0], "to": ["car", 2], "type": "AUDIO"}),
@@ -159,7 +159,7 @@ def test_fm_index_via_floatmath_divide(tmp_path: Path) -> None:
"sample_rate": sr,
},
),
- NodeInstance(id="out", type="Preview", pos={"x": 800, "y": 40}, widgets={}),
+ NodeInstance(id="out", type="PreviewAudio", pos={"x": 800, "y": 40}, widgets={}),
],
links=[
Link(id="l1", **{"from": ["delta", 0], "to": ["div", 0], "type": "AUTOMATION"}),
diff --git a/tests/test_spatial_upmix_nodes.py b/tests/test_spatial_upmix_nodes.py
index a22eed5..89f2212 100644
--- a/tests/test_spatial_upmix_nodes.py
+++ b/tests/test_spatial_upmix_nodes.py
@@ -75,7 +75,7 @@ def test_binaural_and_atmos_templates_via_executor(tmp_path: Path) -> None:
"pos": {"x": 200, "y": 0},
"widgets": {"model": "hrtf-binaural-v0", "strength": 0.4},
},
- {"id": "n3", "type": "Preview", "pos": {"x": 400, "y": 0}, "widgets": {}},
+ {"id": "n3", "type": "PreviewAudio", "pos": {"x": 400, "y": 0}, "widgets": {}},
],
"links": [
{"id": "l1", "from": ["n1", 0], "to": ["n2", 0], "type": "AUDIO"},
@@ -109,7 +109,7 @@ def test_binaural_and_atmos_templates_via_executor(tmp_path: Path) -> None:
"pos": {"x": 400, "y": 0},
"widgets": {"layout": "stereo"},
},
- {"id": "n4", "type": "Preview", "pos": {"x": 600, "y": 0}, "widgets": {}},
+ {"id": "n4", "type": "PreviewAudio", "pos": {"x": 600, "y": 0}, "widgets": {}},
],
"links": [
{"id": "l1", "from": ["n1", 0], "to": ["n2", 0], "type": "AUDIO"},