import sys
from essentia.standard import *
from essentia import Pool

try:
    input_file = sys.argv[1]
except:
    print "usage:", sys.argv[0], "<input_file>"
    sys.exit()

sampleRate   = 22050
frameSize    = 8192
hopSize      = 1024
rmsFrameSize = 256
rmsHopSize   = 32


loader = MonoLoader(filename=input_file, sampleRate=sampleRate)
w = Windowing(type='blackmanharris62')
spectrum = Spectrum()
melbands = MelBands(sampleRate=sampleRate, numberBands=40, lowFrequencyBound=0, highFrequencyBound=sampleRate/2)

pool = Pool()

for frame in FrameGenerator(audio=loader(), frameSize=frameSize, hopSize=hopSize, startFromZero=True):
    bands = melbands(spectrum(w(frame)))
    pool.add('melbands', bands)



print len(pool['melbands']), "Mel band frames"
print len(pool['melbands']) / 32, "Rhythm transform frames"


rhythmtransform = RhythmTransform(frameSize=rmsFrameSize, hopSize=rmsHopSize)
rt = rhythmtransform(pool['melbands'])

import matplotlib.pyplot as plt
plt.imshow(rt.T[:,:], aspect = 'auto')
plt.xlabel('Frames')
plt.ylabel('Rhythm Transform coefficients')
plt.show()



@@ -169,16 +169,634 @@
 exit()%0A%0A
+%0A%22%22%22%0AExplanation of Rhythm Transform: %0A- Mel bands are computed on frames of the size 8192 with the frames sample rate = sampleRate/hopSize = 22050/1024 = 21.5Hz%0A- Rhythm transform frame size is equal to 256 Mel bands frames%0A- Output vector is of size 256/2 + 1 = 129.%0A- Therefore it represents periodicities over the interval 0Hz (0th bin) to 22050/1024/2 = 10.75Hz (129th bin),%0A- Converting to BPM values this corresponds to an interval from 0 BPM to 22050/1024/2 * 60 = 646 BPM%0A- Each bin roughly covers 5 BPM%0A- 60-200 BPM interval is covered by only 40-12 = 28 bins%0A- 120 BPM rougphly corresponds to bin #24%0A%22%22%22%0A%0A%0A
 sampleRa

Add comments explaining rhythm transform to python example