From bb74d0bc9d9cfc13c1ac9377cbd0e02fa3472c55 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Mon, 1 Sep 2025 20:33:56 -0700 Subject: [PATCH] Reduce volume Signed-off-by: James Ketrenos --- voicebot/synthetic_media.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/voicebot/synthetic_media.py b/voicebot/synthetic_media.py index e2d5b23..a2c4153 100644 --- a/voicebot/synthetic_media.py +++ b/voicebot/synthetic_media.py @@ -438,12 +438,12 @@ class SyntheticAudioTrack(MediaStreamTrack): # --- 4. VOLUME COMPENSATION: Apply Y-position based volume scaling --- # Volume scaling compensates for perceptual frequency/amplitude relationship if self.video_track: - # Quadratic scaling: top = loud (1.0), bottom = quiet (approaching 0.0) - # Formula: (1 - normalized_y)² provides smooth, natural volume curve + # Scale volume from 50% (top) to 20% (bottom) + # Formula: Map normalized_y from [0,1] to volume range [0.4, 0.2] normalized_y = self.video_track.ball["y"] / self.video_track.height - volume = (1.0 - normalized_y) ** 2 # Squared for more dramatic effect + volume = 0.4 - (normalized_y * 0.3) # 0.5 - (0 to 1) * 0.3 = 0.4 to 0.2 else: - volume = 1.0 # Full volume if no video track + volume = 0.35 # Mid-range volume (35%) if no video track # --- 5. AUDIO MIXING: Combine panned base tone with centered bounce effects --- # Base tone: Apply stereo panning and volume compensation