I have been working on a problem where I am given two songs which are of the same category but there is a time difference between them. Eg. one song starts at x sec and other song starts at y sec. So my task is to find the x and y.
The length of the two songs can vary but the content of the two songs will remain the same.
Currently I am using cross-correlation using FFT for finding the offset between them but it is not giving me correct results.
For making the length of signals same I am zero padding the signal which is shorter in length.
Can someone guide me what I am doing wrong in this problem ?
I really appreciate your responses. Thanks
--
Thanks guys for replying..
I am doing in Python and using below algorithm for finding the offset:
1. Using librosa.load function to get the audio signals of both the songs.
2. Then I zero pad the shorter signal from last and make sure it is power of 2.
3. Find the FFT of the two signals using scipy library function of python.(spipy.fftpack.fft)
4. Once I get the fft , I take the cojugate of one of the signals.
5. Elementwise multiplication of the two fft signals
6. Doing ifft of the numpy array of the output signals after multiplication.
7. Finding the peak index of that array.
P.S. The song length can be around 5-6 mins so I am sampling at the rate of 44.1Khz . So you can expect very large sample space. Also , the bitrate of the two songs can be different.(I am not sure that will effect it or not)
Any idea if I am doing wrong?
thanks