# Play a sound in Jupyter Notebook

**URL:** <https://discourse.julialang.org/t/play-a-sound-in-jupyter-notebook/15870>\
**Category:** General Usage\
**Tags:** jupyter, sound\
**Created:** [October 4, 2018, 12:03pm UTC](https://discourse.julialang.org/t/play-a-sound-in-jupyter-notebook/15870 "2018-10-04T12:03:14Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![xor0110](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xor0110/32/7926_2.png) [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Post date:** [August 14, 2019, 7:10pm UTC](https://discourse.julialang.org/t/play-a-sound-in-jupyter-notebook/15870/10 "2019-08-14T19:10:34Z")

</div>

Found this thread actually looking for how to have a player widget on a notebook, ended up with this after a [python example](https://nbviewer.jupyter.org/gist/Carreau/5507501/the%20sound%20of%20hydrogen.ipynb):

```julia
using WAV
wavwrite(0.4*rand(2000, 2), "example2.wav", Fs=44100.0)

audioplayer(filepath) = """
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Simple Test</title>
    </head>
    
    <body>
    <audio controls="controls" style="width:600px" >
      <source src="$filepath" type="audio/wav" />
      Your browser does not support the audio element.
    </audio>
    </body>
    """

display("text/html", audioplayer("example2.wav"))

```

---

_[View the full topic](https://discourse.julialang.org/t/play-a-sound-in-jupyter-notebook/15870)._
