audio.py 756 B

123456789101112131415161718192021222324252627282930313233
  1. # try:
  2. # import simpleaudio
  3. # bell = simpleaudio.WaveObject.from_wave_file("bell.wav")
  4. # def play_bell():
  5. # bell.play()
  6. # running = simpleaudio.WaveObject.from_wave_file("running.wav")
  7. # running.audio_data *= 200 # repeat sample
  8. # playing = None
  9. # def play_running():
  10. # global playing
  11. # if playing is None:
  12. # playing = running.play()
  13. # def stop_running():
  14. # global playing
  15. # if playing is not None:
  16. # playing.stop()
  17. # playing = None
  18. # except ImportError:
  19. print("Audio disabled. Install python package 'simpleaudio' for a fully immersive experience :)")
  20. def play_bell():
  21. pass
  22. def play_running():
  23. pass
  24. def stop_running():
  25. pass