mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-23 10:02:06 +08:00
14ff1fb436
version: sunnypilot v2026.002.000 (dev)
date: 2026-06-09T06:39:10
master commit: 01a843e0ac
20 lines
554 B
Python
20 lines
554 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))
|