<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/embedded-audio-players-in-jupyter-notebooks-running-irkernel/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://blog.ouseful.info/2018/09/06/embedded-audio-players-in-jupyter-notebooks-running-irkernel/"> Rstats – OUseful.Info, the blog…</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>For ref, when running <a rel="nofollow" href="https://github.com/IRkernel/IRkernel" target="_blank"><em>IRkernel</em></a> Jupyter R notebooks, media objects can be embedded by making use of the <a rel="nofollow" href="https://shiny.rstudio.com/articles/tag-glossary.html" target="_blank"><code>shiny::tags</code></a> function, that can return HTML elements with appropriate MIME types, and are renderable using <code>_repr_html</code> machinery (h/t <a rel="nofollow" href="https://github.com/IRkernel/IRdisplay/issues/43#issuecomment-418992225" target="_blank">@flying-sheep</a>):</p>
<p><a rel="nofollow" href="https://shiny.rstudio.com/articles/tag-glossary.html" target="_blank"><img data-orig-file="https://ouseful.files.wordpress.com/2018/09/shiny_-_shiny_html_tags_glossary.png?w=450&amp;h=240&amp;fit=527%2C240" data-orig-size="1616,736" data-medium-file="https://ouseful.files.wordpress.com/2018/09/shiny_-_shiny_html_tags_glossary.png?w=450&amp;h=240&amp;fit=527%2C240?w=300" data-attachment-id="18524" data-image-meta="{" data-image-description="" src="https://ouseful.files.wordpress.com/2018/09/shiny_-_shiny_html_tags_glossary.png?w=450&h=240&fit=527%2C240" data-permalink="https://blog.ouseful.info/2018/09/06/embedded-audio-players-in-jupyter-notebooks-running-irkernel/shiny_-_shiny_html_tags_glossary/" data-large-file="https://ouseful.files.wordpress.com/2018/09/shiny_-_shiny_html_tags_glossary.png?w=450&amp;h=240&amp;fit=527%2C240?w=830" alt="" data-image-title="Shiny_-_Shiny_HTML_Tags_Glossary" sizes="(max-width: 527px) 100vw, 527px" data-comments-opened="1" class="wp-image-18524" data-recalc-dims="1"></a></p>
<p>For example:</p>
<p><img data-orig-file="https://ouseful.files.wordpress.com/2018/09/r_notebook_audio.png?w=450&amp;h=301&amp;fit=497%2C301" data-orig-size="1606,972" data-medium-file="https://ouseful.files.wordpress.com/2018/09/r_notebook_audio.png?w=450&amp;h=301&amp;fit=497%2C301?w=300" data-attachment-id="18523" data-image-meta="{" data-image-description="" src="https://ouseful.files.wordpress.com/2018/09/r_notebook_audio.png?w=450&h=301&fit=497%2C301" data-permalink="https://blog.ouseful.info/2018/09/06/embedded-audio-players-in-jupyter-notebooks-running-irkernel/r_notebook_audio/" data-large-file="https://ouseful.files.wordpress.com/2018/09/r_notebook_audio.png?w=450&amp;h=301&amp;fit=497%2C301?w=830" alt="" data-image-title="r_notebook_audio" sizes="(max-width: 497px) 100vw, 497px" data-comments-opened="1" class="wp-image-18523" data-recalc-dims="1"></p>
<p>PS By the by, I notice the existence of another R kernel for Jupyter notebooks, <a rel="nofollow" href="https://github.com/JuniperKernel/JuniperKernel" target="_blank"><em>JuniperKernel</em></a>. An advantage of this over <em>IRkernel</em> is that it supports <a rel="nofollow" href="https://xwidgets.readthedocs.io/en/latest/" target="_blank"><code>xwidgets</code></a>, a C++ widget implementation for Jupyter notebooks akin to <code>ipywidgets</code>. (As far as I know, there isn’t a widget implementation for <em>IRkernel</em>, although maybe something can be finessed using <code>shiny::tags</code> and other bits of <code>shiny</code> machinery? ) Although I could install <code>JuniperKernel</code> on my Mac, I had some issues getting it to work that I haven’t had a chance to explore yet, so I don’t yet have a widgets demo…</p>
<p>PS having to save an audio file to then load back into the player may be a faff; that said, it looks like there may be a route to <a rel="nofollow" href="http://www.iandevlin.com/blog/2012/09/html5/html5-media-and-data-uri/" target="_blank">using a data URI</a>? Not tried this yet; if you have a short reproducible demo that works, please share via the comments:-)</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://blog.ouseful.info/2018/09/06/embedded-audio-players-in-jupyter-notebooks-running-irkernel/"> Rstats – OUseful.Info, the blog…</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/ChKTmyD9bow" height="1"></a></div>