Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
feat(editor): cut the notch into the take, inside one outline
EtienneLescotf74ac544db51
diff --git a/src/components/ai-edition/v4/EditorShellV4.module.css b/src/components/ai-edition/v4/EditorShellV4.module.cssindex 7ed68d78c..15af76b3e 100644--- a/src/components/ai-edition/v4/EditorShellV4.module.css+++ b/src/components/ai-edition/v4/EditorShellV4.module.css@@ -1562,6 +1562,32 @@/* Alt is held: the next drag on this pill slides the file under it rather thanmoving the pill. The cursor is the confirmation, not the lesson — the tooltipcarries the words. */+/* A take that holds somewhere is drawn in pieces inside ONE outline: the notch is cut out+ of the fill, not laid over it, so the pill still reads as one take — one draggable,+ slippable object. Opposite polarity to the clip lane's band, which means "the picture+ freezes here"; this one means "the voice stops here, and the film runs on underneath"+ (issue #560). */+.laneAudioPiece {+ position: absolute;+ top: 0;+ bottom: 0;+ overflow: hidden;+ pointer-events: none;+}+.laneAudioNotch {+ position: absolute;+ top: 0;+ bottom: 0;+ min-width: 2px;+ pointer-events: none;+ background: repeating-linear-gradient(+ -45deg,+ color-mix(in srgb, var(--warn) 42%, transparent) 0 3px,+ transparent 3px 6px+ );+ border-left: 1px solid color-mix(in srgb, var(--warn) 70%, transparent);+ border-right: 1px solid color-mix(in srgb, var(--warn) 70%, transparent);+}.laneAudioSlip {cursor: ew-resize;}diff --git a/src/components/ai-edition/v4/V4Timeline.tsx b/src/components/ai-edition/v4/V4Timeline.tsxindex 7e9c9e796..9f6ce3930 100644--- a/src/components/ai-edition/v4/V4Timeline.tsx+++ b/src/components/ai-edition/v4/V4Timeline.tsx@@ -62,7 +62,9 @@ import {newRegionDurationSec,setTimelineScale,} from "@/lib/ai-edition/timeline/newRegionDuration";+import { removedRawSpans } from "@/lib/ai-edition/timeline/programme-time";import { ventilateSpanAcrossClips } from "@/lib/ai-edition/timeline/region-ventilation";+import { type TakePiece, takeProgramme } from "@/lib/ai-edition/timeline/take-programme";import { coalesceRegionsForRuler } from "@/lib/ai-edition/timeline/timelineMap";import {coalescedTrimGroups,@@ -397,6 +399,7 @@ const AudioLanePill = memo(function AudioLanePill({slipArmed,outputGain,ghost,+ pieces,}: {track: AxcutAudioTrack;url: string | undefined;@@ -437,8 +440,18 @@ const AudioLanePill = memo(function AudioLanePill({sourceStartSec: number;sourceEndSec: number;} | null;+ /** The take's own walk, when it has one. Absent for music, for a looping take, and for+ * a take with no insertion — all of which draw one unbroken waveform, exactly as+ * before. */+ pieces?: readonly TakePiece[] | null;}) {const duration = assetDurationSec ?? track.durationSec;+ // Only a take that actually holds somewhere is drawn in pieces. Everything else keeps+ // the single waveform it has always had, so the common pill is untouched.+ const notched = pieces?.some((piece) => piece.kind === "hold") ? pieces : null;+ const pillRawStart = track.startMs / 1000;+ const pillRawSpan = Math.max(1e-6, track.endMs / 1000 - pillRawStart);+ const atPctOfPill = (rawSec: number) => ((rawSec - pillRawStart) / pillRawSpan) * 100;return (<>{/* The rest of the tape, dimmed and unclickable, behind the pill — so the pill@@ -493,15 +506,50 @@ const AudioLanePill = memo(function AudioLanePill({style={{ left: 0 }}onPointerDown={(e) => onStartDrag(e, track, "l")}/>- <ClipWaveform- videoUrl={url}- assetDurationSec={duration}- sourceStartSec={sourceStartSec}- sourceEndSec={sourceEndSec}- // Track gain AND the project output gain — `finish_audio` applies both and- // clamps, so scaling by the track gain alone under-read a boosted output.- gain={audioGainScalar(track.gainDb) * outputGain}- />+ {notched ? (+ // A notch cut out of the fill, inside ONE outline. The take is still one+ // take — one draggable, slippable object — and the eye should read "the+ // voice stops here", not "two takes". The opposite polarity of the clip+ // lane's band, which means "the picture freezes here" (issue #560).+ notched.map((piece) => {+ const left = atPctOfPill(piece.rawStartSec);+ const width = atPctOfPill(piece.rawEndSec) - left;+ return piece.kind === "hold" ? (+ <span+ key={piece.holdId}+ aria-hidden+ data-testid="audio-insert-notch"+ className={styles.laneAudioNotch}+ style={{ left: `${left}%`, width: `${width}%` }}+ />+ ) : (+ <span+ key={`piece-${piece.rawStartSec}`}+ aria-hidden+ className={styles.laneAudioPiece}+ style={{ left: `${left}%`, width: `${width}%` }}+ >+ <ClipWaveform+ videoUrl={url}+ assetDurationSec={duration}+ sourceStartSec={piece.sourceStartSec}+ sourceEndSec={piece.sourceEndSec}+ gain={audioGainScalar(track.gainDb) * outputGain}+ />+ </span>+ );+ })+ ) : (+ <ClipWaveform+ videoUrl={url}+ assetDurationSec={duration}+ sourceStartSec={sourceStartSec}+ sourceEndSec={sourceEndSec}+ // Track gain AND the project output gain — `finish_audio` applies both and+ // clamps, so scaling by the track gain alone under-read a boosted output.+ gain={audioGainScalar(track.gainDb) * outputGain}+ />+ )}{/* Where the file starts over, so a looping bed reads as one deliberaterepeat rather than a mystery. Only drawn when the pill actuallyoutruns its source — otherwise there is nothing to repeat. */}@@ -1046,6 +1094,30 @@ export function V4Timeline({// it keeps a document written before that rule legible instead of stacking its pills on// top of each other. A kind with no tracks takes no row, so the common single-bed// project stays exactly as tall as it was.+ // One walk per take, for the lane to draw. Same inputs the preview and the export use,+ // so a notch cannot appear where the voice does not actually stop.+ const takePieces = useMemo(() => {+ const clipAssetIds = new Set(clips.map((c) => c.assetId));+ const removed = removedRawSpans(clips, tl.trimRanges);+ const out = new Map<string, TakePiece[]>();+ for (const pill of audioPills) {+ if (pill.kind !== "voiceover" || pill.loop) continue;+ // A range naming an asset that is no clip's is a take's — the same test+ // `resolveInsertPlacement` makes, available here without a document.+ const inserts = (tl.insertRanges ?? [])+ .filter((range) => range.assetId === pill.assetId && !clipAssetIds.has(range.assetId))+ .map((range) => ({+ id: range.id,+ wordId: range.wordId,+ atSourceSec: range.atSec,+ durationSec: range.durationSec,+ }));+ if (inserts.length === 0) continue;+ out.set(pill.id, takeProgramme(pill, removed, inserts));+ }+ return out;+ }, [audioPills, clips, tl.trimRanges, tl.insertRanges]);+const audioRows = useMemo(() => {const voice = audioPills.filter((p) => p.kind === "voiceover");const music = audioPills.filter((p) => p.kind !== "voiceover");@@ -2146,6 +2218,7 @@ export function V4Timeline({slipHint={ts("audioTrack.slipHint")}slipArmed={slipArmed}outputGain={audioGainScalar(settings.audioGainDb)}+ pieces={takePieces.get(track.id) ?? null}ghost={((g) =>g? {diff --git a/src/lib/ai-edition/timeline/take-programme.test.ts b/src/lib/ai-edition/timeline/take-programme.test.tsindex 4e157d18b..37c7d595a 100644--- a/src/lib/ai-edition/timeline/take-programme.test.ts+++ b/src/lib/ai-edition/timeline/take-programme.test.ts@@ -236,3 +236,39 @@ describe("preview and export agree over a take with a cut and a pause", () => {expect(resumed).toBeCloseTo(parked ?? -1, 1);});});++// ─── What the lane has to draw ──────────────────────────────────────────────+// The notch is positioned from the walk, as a fraction of the PILL's own raw span. These+// pin the arithmetic the drawing does, so a notch cannot appear where the voice does not+// actually stop.++describe("the pieces a pill draws", () => {+ const pctOfPill = (pieces: ReturnType<typeof takeProgramme>, rawSec: number) =>+ ((rawSec - TAKE.startMs / 1000) / (TAKE.endMs / 1000 - TAKE.startMs / 1000)) * 100;++ it("cuts one notch, in the middle, at the width of the time it took", () => {+ const pieces = takeProgramme(TAKE, [], [ins(4, 1)]);+ const hold = pieces.find((p) => p.kind === "hold");+ expect(hold).toBeDefined();+ if (!hold) return;+ expect(pctOfPill(pieces, hold.rawStartSec)).toBeCloseTo(40, 6);+ expect(pctOfPill(pieces, hold.rawEndSec) - pctOfPill(pieces, hold.rawStartSec)).toBeCloseTo(+ 10,+ 6,+ );+ });++ it("leaves a take with no insertion in one piece, so the pill draws as it always did", () => {+ expect(takeProgramme(TAKE, [], []).some((p) => p.kind === "hold")).toBe(false);+ });++ it("covers the pill end to end, with no overlap and no hole", () => {+ const pieces = takeProgramme(TAKE, removedRawSpans(CLIPS, [trim(7, 8)]), [ins(4, 1)]);+ let cursor = TAKE.startMs / 1000;+ for (const piece of pieces) {+ expect(piece.rawStartSec).toBeCloseTo(cursor, 6);+ cursor = piece.rawEndSec;+ }+ expect(cursor).toBeCloseTo(TAKE.endMs / 1000, 6);+ });+});