File size: 503 Bytes
13ca437
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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