{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# The sound Of Hydrogen" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Inspired by [minutephysics](https://www.youtube.com/watch?v=qyi5SvPlMXc), and the explanation do do it in mathematica: [The sound of hydrogen](https://www.youtube.com/watch?v=IhvW8yZdE5A).\n", "\n", "The goal of this notebook is to show how one can play a sound file in notebook, using Html5 <audio> tag to play it dirrectly inside the browser.\n", "\n", "To do this we use the spectrum of hydrogen that we shift the into the audible range. You can listen to it in the last cell of this notebook.\n", "Wait a few second if you are on nbviewer, the notebook is not light (someone to update it to use mp3? ogg? or a compressed format?)\n", "\n", "Please be aware that the html5 player is not working on some old browser and IE." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\\[Edit\\] apparently the process of converting something not audible into sound have diffent naming: sonify,\n", "sonification or auralizing according to the comment on twitter." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.kernel.zmq.pylab.backend_inline].\n", "For more information, type 'help(pylab)'.\n" ] } ], "source": [ "%pylab inline" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import scipy.constants as const\n", "import scipy\n", "from scipy.io import wavfile\n", "from IPython.core.display import HTML\n", "from __future__ import division" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# this is a wrapper that take a filename and publish an html