synchronizing two music tracks
well, it depends on how similar the audio signal from the two tracks are.  i dunno if the two tracks are identical, to within some degree of error or noise, and to within some degree of time alignment, but  somehow, in a manner that is salient to your model or to your problem, you have to have a measure of something in the two signals to align.

so let

$$ a_x(t) = f\left\{ x(t) \right\} $$

$$ a_y(t) = f\left\{ y(t) \right\} $$

be that something that defines what it is you're trying to synchronize.   so you want to find a delay offset $\tau$, that maximizes the cross-correlation between $a_x(t)$ and $a_y(t)$

$$ R_{xy}(\tau) = \int_{-\infty}^{+\infty} a_x\left(t+\frac{\tau}{2}\right) a_y\left(t-\frac{\tau}{2}\right) w(t) \ dt $$

with whatever window function $w(t) \ge 0$ you like best.  find the $\tau$ that maximizes $R_{xy}(\tau)$ 

so i'm not telling you how to do this using discrete-time code.  you get to figure that out.