Files
sunnypilot/openpilot/selfdrive/assets/sounds/make_beeps.py
Adeeb Shihadeh 27122bbd28 lint: check indentation (#38454)
* lint: check indentation

* cleanup

* happy

* that was too much

* happy
2026-07-25 10:29:37 -07:00

20 lines
544 B
Python

import numpy as np
from scipy.io import wavfile
sr = 48000
max_int16 = 2**15 - 1
def harmonic_beep(freq, duration_seconds):
n_total = int(sr * duration_seconds)
signal = np.sin(2 * np.pi * freq * np.arange(n_total) / sr)
x = np.arange(n_total)
exp_scale = np.exp(-x/5.5e3)
return max_int16 * signal * exp_scale
engage_beep = harmonic_beep(1661.219, 0.5)
wavfile.write("engage.wav", sr, engage_beep.astype(np.int16))
disengage_beep = harmonic_beep(1318.51, 0.5)
wavfile.write("disengage.wav", sr, disengage_beep.astype(np.int16))