Playing audio continuously in Python

55 Views Asked by At

Hello there,

I search for a way to play audio files in Python in real time and with as less code as possible. I tried to use a gstreamer-command to play a pre-recorded sinewave:

os.system('gst-play-1.0 sine_wave.mp3')

But this solution is trash, as it must first load the media file and therefore has a 2 seconds latency before playing the sound. In this time, the program run stops. I search for a solution that can play sounds right away when called in the program and does not have an impact to the fluid run of it. So it should be capable of playing the sound multiple times in a second. Any ideas?

Thanks for the answers in advance!

0

There are 0 best solutions below