Last active
July 18, 2018 03:51
-
-
Save BlogBlocks/8426999e17ef19b9ea7e2a27a3223773 to your computer and use it in GitHub Desktop.
play music while "Jupytering"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pyglet | |
| def exit_callback(dt): | |
| pyglet.app.exit() | |
| return | |
| def pmp3(mp3File): | |
| music = pyglet.media.load(mp3File) | |
| music.play() | |
| pyglet.clock.schedule_once(exit_callback , music.duration) | |
| pyglet.app.run() | |
| return |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use in jupyter notebook
import Pmp3
mp3File = 'audio.mp3'
Pmp3.pmp3(mp3File)