"\u001b[1;32m<ipython-input-1-1b09dbaf5c19>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 6\u001b[0m energy = array([centroid(spectrum(hamming_window(frame)))\n\u001b[1;32m----> 7\u001b[1;33m for frame in FrameGenerator(x, frameSize=2048, hopSize=1024)])\n\u001b[0m\u001b[0;32m 8\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 9\u001b[0m \u001b[0mplot\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0menergy\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;31mNameError\u001b[0m: name 'x' is not defined"
"The quartet of NumPy, SciPy, Matplotlib, and IPython is a popular combination in the Python world. We will use each of these libraries in this workshop."
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Tutorial"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[NumPy](http://www.numpy.org) is one of the most popular libraries for numerical computing in the world. It is used in several disciplines including image processing, finance, bioinformatics, and more. This entire workshop is based upon NumPy and its derivatives.\n",
"\n",
"If you are new to NumPy, follow this [NumPy Tutorial](http://wiki.scipy.org/Tentative_NumPy_Tutorial).\n",
"\n",
"[SciPy](http://docs.scipy.org/doc/scipy/reference/) is a Python library for scientific computing which builds on top of NumPy. If NumPy is like the Matlab core, then SciPy is like the Matlab toolboxes. It includes support for linear algebra, sparse matrices, spatial data structions, statistics, and more.\n",
"\n",
"While there is a [SciPy Tutorial](http://docs.scipy.org/doc/scipy/reference/tutorial/index.html), it isn't critical that you follow it for this workshop."
"Python is a general-purpose programming language that is popular and easy to use. For new programmers, it is a great choice as a first programming language. In fact, more and more university CS departments are centering their introductory courses around Python.\n",
"\n",
"For a summary of why I (SKT) moved from Matlab to Python, please read [this post](http://stevetjoa.com/305)."
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Tutorial"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If you are new to Python, please follow [The Python Tutorial](https://docs.python.org/2/tutorial/index.html).\n",
"\n",
"For the purposes of this workshop, be sure you understand the following sections:\n",
"\n",
"- Section 3: An Informal Introduction to Python\n",
"- Section 4: More Control Flow Tools\n",
"- Section 5: Data Structures\n",
"\n",
"While the other sections are useful, you can learn them along the way."
"For this workshop, we will use [`essentia.standard.FrameGenerator`](http://essentia.upf.edu/documentation/reference/std_FrameGenerator.html) to segment our audio signal.\n",
"For this workshop, we will use [`essentia.standard.FrameGenerator`](http://essentia.upf.edu/documentation/reference/std_FrameGenerator.html) to segment our audio signal.\n",
"\n",
"\n",
"Let's create an audio sweep signal that is frequency modulated from 110 Hz to 880 Hz:"
"Let's create an audio sweep signal that is frequency modulated from 110 Hz to 880 Hz. Then, we will segment the signal and compute the **zero crossing rate** for each frame.\n",
"(There are easier ways to display a spectrogram, e.g. using Matplotlib or `librosa`. This example was just used to illustrate segmentation in Essentia.)"