Skip to content

Instantly share code, notes, and snippets.

@lebalz
Last active October 10, 2020 13:31
Show Gist options
  • Save lebalz/46c7a368e66fab900ae0760c001ccf04 to your computer and use it in GitHub Desktop.
Save lebalz/46c7a368e66fab900ae0760c001ccf04 to your computer and use it in GitHub Desktop.
playsound in jupyter
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
@lebalz
Copy link
Author

lebalz commented Oct 10, 2020

Used on tljh to enable playsound (must be installed). Modify in admin console playsound.py. Locate with

sudo -E pip show playsound

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment