def runProgression(self, progression, streaming=True):
        nChords = len(progression)
        chordsProgressionReal = self.stringToRealProgression(progression)
        changeChordTime = 1.0
        dur = nChords * changeChordTime
        sampleRate = 44100
        hopSize = 2048
        nFrames = int(dur * sampleRate / hopSize) - 1
        frameRate = float(sampleRate) / float(hopSize)
        nextChange = frameRate * changeChordTime
        # compute expected Chords and the input pcp for the chordsdetection
        # algorithm:
        pcp = zeros([nFrames, 12])
        expectedChords = []
        j = 0
        for i in range(nFrames):
            if i == int(nextChange):
                j += 1
                nextChange += frameRate * changeChordTime
            expectedChords.append(progression[j % nChords])
            pcp[i] = chordsProgressionReal[j % nChords]

        pool = Pool()

        if streaming:
            gen = VectorInput(pcp)
            chordsDetection = ChordsDetection(windowSize=2.0, hopSize=hopSize)

            gen.data >> chordsDetection.pcp
            chordsDetection.chords >> (pool, 'chords.progression')
            chordsDetection.strength >> (pool, 'chords.strength')
            run(gen)

        else:
            from essentia.standard import ChordsDetection as stdChordsDetection
            chordsDetection = stdChordsDetection(windowSize=2.0,
                                                 hopSize=hopSize)
            chords, strength = chordsDetection(pcp)
            for i in xrange(len(chords)):
                pool.add('chords.progression', chords[i])
                pool.add('chords.strength', float(strength[i]))

        # as sometimes the algorithm gets confused at the transition from one chord to the other,
        # the test will be restricted to not having more errors than transitions

        failure = 0
        for i in range(nFrames):
            if pool['chords.progression'][i] != expectedChords[i]: failure += 1
            self.assertValidNumber(pool['chords.strength'][i])
            self.assertTrue(pool['chords.strength'][i] > 0)

        self.assertTrue(failure <= nChords)
    def runProgression(self, progression, streaming=True):
        nChords = len(progression)
        chordsProgressionReal = self.stringToRealProgression(progression)
        changeChordTime = 1.0
        dur = nChords*changeChordTime
        sampleRate = 44100
        hopSize = 2048
        nFrames = int(dur*sampleRate/hopSize) - 1
        frameRate = float(sampleRate)/float(hopSize)
        nextChange = frameRate*changeChordTime
        # compute expected Chords and the input pcp for the chordsdetection
        # algorithm:
        pcp = zeros([nFrames,12])
        expectedChords =[]
        j = 0
        for i in range(nFrames):
            if i == int(nextChange):
                j+=1
                nextChange += frameRate*changeChordTime
            expectedChords.append(progression[j%nChords])
            pcp[i] = chordsProgressionReal[j%nChords]

        pool = Pool()

        if streaming:
            gen = VectorInput(pcp)
            chordsDetection = ChordsDetection(windowSize=2.0, hopSize = hopSize)

            gen.data >> chordsDetection.pcp
            chordsDetection.chords >> (pool, 'chords.progression')
            chordsDetection.strength >> (pool, 'chords.strength')
            run(gen)

        else:
            from essentia.standard import ChordsDetection as stdChordsDetection
            chordsDetection = stdChordsDetection(windowSize=2.0, hopSize = hopSize)
            chords, strength = chordsDetection(pcp)
            for i in xrange(len(chords)):
                pool.add('chords.progression', chords[i])
                pool.add('chords.strength', float(strength[i]))


        # as sometimes the algorithm gets confused at the transition from one chord to the other,
        # the test will be restricted to not having more errors than transitions

        failure = 0
        for i in range(nFrames):
            if pool['chords.progression'][i] != expectedChords[i]: failure+=1
            self.assertValidNumber(pool['chords.strength'][i])
            self.assertTrue(pool['chords.strength'][i] > 0)

        self.assertTrue(failure <= nChords)