Simplest analog circuit to compare two song signals

analog

I am trying to build a simple analog circuit that compares how similar two song signals are. One signal is the song sung by me, for example, and the other signal is the reference song signal. Since simplicity is very much wanted, I do not expect it to be very accurate or "formal". As long as it can give me a rough measurement how close the song sung by me is to the reference song , I am perfectly happy.

At first, I thought about making an analog circuit doing Fourier transform/series and then comparing how far the two signals' frequency components fall, but the responses suggest that it would not be easy. So I am open to any ideas/implementations now!

The components available are opamp, diode, resistor, capacity, MOSFET, BJT, NAND gate, NOR, gate, D-flipflop, and counter.

Best Answer

Cross-correlation is a measure of similarity of two signals. The Fourier transform uses this property to Transform signals versus orthogonal (Sine and Cosine) reference frequencies, expressing the Fourier transform as a linear combination of Sines and Cosines.

Therefore you could simply use a correlation circuit whose inputs are i) the signal of interest; ii) Cosine of varying frequency. Repeat for Sine (ideally in parallel). Then you have measurement of correlation from which you can calculate the Magnitude and Angle as usual.

To see how it works, consider a signal containing the component cos(W1.t) and correlating it with the test signal cos(W1.t) ; i.e. the same frequency. As correlation is simply multiplying and integrating the product will be cos^2(W1.t) = 1/2 + cos(2W1.t). Assuming you test various frequencies across whole integer cycles, this will be the only component that integrates to a non-zero value (i.e. has a DC component). That's how the FT and DFT work.

I've found a very informative article on the link between the DFT and correlation, that really describes it very well.