Playing sound and a program

54 Views Asked by At

What I want to do is get an audio file to play while a def (function) is running. I've looked it up and seen that threading works but it is wayyyy to complicated for me to work out. Is there a way you guys can explain it to me? I was using winsound to play the audio file, and SND_FILENAME.

1

There are 1 best solutions below

4
On BEST ANSWER

Try this:

from multiprocessing import Process

def play():
    #winsound stuff

def function():
    #functiony stuff

if __name__ == '__main__':
    p = Process(target=play)
    d = Process(target=function)
    p.start()
    d.start()