agressive compressive

This commit is contained in:
legop3
2026-02-18 22:21:41 -05:00
parent f1c6ab44ce
commit d5978c5e3e
3 changed files with 28 additions and 19 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -11,7 +11,7 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="apple-mobile-web-app-title" content="Multi Roomba Rover" /> <meta name="apple-mobile-web-app-title" content="Multi Roomba Rover" />
<title>Multi Roomba Rover</title> <title>Multi Roomba Rover</title>
<script type="module" crossorigin src="/assets/index-ByiKIpTV.js"></script> <script type="module" crossorigin src="/assets/index-D5tnr02G.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Bz1ixYh7.css"> <link rel="stylesheet" crossorigin href="/assets/index-Bz1ixYh7.css">
</head> </head>
<body> <body>
+20 -11
View File
@@ -16,6 +16,13 @@ const AUDIO_RETRY_MS = 3000;
const AUDIO_DUCK_FACTOR = 0.55; const AUDIO_DUCK_FACTOR = 0.55;
const BRUSH_CURRENT_THRESHOLD_MA = 40; const BRUSH_CURRENT_THRESHOLD_MA = 40;
const COMPRESSOR_REDUCTION_ACTIVE_DB = -0.75; const COMPRESSOR_REDUCTION_ACTIVE_DB = -0.75;
const COMPRESSOR_SETTINGS = {
threshold: -30,
knee: 10,
ratio: 8,
attack: 0.002,
release: 0.18,
};
export default function VideoTile({ export default function VideoTile({
sessionInfo, sessionInfo,
@@ -164,11 +171,11 @@ export default function VideoTile({
} }
if (!audioCompressorRef.current) { if (!audioCompressorRef.current) {
const compressor = ctx.createDynamicsCompressor(); const compressor = ctx.createDynamicsCompressor();
compressor.threshold.value = -25; compressor.threshold.value = COMPRESSOR_SETTINGS.threshold;
compressor.knee.value = 20; compressor.knee.value = COMPRESSOR_SETTINGS.knee;
compressor.ratio.value = 5; compressor.ratio.value = COMPRESSOR_SETTINGS.ratio;
compressor.attack.value = 0.003; compressor.attack.value = COMPRESSOR_SETTINGS.attack;
compressor.release.value = 0.25; compressor.release.value = COMPRESSOR_SETTINGS.release;
audioCompressorRef.current = compressor; audioCompressorRef.current = compressor;
} }
if (!audioGainRef.current) { if (!audioGainRef.current) {
@@ -337,17 +344,19 @@ export default function VideoTile({
gainNode.gain.value = effectiveRoverGain; gainNode.gain.value = effectiveRoverGain;
} }
if (compressor) { if (compressor) {
compressor.threshold.value = -25; compressor.threshold.value = COMPRESSOR_SETTINGS.threshold;
compressor.knee.value = 20; compressor.knee.value = COMPRESSOR_SETTINGS.knee;
compressor.ratio.value = 5; compressor.ratio.value = COMPRESSOR_SETTINGS.ratio;
compressor.attack.value = 0.003; compressor.attack.value = COMPRESSOR_SETTINGS.attack;
compressor.release.value = 0.25; compressor.release.value = COMPRESSOR_SETTINGS.release;
} }
resumeAudioContext(); resumeAudioContext();
reductionPollRef.current = setInterval(() => { reductionPollRef.current = setInterval(() => {
const reduction = compressor?.reduction; const reduction = compressor?.reduction;
if (typeof reduction === 'number' && reduction <= COMPRESSOR_REDUCTION_ACTIVE_DB) { if (typeof reduction === 'number' && reduction <= COMPRESSOR_REDUCTION_ACTIVE_DB) {
setLevelIndicator(`Level: ${Math.round(Math.abs(reduction))}dB`); const amount = Math.round(Math.abs(reduction) * 10) / 10;
const formatted = Number.isInteger(amount) ? amount.toFixed(0) : amount.toFixed(1);
setLevelIndicator(`Level: ${formatted}dB`);
} else { } else {
setLevelIndicator(null); setLevelIndicator(null);
} }