Last active
October 10, 2020 13:31
-
-
Save lebalz/46c7a368e66fab900ae0760c001ccf04 to your computer and use it in GitHub Desktop.
playsound in jupyter
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
from IPython.display import Audio | |
from pathlib import Path | |
def _playsoundJupyter(sound, block=True): | |
sound = Path(sound) | |
sound = str(Path(get_ipython().home_dir, sound.name)) | |
audio = Audio(sound, autoplay=False) | |
display(audio) | |
from platform import system | |
system = system() | |
if system == 'Windows': | |
playsound = _playsoundWin | |
elif system == 'Darwin': | |
playsound = _playsoundOSX | |
else: | |
playsound = _playsoundJupyter | |
# playsound = _playsoundNix |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Used on tljh to enable playsound (must be installed). Modify in admin console
playsound.py
. Locate with