I've inputted artifically made music with 120 bpm into:
y, sr = librosa.load(sys.argv[1])
tempo, beats = librosa.beat.beat_track(y,sr)
print("Tempo 1:", tempo)
first_beat_time, last_beat_time = librosa.frames_to_time((beats[0],beats[-1]),sr=sr)
print("Tempo 2:", 60/((last_beat_time-first_beat_time)/(len(beats)-1)))
With the output:
Tempo 1: 117.45383522727273
Tempo 2: 120.03683283914009
Shouldn't those numbers be the same, and almost equal to 120?