diff --git a/openpilot/sunnypilot/selfdrive/ui/docs/custom_audio.md b/openpilot/sunnypilot/selfdrive/ui/docs/custom_audio.md index 095fb789ca..05d0a5266b 100644 --- a/openpilot/sunnypilot/selfdrive/ui/docs/custom_audio.md +++ b/openpilot/sunnypilot/selfdrive/ui/docs/custom_audio.md @@ -4,10 +4,10 @@ Put short **48 kHz, mono, 16-bit PCM WAV** files in `/data/media/0/custom_audio/ Each gear change plays `.wav`: `park.wav`, `drive.wav`, `sport.wav`, `reverse.wav`, `neutral.wav`, `low.wav`, `brake.wav`, `eco.wav`, or `manumatic.wav`. -- Entering a gear starts its audio from the beginning at full volume, with no fade-in. +- Entering a gear starts its audio from the beginning at 25% volume, with no fade-in. - Changing gears cuts the previous audio without a fade-out. If the new file is missing or invalid, playback stays silent. - Returning to a previous gear restarts its audio from the beginning. Staying in the same gear does not replay it. -- While any alert sounds, custom audio keeps playing and fades to **50% volume over 50 ms**. Afterward it fades back to full volume over **150 ms**. +- While any alert sounds, custom audio keeps playing and fades to **half its normal level (12.5%) over 50 ms**. Afterward it fades back to 25% over **150 ms**. - Alert volume is unchanged. Custom audio may be reduced further to prevent clipping when both sounds are loud. - Startup and recovery from unknown/invalid gear data or data gaps establish a silent baseline. diff --git a/openpilot/sunnypilot/selfdrive/ui/soundd.py b/openpilot/sunnypilot/selfdrive/ui/soundd.py index f2e936376a..8bd53718f7 100644 --- a/openpilot/sunnypilot/selfdrive/ui/soundd.py +++ b/openpilot/sunnypilot/selfdrive/ui/soundd.py @@ -15,7 +15,7 @@ class SounddSP(Soundd): super().callback(data_out, frames, time, status) alert_data = data_out[:frames, 0] alert_peak = float(np.max(np.abs(alert_data))) - custom_data = self.custom_audio.player.render(frames, alert_peak > 0) + custom_data = self.custom_audio.player.render(frames, alert_peak > 0) * 0.25 custom_peak = float(np.max(np.abs(custom_data))) gain = min(1.0, max(0.0, 1.0 - alert_peak) / max(custom_peak, 1e-9)) alert_data += custom_data * gain