Ismir2012SoftwareSessionPlan » History » Version 7
Version 6 (Luis Figueira, 2012-10-03 01:31 PM) → Version 7/12 (Luis Figueira, 2012-10-03 01:43 PM)
h1. Ismir2012: Software Session Plan
h2. Length and plan
* 90 min (75 + 15m interval)
h2. Software Requirements
* Python
* Numpy
* Matplotlib
* Nose and Nosetests
* ipython (desirable, not mandatory)
h2. Repository
https://code.soundsoftware.ac.uk/hg/python-tutorial-skeleton
h2. Script
* Clone/Check if repository was successfully cloned
* Explore folder and files
* Launch python shell (ipyhon)
* import audiofile.py and plot samples
* Explain what the test files are and introduction to nose
* Create estimate_tempo.py (main programme)
<pre>
import tempo_estimator as est
import sys
filename = sys.argv[1]
tempo = est.estimate_tempo_of_file(filename)
</pre>
* Easy Mercurial:
** ignore pyc and py~
** commit estimate_tempo.py
** commit .hgignore
* Create estimate_tempo.py
* Create test file test_estimate_tempo.py
<pre>
import estimate_tempo as est
def test_tempo_120bpm():
tempo = est.estimate_tempo_of_file("test files/120bpm.wav")
# we consider the test to be passed if error is less than 1/4 of bpm
error = abs(tempo - 120) < 0.25
assert
</pre>
* Commit both files
* Start writing the code of tempo_estimator.py
<pre>
</pre>
* Slide: how to detect tempo?
* Write the onset detection function Create detection_function.py and autocorrelation function calls in tempo_estimator.py test_detection_function.py
<pre></pre>
* Commit
* Python Shell:
** import the audiofile module
** load the audiofile
<pre>
import audiofile as af
(samples, samplerate) = af.read_all_read_all_mono_samples_from_file('test files/beatbox.wav')
</pre>
** split the file into non overlapping blocks and calculate the RMS of each
** Hot to calculate the RMS?
<pre>
import numpy as np
def rms(array):
return sqrt(np.mean(samples**2))
</pre>
** test rms function working
** paste it to tempo_estimator.py and build a couple of tests
h2. Length and plan
* 90 min (75 + 15m interval)
h2. Software Requirements
* Python
* Numpy
* Matplotlib
* Nose and Nosetests
* ipython (desirable, not mandatory)
h2. Repository
https://code.soundsoftware.ac.uk/hg/python-tutorial-skeleton
h2. Script
* Clone/Check if repository was successfully cloned
* Explore folder and files
* Launch python shell (ipyhon)
* import audiofile.py and plot samples
* Explain what the test files are and introduction to nose
* Create estimate_tempo.py (main programme)
<pre>
import tempo_estimator as est
import sys
filename = sys.argv[1]
tempo = est.estimate_tempo_of_file(filename)
</pre>
* Easy Mercurial:
** ignore pyc and py~
** commit estimate_tempo.py
** commit .hgignore
* Create estimate_tempo.py
* Create test file test_estimate_tempo.py
<pre>
import estimate_tempo as est
def test_tempo_120bpm():
tempo = est.estimate_tempo_of_file("test files/120bpm.wav")
# we consider the test to be passed if error is less than 1/4 of bpm
error = abs(tempo - 120) < 0.25
assert
</pre>
* Commit both files
* Start writing the code of tempo_estimator.py
<pre>
</pre>
* Slide: how to detect tempo?
* Write the onset detection function Create detection_function.py and autocorrelation function calls in tempo_estimator.py test_detection_function.py
<pre></pre>
* Commit
* Python Shell:
** import the audiofile module
** load the audiofile
<pre>
import audiofile as af
(samples, samplerate) = af.read_all_read_all_mono_samples_from_file('test files/beatbox.wav')
</pre>
** split the file into non overlapping blocks and calculate the RMS of each
** Hot to calculate the RMS?
<pre>
import numpy as np
def rms(array):
return sqrt(np.mean(samples**2))
</pre>
** test rms function working
** paste it to tempo_estimator.py and build a couple of tests