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
fix(editor): three more preview↔export audio seam bugs
Benjamin Freeman75ddaddd70db
diff --git a/src/components/ai-edition/VirtualPreview.tsx b/src/components/ai-edition/VirtualPreview.tsxindex a75af9f7c..27cf7c81f 100644--- a/src/components/ai-edition/VirtualPreview.tsx+++ b/src/components/ai-edition/VirtualPreview.tsx@@ -613,7 +613,11 @@ export function VirtualPreview({track.timelineStartSec,);const trackTarget = resolveTimelineAudioPlayback(outputTimeSec, outputStartSec, track);- if (el.playbackRate !== v.playbackRate) el.playbackRate = v.playbackRate;+ // Imported audio plays at its natural 1× rate, NOT the video's. The export+ // sums it into the programme at 1× — speed regions stretch clip PCM only,+ // never the imported track — so following `v.playbackRate` would pitch a+ // voiceover up under a 2× region and finish it early, diverging from export.+ if (el.playbackRate !== 1) el.playbackRate = 1;const trackGainNode = audioTrackGainNodesRef.current.get(track.id);if (trackGainNode) {trackGainNode.gain.value = audioGainScalar(track.gainDb);@@ -639,6 +643,13 @@ export function VirtualPreview({}}if (!v.paused && trackTarget.shouldPlay && el.paused) {+ // Resume a context suspended by autoplay policy, exactly as the primary+ // loop does above — otherwise a track that starts while the primary+ // element is silent (its span is over, or a recording with no separate+ // audio element) routes into a suspended context and plays nothing.+ if (audioGraphRef.current?.context.state === "suspended") {+ void audioGraphRef.current.context.resume();+ }const playback = el.play();if (playback) void playback.catch(() => undefined);} else if ((v.paused || !trackTarget.shouldPlay) && !el.paused) {diff --git a/src/native/sceneDescription.ts b/src/native/sceneDescription.tsindex 1a06a356d..64ea56eff 100644--- a/src/native/sceneDescription.ts+++ b/src/native/sceneDescription.ts@@ -511,6 +511,13 @@ export function buildSceneDescription(// asset's file path and a concrete trim-out (the source duration when the tail// isn't trimmed — the compositor preallocates its decode window from it). A// track whose asset or path is missing is dropped rather than sent path-less.+ // Project onto the SAME clips the programme is assembled from. `resolveVisibleClips`+ // (below) drops clips whose asset has no resolvable `originalPath`; if the projection+ // walked the full `document.timeline.clips` it would count a relinked-away clip the+ // programme does not, landing every following track past the real programme end.+ const projectedClips = document.timeline.clips.filter(+ (clip) => assetById.get(clip.assetId)?.originalPath,+ );const audioTracks = document.audioTracks.flatMap((track) => {const asset = assetById.get(track.assetId);if (!asset?.originalPath) return [];@@ -522,7 +529,7 @@ export function buildSceneDescription(// mixes onto is trim-compressed — so project raw→output. Passing the raw head// verbatim delayed the track by the total trim duration ahead of it (issue #350).startSec: projectRawTimelineSecToPlayback(- document.timeline.clips,+ projectedClips,document.timeline.trimRanges,track.timelineStartSec,),