#CMD: pip install preferredsoundplayer import time import preferredsoundplayer #sound file in same folder as this .py file, or use a path # ,block=True wait until the sound is finished. print("ding.au playing") preferredsoundplayer.soundplay("ding.au",block=True) print("cow.wav playing") preferredsoundplayer.soundplay("cow.wav",block=True) print("sample.mid playing") preferredsoundplayer.soundplay("sample.mid",block=True) print("\nbond007.mid starting. (it has a few seconds of silence)") bond007 = preferredsoundplayer.soundplay("bond007.mid") print("sleep for 007 seconds") time.sleep(7) print("woke up and stopped the music") preferredsoundplayer.stopsound(bond007) print("after the stopsound") print("\nStarting continuous looping of the ding file") backgroundDing = preferredsoundplayer.loopwave("ding.au") print("sleep for 3 seconds") time.sleep(3) print("Stopping the looping") preferredsoundplayer.stoploop(backgroundDing) ''' import playsound #pip install playsound As Administrator! why? what difference? playsound.playsound("cow.wav") # ?? Now only plays first, then crahses??? playsound.playsound("ding.au") playsound.playsound("sample.mid") #MIDI #playsound.playsound("bond007.mid") #how to stop??? for i in range(5): playsound.playsound("ding.au") for i in range(3): playsound.playsound("beep.au") ''' #import os #os.system("start cow.wav") # Groove starts and plays the file