Ismir2012: Software Session Plan

Length and plan

  • 90 min (75 + 15m interval)

Software Requirements

  • Python
  • Numpy
  • Matplotlib
  • Nose and Nosetests
  • ipython (desirable, not mandatory)



  • Clone/Check if repository was successfully cloned
  • Explore folder and files
  • Launch python shell (ipyhon)
  • import and plot samples
  • Explain what the test files are and introduction to nose
  • Create (main programme)
    import tempo_estimator as est
    import sys
    filename = sys.argv[1]
    tempo = est.estimate_tempo_of_file(filename)
  • Easy Mercurial:
    • ignore pyc and py~
    • commit
    • commit .hgignore
  • Create
  • Create test file
    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
  • Commit both files
  • Start writing the code of
    • Slide: how to detect tempo?
    • Slide: how our estimator will work
  • Write the onset detection function and autocorrelation function calls in
  • Commit
  • Python Shell:
    • import the audiofile module
    • load the audiofile
      import audiofile as af
      (samples, samplerate) = af.read_all_read_all_mono_samples_from_file('test files/beatbox.wav')
  • split the file into non overlapping blocks and calculate the RMS of each
  • Hot to calculate the RMS?
  • Create and
    • Slide: how our estimator will work
  • ipython: write rms function
    import numpy as np 
    def rms(array):
        return np.sqrt(np.mean(samples**2))
  • write RMS tests
  • paste RMS function to
  • nosetests
  • in ipython again
    • how many frames (non overlapping) does the signal have?
      • don't forget to mention tghat ceil returns a float
    • what are the contents of the first frame?
    • what are the contents of the second frame?
    • Generalising....
    • def get_frame_count(n_samples, increment)
    • def get_frame(samples, increment, n)
    • write tests for both functions
    • ipython: protoype both functions, write them, test them
  • implement detection function on
  • implement tests
  • Autocorrelation+ testing
  • plot waveform and detection function
    • time scales are wrong
  • create just as a simple plotting script
  • in create bpm_to_lag and lag_to_bpm functions
  • add to tempo estimator definition bpm_min and bpm_max arguments