mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
agressive compressive
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -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>
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user