02-ago: [proyecto] vigilancia - Fase 1: sirena wail estilo Proteccion Civil (400-1000Hz, 8s) + Fase 2: titulo ALERTA rojo parpadeante en el teleprompter
This commit is contained in:
@@ -156,7 +156,7 @@ def _esperar_fin(cast, url, timeout=120):
|
||||
|
||||
|
||||
def _generar_pitido():
|
||||
"""Genera una sirena de emergencia (WAV) si no existe."""
|
||||
"""Genera una sirena estilo Proteccion Civil (wail) si no existe."""
|
||||
ruta = os.path.join(MEDIA_DIR, "pitido_emergencia.wav")
|
||||
if os.path.exists(ruta):
|
||||
return ruta
|
||||
@@ -168,10 +168,16 @@ def _generar_pitido():
|
||||
sr = 44100
|
||||
dur = config.GOOGLE_TV_PITIDO_SG
|
||||
t = np.linspace(0, dur, int(sr * dur), endpoint=False)
|
||||
freq = 500 + 400 * np.abs(np.sin(2 * np.pi * 0.5 * t))
|
||||
if config.GOOGLE_TV_PITIDO_ESTILO == "wail":
|
||||
# wail defensa civil: sube 400->1000 y baja en ciclos de ~4s
|
||||
periodo = 4.0
|
||||
fase = (t % periodo) / periodo
|
||||
freq = 400 + 600 * (1 - abs(2 * fase - 1))
|
||||
else:
|
||||
freq = 500 + 400 * np.abs(np.sin(2 * np.pi * 0.5 * t))
|
||||
fase = 2 * np.pi * np.cumsum(freq) / sr
|
||||
y = 0.7 * np.sin(fase)
|
||||
fade = min(0.2, dur / 4)
|
||||
y = 0.8 * np.sin(fase)
|
||||
fade = min(0.3, dur / 4)
|
||||
n_fade = int(fade * sr)
|
||||
y[:n_fade] *= np.linspace(0, 1, n_fade)
|
||||
y[-n_fade:] *= np.linspace(1, 0, n_fade)
|
||||
|
||||
Reference in New Issue
Block a user