On Fri, Sep 16, 2016 at 4:06 AM, kerbingamer376 <martinjp...@gmail.com> wrote: > I have a library that allows me to play sound files. However, the play > function waits for the sound to finish before it returns, and I'd like to be > able to start the sound playing, and then have it return immediately so my > program can continue, but also be able to know when the sound finishes. Is > this possible, without modifying the library? >
It depends on the library. What you want is often called "asynchronous playing", and it's usually possible, one way or another. As a very simple example, creating a subprocess ['vlc', '--play-and-exit', 'some/audio/file'] will let you start something playing, and then have the options to wait for the process to exit (equivalent to what you have), be notified when it exits (what you're asking for), or kill the process (another important feature, esp if you want to start a different sound playing). But it's all up to the library. ChrisA -- https://mail.python.org/mailman/listinfo/python-list