Added missing sounds file from previous commit

This commit is contained in:
Kevin Veen-Birkenbach 2025-07-18 14:44:38 +02:00
parent a738199868
commit d4fbdb409f
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E

View File

@ -1,7 +1,28 @@
import numpy as np import os
import simpleaudio as sa import warnings
class Sound: class DummySound:
@staticmethod
def play_start_sound(): pass
@staticmethod
def play_cymais_intro_sound(): pass
@staticmethod
def play_finished_successfully_sound(): pass
@staticmethod
def play_finished_failed_sound(): pass
@staticmethod
def play_warning_sound(): pass
_IN_DOCKER = os.path.exists('/.dockerenv')
if _IN_DOCKER:
warnings.warn("Sound support disabled: running inside Docker.", RuntimeWarning)
Sound = DummySound
else:
try:
import numpy as np
import simpleaudio as sa
class Sound:
""" """
Sound effects for the application with enhanced complexity. Sound effects for the application with enhanced complexity.
Each sound uses at least 6 distinct tones and lasts no more than max_length seconds, Each sound uses at least 6 distinct tones and lasts no more than max_length seconds,
@ -122,3 +143,6 @@ class Sound:
durations = [d * cls.max_length / total for d in durations] durations = [d * cls.max_length / total for d in durations]
waves = [cls._generate_complex_wave(f, d) for f, d in zip(freqs, durations)] waves = [cls._generate_complex_wave(f, d) for f, d in zip(freqs, durations)]
cls._play(np.concatenate(waves)) cls._play(np.concatenate(waves))
except Exception:
warnings.warn("Sound support disabled: numpy or simpleaudio could not be imported", RuntimeWarning)
Sound = DummySound