Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

Keep ordinary audio filenames on the mixed source track

webadderall4966077e011d
diff --git a/src/lib/exporter/audioProcessorShared.ts b/src/lib/exporter/audioProcessorShared.ts
index 261615df..0e688d40 100644
--- a/src/lib/exporter/audioProcessorShared.ts
+++ b/src/lib/exporter/audioProcessorShared.ts
@@ -69,6 +69,7 @@ export function resolveSourceTrackGain(
export function getSourceTrackIdFromPath(audioPath: string): SourceTrackId {
const normalized = audioPath.toLowerCase();
+ const filename = normalized.split(/[\\/]/).pop() ?? normalized;
// Check for common patterns like .mic., -mic., mic.mp4, etc.
if (
normalized.includes(".mic.") ||
@@ -76,9 +77,7 @@ export function getSourceTrackIdFromPath(audioPath: string): SourceTrackId {
normalized.includes("_mic_") ||
normalized.includes("/mic.") ||
normalized.includes("\\mic.") ||
- normalized.endsWith("mic.mp4") ||
- normalized.endsWith("mic.m4a") ||
- normalized.endsWith("mic.wav")
+ /(?:^|[._-])mic\.(?:mp4|m4a|wav)$/.test(filename)
) {
return "mic";
}
@@ -88,9 +87,7 @@ export function getSourceTrackIdFromPath(audioPath: string): SourceTrackId {
normalized.includes("_system_") ||
normalized.includes("/system.") ||
normalized.includes("\\system.") ||
- normalized.endsWith("system.mp4") ||
- normalized.endsWith("system.m4a") ||
- normalized.endsWith("system.wav")
+ /(?:^|[._-])system\.(?:mp4|m4a|wav)$/.test(filename)
) {
return "system";
}
diff --git a/src/lib/exporter/audioRoutingEngine.test.ts b/src/lib/exporter/audioRoutingEngine.test.ts
index a915c787..cf9b7685 100644
--- a/src/lib/exporter/audioRoutingEngine.test.ts
+++ b/src/lib/exporter/audioRoutingEngine.test.ts
@@ -7,10 +7,33 @@ describe("getSourceTrackIdFromPath", () => {
["/recordings/recording-system.wav", "system"],
["/recordings/system.mp4", "system"],
["/recordings/mic.wav", "mic"],
+ ["mic.wav", "mic"],
+ ["system.m4a", "system"],
+ ["/recordings/recording_mic.wav", "mic"],
+ ["C:\\Recordings\\recording.SYSTEM.m4a", "system"],
+ ["/recordings/recording_mic_take.wav", "mic"],
])("classifies companion path %s as %s", (path, trackId) => {
expect(getSourceTrackIdFromPath(path)).toBe(trackId);
});
+ it.each([
+ "atomic.wav",
+ "dynamic.mp4",
+ "ecosystem.m4a",
+ ])("keeps ordinary filename %s on the mixed track", (filename) => {
+ expect(getSourceTrackIdFromPath(`/recordings/${filename}`)).toBe("mixed");
+ });
+
+ it("does not suppress the mixed track when another filename ends with mic.wav", () => {
+ const plan = buildResolvedAudioPlan({
+ videoResource: "/recordings/recording.mp4",
+ sourceAudioFallbackPaths: ["/recordings/mix.wav", "/recordings/atomic.wav"],
+ });
+
+ expect(plan.pathsByTrack).toEqual({ mixed: "/recordings/mix.wav" });
+ expect(plan.playbackPaths).toEqual(["/recordings/mix.wav"]);
+ });
+
it("routes mic and system companions onto their dedicated playback tracks", () => {
const plan = buildResolvedAudioPlan({
videoResource: "/recordings/recording.mp4",