Reduce volume

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2025-09-01 20:33:56 -07:00
parent 2ad9871ea4
commit bb74d0bc9d

View File

@ -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