import numpy as np
import IPython.display as ipd
from versionid import *
y1, sr = load_wavfile("covers80_audio/Toys_In_The_Attic/aerosmith+Toys_In_The_Attic+01-Toys_In_The_Attic.wav")
y2, sr = load_wavfile("covers80_audio/Toys_In_The_Attic/rem+Dead_Letter_Office+07-Toys_In_The_Attic.wav")
ipd.Audio(y1[sr*52:sr*74], rate=sr)
ipd.Audio(y2[sr*39:sr*60], 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)