This commit is contained in:
royjr
2026-09-07 03:22:55 -04:00
parent d02db967fe
commit e6cce08ff6
2 changed files with 3 additions and 3 deletions
@@ -4,10 +4,10 @@ Put short **48 kHz, mono, 16-bit PCM WAV** files in `/data/media/0/custom_audio/
Each gear change plays `<gear>.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.
+1 -1
View File
@@ -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