Playing a sound in a ipython notebook

The previous answer is pretty old. You can use IPython.display.Audio now. Like this:

import IPython
IPython.display.Audio("my_audio_file.mp3")

Note that you can also process any type of audio content, and pass it to this function as a numpy array.

If you want to display multiple audio files, use the following:

IPython.display.display(IPython.display.Audio("my_audio_file.mp3"))
IPython.display.display(IPython.display.Audio("my_audio_file.mp3"))

Leave a Comment