How to trigger from Python playing of a WAV or MP3 audio file on a Mac?

后端 未结 3 1818

I\'m looking for an elegant way, without a ton of dependencies as in some of the solutions I googled up.

Thanks for any ideas.

3条回答
  •  不知归路
    2020-12-06 12:17

    The leanest most portable way I've found to play .mp3 and .wav files is playsound.

    import playsound
    
    # wait for the sound to finish playing?
    blocking = True
    
    playsound.playsound("yourfile.mp3", block=blocking)
    

提交回复
热议问题