Commit 1ade5844 authored by Steve Tjoa's avatar Steve Tjoa

added to python basics; better examples

parent addee401
{
"metadata": {
"name": "",
"signature": "sha256:2caacd935522d3b867f16fafea2ffcae60ea4ade99332c5924acfeca2c1a3842"
"signature": "sha256:1a018ef17cad8a8291d51d7d4b3db87b14bb2df5336075a60098d7f63a0c8df3"
},
"nbformat": 3,
"nbformat_minor": 0,
......@@ -18,7 +18,7 @@
},
{
"cell_type": "heading",
"level": 2,
"level": 1,
"metadata": {},
"source": [
"Table of Contents"
......@@ -26,7 +26,7 @@
},
{
"cell_type": "heading",
"level": 3,
"level": 2,
"metadata": {},
"source": [
"Introduction"
......@@ -36,60 +36,50 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"- [About This Workshop](notebooks/about_this_workshop.ipynb)\n",
"- [Getting Good at IPython](notebooks/get_good_at_ipython.ipynb)\n",
"- [Using Audio in IPython](notebooks/ipython_audio.ipynb)\n",
"- [Python Basics](notebooks/python_basics.ipynb)\n",
"- [NumPy, SciPy, Matplotlib Basics](notebooks/numpy_basics.ipynb)"
"1. [About This Workshop](notebooks/about_this_workshop.ipynb)\n",
"1. [Getting Good at IPython](notebooks/get_good_at_ipython.ipynb)\n",
"1. [Using Audio in IPython](notebooks/ipython_audio.ipynb)\n",
"1. [Python Basics](notebooks/python_basics.ipynb)\n",
"1. [NumPy, SciPy, Matplotlib Basics](notebooks/numpy_basics.ipynb)"
]
},
{
"cell_type": "heading",
"level": 3,
"level": 2,
"metadata": {},
"source": [
"Day 1"
"MIR Basics"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1. [Onset Detection](notebooks/onset_detection.ipynb)\n",
"1. [Segmentation](notebooks/segmentation.ipynb)\n",
"1. [Feature Extraction](notebooks/feature_extraction.ipynb)\n",
"1. [Spectral Features](notebooks/spectral_features.ipynb)\n",
"1. [K-Nearest Neighbor](notebooks/knn.ipynb)"
"1. [Onset Detection](notebooks/onset_detection.ipynb)\n",
"1. [K-Nearest Neighbor](notebooks/knn.ipynb)\n",
"1. [Mel-Frequency Ceptral Coefficients](notebooks/mfcc.ipynb)\n",
"1. [Cross Validation](notebooks/cross_validation.ipynb)\n",
"1. [Unsupervised Classification]()\n",
"1. [Nonnegative Matrix Factorization](notebooks/nmf.ipynb)\n",
"1. [Source Separation]()"
]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Other Topics"
]
},
{
"cell_type": "markdown",
"level": 2,
"metadata": {},
"source": [
"1. [Segmentation](notebooks/)\n",
"\n",
"1. [Mel-Frequency Ceptral Coefficients](notebooks/mfcc.ipynb)\n",
"\n",
"1. [Cross Validation](notebooks/cross_validation.ipynb)"
"Exercises"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1. [Unsupervised Classification]()\n",
"\n",
"1. [Nonnegative Matrix Factorization](notebooks/nmf.ipynb)\n",
"\n",
"1. [Source Separation]()\n"
"1. [Sonification](notebooks/sonification.ipynb)"
]
}
],
......
{
"metadata": {
"name": "",
"signature": "sha256:03ae82ae6c48d75b1328b0241d799d3bbddf4e9de1470710c2c7346414a3e6ba"
"signature": "sha256:43a13ceb38a9caf31a84fb8d9855ad2161713795774983d6f6d7e74fbd66c727"
},
"nbformat": 3,
"nbformat_minor": 0,
......@@ -158,10 +158,52 @@
],
"prompt_number": 16
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Centroid"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"input": [
"from essentia.standard import Centroid, Spectrum, Windowing, FrameGenerator\n",
"hamming_window = Windowing(type='hamming')\n",
"spectrum = Spectrum() # we just want the magnitude spectrum\n",
"centroid = Centroid(range=22050)\n",
"\n",
"energy = array([centroid(spectrum(hamming_window(frame)))\n",
" for frame in FrameGenerator(x, frameSize=2048, hopSize=1024)])\n",
"\n",
"plot(energy)\n",
"ylabel('MFCC Coefficient Index')\n",
"xlabel('Frame Index')"
],
"language": "python",
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'x' is not defined",
"output_type": "pyerr",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"\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"
]
}
],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"k"
],
"language": "python",
"metadata": {},
"outputs": []
......
{
"metadata": {
"name": "",
"signature": "sha256:52462b1d6020898bd104b0df2dee0679f90aa47a461d159d5e6c822a8020d7a4"
"signature": "sha256:0d9b8beade1a15c593193c13022afe6b01496f2e301388ec350e9680be209e28"
},
"nbformat": 3,
"nbformat_minor": 0,
......@@ -16,6 +16,34 @@
"NumPy, SciPy, and Matplotlib"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"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."
]
},
{
"cell_type": "heading",
"level": 2,
......
This diff is collapsed.
{
"metadata": {
"name": "",
"signature": "sha256:4ced2ceb7a935191f56f4225788885407a0fa2d45199d124306c06f71cf0a75b"
"signature": "sha256:f537fdc0dbf8d83f3394951c8baa336475d54276fd9dcd98866b405a221d79be"
},
"nbformat": 3,
"nbformat_minor": 0,
......@@ -17,12 +17,44 @@
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Why Python?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"outputs": []
"source": [
"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."
]
}
],
"metadata": {}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment