diff --git a/code/chap01preview.ipynb b/code/chap01preview.ipynb new file mode 100644 index 00000000..ddd3718c --- /dev/null +++ b/code/chap01preview.ipynb @@ -0,0 +1,422 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## ThinkDSP\n", + "\n", + "This notebook contains code examples from Chapter 1: Sounds and Signals\n", + "\n", + "Copyright 2015 Allen Downey\n", + "\n", + "License: [Creative Commons Attribution 4.0 International](http://creativecommons.org/licenses/by/4.0/)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import thinkdsp\n", + "import matplotlib.pyplot as plt" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Read a wave\n", + "\n", + "`read_wave` reads WAV files. The WAV examples in the book are from freesound.org. In the contributors section of the book, I list and thank the people who uploaded the sounds I use." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "wave = thinkdsp.read_wave('92002__jcveliz__violin-origional.wav')" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "wave.make_audio()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "I pulled out a segment of this recording where the pitch is constant. When we plot the segment, we can't see the waveform clearly, but we can see the \"envelope\", which tracks the change in amplitude during the segment." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAEKCAYAAAD6q1UVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQA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uQmCC\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "start = 1.2\n", + "duration = 0.6\n", + "segment = wave.segment(start, duration)\n", + "segment.plot()\n", + "plt.xlabel('Time (s)');" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Spectrums\n", + "\n", + "Wave provides `make_spectrum`, which computes the spectrum of the wave." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "spectrum = segment.make_spectrum()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Spectrum provides `plot`" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEKCAYAAAAb7IIBAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAG4tJREFUeJzt3XuUldWd5vHvQ4F3VAggiCgacYzpViRocOxOmzGDl7XiZU0uZlaUJE7I9OhM2zPdWSaZGY3prKSnc+mxY0yI0sEY47U1pIcE0Wg0XikIIkiUEhFKEAq5X4S6/OaPs6s8VJ1T96pTVfv5rMU679lnv++7382p85x3v5ejiMDMzPIzrNINMDOzynAAmJllygFgZpYpB4CZWaYcAGZmmXIAmJllygFgZpYpB4CZWaYcAGZmmRpe6Qa0Z8yYMTF58uRKN8PMbFBZsmTJlogY21G9AR0AkydPprq6utLNMDMbVCS92Zl6HgIyM8uUA8DMLFMOADOzTDkAzMwy5QAwM8uUA8DMLFPZBcDGuh3U1zdWuhlmZhU3oK8D6G3zn3iJeY88x3HvO5pbv/pphg+vqnSTzMwqJqs9gHmPPAfApnd28vSSmgq3xsyssrIKgGJ79u2vdBPMzCqqwwCQNEnSE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4IaNYp3gOwISMiHpX0AeC5dFx2N/DZiFgq6T4Kd358k8IB02bfAe6XdDXw26LyOygM7SxNB3nraOen/SLigKRPA/8k6XAK38Q/BuyOiCWSdgL/XGbeP0o6RtLIKPxMYXs+R+HOlQ+nbdwQEZdKOo7CkNDGDuY3a+G7gVp2JN1M4YP5O/20vuOBJ4HTo/BDLKXq/DWwKyLu6OY6/hrYGRF3druhlh0PAZn1IUnXUPjN2a+V+/BPbufgYwtdtZ33ftTcrFO8B2BmlinvAZiZZcoBYGaWKQeAmVmmHABmZplyAJiZZcoBYGaWqf8PHlNDoZPRgzUAAAAASUVORK5CYII=\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "spectrum.plot()\n", + "plt.xlabel('Frequency (Hz)');" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The frequency components above 10 kHz are small. We can see the lower frequencies more clearly by providing an upper bound:" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEKCAYAAAAb7IIBAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAH31JREFUeJzt3XmUXHWd9/H3t6s7C0kn6ZCFbBDABMiIBgwIw4wwomwzj+A5OMKMEpcZfFyeEdcBPfPIuI6OMh4cZREiqAhBBMmDQcyEHYQsLEkgW5ME0lk7ZOskne501ff54/66qa7eaunuWu7ndU6dqvrVXX6/ut33c+/vLmXujoiIxE9VsSsgIiLFoQAQEYkpBYCISEwpAEREYkoBICISUwoAEZGYUgCIiMSUAkBEJKYUACIiMVVd7Ar0Zty4cT59+vRiV0NEpKwsX758l7uP72u4kg6A6dOns2zZsmJXQ0Skr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Xi8GN6PJAqEWuABdz8EYGbZ3BvqAuAdZtZ+X5rRYVqtwBJ3bwjTeonoXu/7gG3uvhTAwx1bzey3wL+Z2VeILuW/o5t5TSK6FXS6+e7+ufY3ZvZ4+odm9lWi7+SnacU7ie6sqQCQrCgApNwdTHttwPfc/Zb0AczsGnq+RW4bb3WFDsuY1v9x9043UjOz84CWtKIk0f+RdTcPdz9kZouIbn3890Rb+5maM+bdKzM7H/gQ0S9NpRsWpiWSFR0DkEryCPAJi347ATObYmYTgCeBD5rZ8NDf/r/SxtkEvCu8vjxjWp+26FbcmNlMi36gpSdrgMlmdkYYvjatP/424EZgadreSrrVhC6evpjZccDPgL9398yV/UzglWymIwLaA5AK4u5/MrNTgD+H47IHgI+4+wtmNp/oTqqvEx0wbfdD4F4z+yjwaFr5bURdOy+Eg7yNwGW9zLvVzD4M/MTMhhNtib8POODuy81sP/CLHsZdY2ajzazW3Zv6aObHiO4k+UBo41Z3v8TMJhJ1CW3rY3yRDrobqMSOmV1PtGL+4SDNbzLwOHCyu6d6GOYLQJO735bnPL4A7Hf32/OuqMSOuoBEBpCZXUX0G85f72nlH9xE52MLudoL3FnA+BJD2gMQEYkp7QGIiMSUAkBEJKYUACIiMaUAEBGJKQWAiEhMKQBERGLq/wNpm5g8ABPDdwAAAABJRU5ErkJggg==\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "spectrum.plot(high=10000)\n", + "plt.xlabel('Frequency (Hz)');" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Spectrum provides `low_pass`, which applies a low pass filter; that is, it attenuates all frequency components above a cutoff frequency." + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "spectrum.low_pass(3000)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The result is a spectrum with fewer components." + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [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lfRp4DuSJlPaE/8YsDMiVkraDnx/gHGflTRV0pSI2DFEMy+i9CTJO1Mb10fEOZIOo9QltGGI8c3e4qeBWnYkXUNpw/yNUZrf4cCDwPsiomeAOl8AdkTEjVXO4wvA9oi4qeoFtey4C8hsBEm6kNJvOF810MY/uZ79zy1Uaitwcw3jW4Z8BGBmlikfAZiZZcoBYGaWKQeAmVmmHABmZplyAJiZZcoBYGaWqf8PNg4rX0w+w78AAAAASUVORK5CYII=\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "spectrum.plot(high=10000)\n", + "plt.xlabel('Frequency (Hz)');" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can convert the filtered spectrum back to a wave:" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [], + "source": [ + "filtered = spectrum.make_wave()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now we can listen to the original segment and the filtered version." + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "segment.make_audio()" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "filtered.make_audio()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The original sounds more complex, with some high-frequency components that sound buzzy.\n", + "\n", + "The filtered version sounds more like a pure tone, with a more muffled quality.\n", + "\n", + "The cutoff frequency I chose, 3000 Hz, is similar to the quality of a telephone line, so this example simulates the sound of a violin recording played over a telephone." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Interaction\n", + "\n", + "The following shows the same example using interactive IPython widgets." + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [], + "source": [ + "def filter_wave(wave, start, duration, cutoff):\n", + " \"\"\"Selects a segment from the wave and filters it.\n", + " \n", + " Plots the spectrum and displays an Audio widget.\n", + " \n", + " wave: Wave object\n", + " start: time in s\n", + " duration: time in s\n", + " cutoff: frequency in Hz\n", + " \"\"\"\n", + " segment = wave.segment(start, duration)\n", + " spectrum = segment.make_spectrum()\n", + "\n", + " spectrum.plot(color='0.7')\n", + " spectrum.low_pass(cutoff)\n", + " spectrum.plot()\n", + " plt.xlabel('Frequency (Hz)');\n", + " plt.show()\n", + " \n", + " audio = spectrum.make_wave().make_audio()\n", + " display(audio)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Adjust the sliders to control the start and duration of the segment and the cutoff frequency applied to the spectrum." + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "6953777e7d844c6c835865f48b0f2b59", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "interactive(children=(FloatSlider(value=2.0, description='start', max=5.0), FloatSlider(value=2.0, description…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from ipywidgets import interact, fixed\n", + "from IPython.display import display\n", + "\n", + "wave = thinkdsp.read_wave('92002__jcveliz__violin-origional.wav')\n", + "interact(filter_wave, wave=fixed(wave), \n", + " start=(0, 5, 0.1), duration=(0, 5, 0.1), cutoff=(0, 10000, 100));" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.7" + } + }, + "nbformat": 4, + "nbformat_minor": 1 +}