1

I'm coding a little sound player with python and I can't find a way to stop pydub audio during a sound..

I can't stop the thread by doing something like :

class Player(Thread):

#init method

    def run(self):
        
        sound = AudioSegment.from_file(self.sound)
        
        while running:

                play(sound)

#call run

thread.running = False           

Because the program is like paused when playing with pydub (like with sleep())

Did someone know a good way to stop audio from playing by killing the thread or the audio directly from pydub ?

(Or even an other python sound lib that can be stopped)

Thank you in advance for your time !

0 Answers0