Spaces:
Running
Running
Commit ·
4edf38e
1
Parent(s): 048ed88
Bubbles checkpotin working but the volue i sles
Browse files- utils/bubble/Bubble.js +14 -12
utils/bubble/Bubble.js
CHANGED
|
@@ -113,19 +113,21 @@ class BubbleMaker {
|
|
| 113 |
mixLabels.push(`[${label}]`);
|
| 114 |
});
|
| 115 |
|
| 116 |
-
|
| 117 |
-
//
|
| 118 |
-
//
|
| 119 |
-
//
|
| 120 |
-
//
|
| 121 |
-
//
|
| 122 |
-
//
|
| 123 |
-
|
| 124 |
-
let
|
| 125 |
-
|
| 126 |
-
|
|
|
|
|
|
|
|
|
|
| 127 |
}
|
| 128 |
-
filterParts.push(`${mixLabels.join('')}amix=${amixArgs}[aout]`);
|
| 129 |
|
| 130 |
const ac = outputAudioPath.toLowerCase().endsWith('.mp3') ? 'libmp3lame' : 'aac';
|
| 131 |
const fc = filterParts.join(';');
|
|
|
|
| 113 |
mixLabels.push(`[${label}]`);
|
| 114 |
});
|
| 115 |
|
| 116 |
+
// Instead of feeding all streams into a single `amix` (which averages the
|
| 117 |
+
// input samples when more than two streams are present), build a sequential
|
| 118 |
+
// 2-input mixing chain. this keeps the original audio level constant no
|
| 119 |
+
// matter how many effects have not yet started or have already finished.
|
| 120 |
+
// each step uses `normalize=0`, which is safe because amix only has two
|
| 121 |
+
// inputs in each invocation. this also sidesteps the old-
|
| 122 |
+
// ffmpeg-throws-errors bug.
|
| 123 |
+
let prevLabel = mixLabels[0];
|
| 124 |
+
for (let idx = 1; idx < mixLabels.length; idx++) {
|
| 125 |
+
const curLabel = mixLabels[idx];
|
| 126 |
+
const outLabel = idx === mixLabels.length - 1 ? '[aout]' : `[mix${idx}]`;
|
| 127 |
+
// inputs=2 because we're only mixing a running mix with a single new sfx
|
| 128 |
+
filterParts.push(`${prevLabel}${curLabel}amix=inputs=2:duration=first:dropout_transition=0:normalize=0${outLabel}`);
|
| 129 |
+
prevLabel = outLabel;
|
| 130 |
}
|
|
|
|
| 131 |
|
| 132 |
const ac = outputAudioPath.toLowerCase().endsWith('.mp3') ? 'libmp3lame' : 'aac';
|
| 133 |
const fc = filterParts.join(';');
|