android - GCC_PHAT output -
i trying develop gcc_phat algorithm on android devices. fft used this library. idea correlate 2 audio files (16-bit pcm mono) find delay between them. matlab works perfectly. first problem fft output, gives numbers higher 32768
. example:
fft re -20830.895138576154 fft re -30639.569794501647 fft re -49850.48597621472 fft re -49335.28275604235 fft re -96060.94916529073 fft re -91409.17426504416 fft re -226903.051428709
is there way normalize these numbers interval of [-1,1]?
the library's forward transform definition match matlab's, should matching values after forward transform (not critical since g_phat normalized [-1,1]).
however, same cannot said of inverse transform. indeed code comments on inversetransform
:
this transform not perform scaling, inverse not true inverse.
and library webpage:
this fft not perform scaling. vector of length n, after performing transform , inverse transform on it, result original vector multiplied n (plus approximation errors).
so, values matching matlab's fft/ifft implementation need divide result of ifft n.
Comments
Post a Comment