You can embed videos in Jupyter, as you can see in the blogs below. http://jakevdp.github.io/blog/2013/05/12/embedding-matplotlib-animations/
I want to embed a sound file in the same way and play it from Jupyter.
Embed it in the same way as the above blog using HTML5 Audio elements.
Define a function like this
from IPython.display import HTML
def embedAudio(filename):
tmpl = """
<audio controls>
<source src="data:audio/x-m4v;base64,{0}" type="audio/wav">
"""
return HTML(tmpl.format(open(filename, "rb").read().encode("base64")))
If you execute it like this, you can embed it.
embedAudio("myaudio.wav")
However, only one per Cell.
Recommended Posts