Lorenzo Vigano
Lorenzo Vigano

Reputation: 25

How to continue computation while pyaudio is playing a .wav file

I am using pyaudio to play a .wav file.

I also have cv2 displaying the webcam on the screen.

When I call the function that plays the audio file, everything stops until it is finished playing. That includes the webcam feed and all other computation.

Is there a way for me to play the .wav file with my function while not effecting everything else. I would think that multiprocessing would be something to use, but after a few hours of attempting this, I am not really getting anywhere.

All help is appreciated! Thank you

Upvotes: 1

Views: 137

Answers (1)

drumino
drumino

Reputation: 90

You won't really need another process, another thread will do just fine. Have a look at the Python Threading Documentation

Upvotes: 1

Related Questions