Esempio n. 1
0
    def __test(infile):
        DATA    = load(infile)

        # Compute onset envelope using the same spectrogram
        onsets  = librosa.onset.onset_strength(y=None, sr=8000, S=DATA['D'], detrend=True)

        assert numpy.allclose(onsets, DATA['onsetenv'][0])

        pass
    def __test(infile):
        DATA    = load(infile)
        
        (bpm, beats) = librosa.beat.beat_track(y=None, sr=8000, hop_length=32,
                                               onsets=DATA['onsetenv'][0], n_fft=None)

        print beats
        print DATA['beats']
        assert numpy.allclose(librosa.frames_to_time(beats, sr=8000, hop_length=32), DATA['beats'])
        pass
Esempio n. 3
0
    def __test(infile):
        DATA = load(infile)

        # Estimate tempo from the given onset envelope
        tempo = librosa.beat.estimate_tempo(
            DATA['onsetenv'][0], sr=8000, hop_length=32, start_bpm=120.0)

        assert (numpy.allclose(tempo, DATA['t'][0, 0])
                or numpy.allclose(tempo, DATA['t'][0, 1]))
        pass
Esempio n. 4
0
    def __test(infile):
        DATA = load(infile)

        # Estimate tempo from the given onset envelope
        tempo = librosa.beat.estimate_tempo(DATA['onsetenv'][0],
                                            sr=8000,
                                            hop_length=32,
                                            start_bpm=120.0)

        assert (np.allclose(tempo, DATA['t'][0, 0])
                or np.allclose(tempo, DATA['t'][0, 1]))
    def __test(infile):
        DATA    = load(infile)

        # Estimate tempo from the given onset envelope
        tempo   = librosa.beat.onset_estimate_bpm(  DATA['onsetenv'][0], 
                                                    120.0,  # starting bpm
                                                    8000 / 32)

        assert  (numpy.allclose(tempo, DATA['t'][0,0]) or 
                 numpy.allclose(tempo, DATA['t'][0,1]))
        pass
Esempio n. 6
0
    def __test(infile):

        DATA = load(infile)

        (bpm,
         beats) = librosa.beat.beat_track(y=None,
                                          sr=8000,
                                          hop_length=32,
                                          onset_envelope=DATA['onsetenv'][0])

        beat_times = librosa.frames_to_time(beats, sr=8000, hop_length=32)
        assert np.allclose(beat_times, DATA['beats'])
Esempio n. 7
0
    def __test(infile):
        DATA = load(infile)

        # Compute onset envelope using the same spectrogram
        onsets = librosa.onset.onset_strength(y=None,
                                              sr=8000,
                                              S=DATA['D'],
                                              centering=False,
                                              detrend=True)

        assert np.allclose(onsets[1:], DATA['onsetenv'][0])

        pass
Esempio n. 8
0
    def __test(infile):
        DATA = load(infile)

        (bpm, beats) = librosa.beat.beat_track(y=None,
                                               sr=8000,
                                               hop_length=32,
                                               onsets=DATA['onsetenv'][0])

        beat_times = librosa.frames_to_time(beats, sr=8000, hop_length=32)
        print beat_times
        print DATA['beats']
        assert numpy.allclose(beat_times, DATA['beats'])
        pass