testAudio

mail@pastecode.io avatar
unknown
python
a year ago
397 B
5
Indexable
Never
import pygame

# Imposta il percorso del file audio (deve essere un file WAV)
AUDIO_FILE_PATH = "/home/rpi/mixkit-emergency-alert-alarm-1007.wav"

def play_audio(file_path):
    pygame.mixer.init()
    pygame.mixer.music.load(file_path)
    pygame.mixer.music.play()
    while pygame.mixer.music.get_busy():
        continue

if __name__ == "__main__":
    play_audio(AUDIO_FILE_PATH)