get amplitude difference via cross correlation?

im currently comparing 2 signals:

A = some music
B = A + noise

and ive implemented cross correlation in frequency domain via complex multiplication to determine the time offset, which works perfectly so far.

Now what i need in addition to the time offset is the amplitude offset, means a faktor by which A should be scaled to match the amplitude of A contained in B.

Ive been given advice to do this i have to multiply my A by the cross-correlation peak but heres my problem: my peak is NOT as expected between -1 and 1 but much higher (e.g. ~300). (even though it shows the time offset perfectly)

So here are my questions: am i missing some normalization of my CC values? what exactly is the difference between normalized CC and "normal" CC. what is the best way to get the amplitude factor?

Thanks!

-

You divide the peak of the correlation by the energy of $A$.
$B$ is a scaled version of $A$, with some noise added to it. Thus, the equation for the cross-correlation peak is-
$A * B' = A * (kA' + n') = k(A*A') + A*n'$
Let's ignore the noise term since we cannot predict its value. The remaining term, $k(A*A')$, is the energy of $A$ times the scaling factor. Thus, you simply need to divide the correlation peak by the energy of $A$ (which you know), and you have the scaling factor. The noise term will introduce some error into the result, but there isn't really anything you can do about that other than reducing the noise or increasing the signal power in $B$.
An example- if $A$ is [1 2 1], then the energy is $1^2 + 2^2 + 1^2 = 6$. If $B$ is twice $A$ ([2 4 2], then the cross correlation peak would occur when they were lined up, which would give us $1*2 + 2*4 + 1*2 = 12$. Dividing the peak (12), by the energy of $A$ (6), gives a factor of 2, which is the correct result.