PurePolyglot / src /utils.py
github-actions[bot]
Automated deployment to Hugging Face
a2b450c
Raw
History Blame Contribute Delete
489 Bytes
import os
import tempfile
from pydub import AudioSegment
from pydub.generators import Sine
def create_warning_beep():
"""Generates a warning sound file for the UI."""
try:
beep = Sine(1000).to_audio_segment(duration=500).apply_gain(5)
path = os.path.join(tempfile.gettempdir(), "warning_beep.wav")
beep.export(path, format="wav")
return path
except Exception as e:
print(f"⚠️ Could not create warning beep: {e}")
return None