import numpy as np
import IPython.display as ipd
from versionid import *
y1, sr = load_wavfile("covers80_audio/Addicted_To_Love/robert_palmer+Riptide+03-Addicted_To_Love.wav")
y2, sr = load_wavfile("covers80_audio/Addicted_To_Love/tina_turner+Tina_Live_In_Europe_CD_1_+09-Addicted_To_Love.wav")
ipd.Audio(y1[sr*150:sr*165], rate=sr)
ipd.Audio(y2[sr*130:sr*145], rate=sr)
downsample_fac = 40
hop_length = 256
C1 = librosa.feature.chroma_cqt(y=y1, sr=sr, hop_length=hop_length)
C1 = librosa.util.sync(C1, np.arange(0, C1.shape[1], downsample_fac), aggregate=np.median)
C2 = librosa.feature.chroma_cqt(y=y2, sr=sr, hop_length=hop_length)
C2 = librosa.util.sync(C2, np.arange(0, C2.shape[1], downsample_fac), aggregate=np.median)
get_oti(C1, C2, do_plot=True)