简体   繁体   中英

How to play a sound file in Debian Python?

sorry if this is a bit noobish but it's my first post. I am trying to open a .wav file (could be any though) in Python, on Debian Linux (on my raspberry Pi) I can't find any soloution that actually works, most modules are too old and don't work. I would preferablly like it to be as simple as possible. I just want the Python script to automatically play a sound file with the default audio player.

Pyglet should work. Something like this:


    import pyglet

    sound = pyglet.resource.media('file.wav', streaming=False)
    sound.play()

I dont think it is preinstalled on the pi, but it's less than 1mb.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM