Is there a way using Python to track the beat intervals of an instrument in a song? For example... 1+ 3+4. I have tried the following code...
y, sr = librosa.load("Audio\sweetchild_guitar_intro.wav")
onset_envelope = librosa.onset.onset_strength(y, sr)
onsets = librosa.onset.onset_detect(onset_envelope=onset_envelope)
tempo, beats = librosa.beat.beat_track(onset_envelope=onset_envelope)
beat_times = librosa.frames_to_time(beats)
print(f"{tempo}\n{beats}\n{beat_times}")
print(len(beat_times))
However, the variable 'beat_times' prints 24, where the total number of notes/onsets in my audio file is 47, so I'm not exactly sure on what this figure is giving me. I have also experimented with the other variables in this code, but have not found anything.
Any and all help is much appreciated! Thanks
Edit
So I have found the meaning of the following variables...
tempo -> This is the bpm value
beat_times -> This is when a beat occurs relative to the onset_envelope values
len(beat_times) -> How many times a beat occurs.
However, I still cannot find how to get the interval timing of the notes?