CH_XCORR Calculate cross-correlograms with a wide range of options.
CCG = CH_XCORR(HC_L,HC_R,FRAME_LENGTH,NOVERLAP,MAXLAG,TAU)
CCG = CH_XCORR(...,INHIB)
CCG = CH_XCORR(...,IC_T,NORM_FLAG)
CCG = CH_XCORR(...,INHIB_MODE)
[CCG,IC] = CH_XCORR(...)
CCG = CH_XCORR(HC_L,HC_R,FRAME_COUNT,FRAME_LENGTH,MAXLAG,TAU) calculates cross-correlograms with a range of cross-correlation parameters.
The function cross-correlates the input 2-D matrices HC_L and HC_R over frames of length FRAME_LENGTH. It is assumed that the number of frequency channels is min(size(HC_L)) and hence HC_L and HC_R can be in either orientation. The cross-correlograms consist of cross-correlations for every frame and frequency channel. The function calculates running cross-correlations for every sample and integrates these cross-correlations over NOVERLAP frames. The lags are determined by MAXLAG and the cross-correlation is computed over the range of lags -MAXLAG to MAXLAG, i.e., 2*MAXLAG+1 lags. The number of frames FRAME_COUNT is calculated thus:
FRAME_COUNT = floor((max(size(HC_L))-MAXLAG-1)/(FRAME_LENGTH))-NOVERLAP+1;
The underlying cross-correlation algorithm is based on that proposed by Faller & Merimaa . In this implmentation, the time constant of the backward infinite exponential window is given by TAU (in samples).
CCG = CH_XCORR(...,INHIB) multiplies the running cross-correlations with INHIB before the cross-correlations are averaged. If INHIB is un-specified it is set to ones(size(HC_L)).
CCG = CH_XCORR(...,IC_T,NORM_FLAG) allows an IC threshold to be specified and normalisation to be turned on and off. The algorithm calculates Interaural Coherence (IC) according to . The cross-correlogram is calculated for each frame by averaging only those cross-correlations within the frame for which the corresponding IC exceeds the IC threshold IC_T (0<=IC_T<=1). Setting this value to 0 will result in all cross-correlations contributing to the average (default). This implementation also permits the normalisation to be turned off by specifying NORM_FLAG; a non-zero value means normalisation will be applied (default). This means, for example, that an IC theshold could be employed, but the un-normalised cross-correlations would contribute to the cross-correlograms. Note that either both or neither of these values must be specified.
CCG = CH_XCORR(...,INHIB_MODE) uses the mode INHIB_MODE to apply the inhibition. The options are 'multiply' (default), whereby the inhibitory signal INHIB will be multiplied with the running cross-correlation, or 'subtract', whereby INHIB will be subtracted from the running cross-correlation.
[CCG,IC] = CH_XCORR(...) returns the calculated IC to the matrix IC. Although the matrix returned is the same size as HC_L, IC is only calculated for samples 1:FRAME_COUNT*FRAME_LENGTH, other values will
be set to 0.
See the enclosed documentation for more details on the workings of the algorithm and an important caveat.
 C. Faller and J. Merimaa, "Source localization in complex listening situations: Selection of binaural cues based on interaural coherence", The Journal of the Acoustical Society of America, vol. 116, pp.3075-3089, Nov. 2004.
C. Hummersone, R. Mason, and T. Brookes, "A comparison of computational precedence models for source separation in reverberant environments", in 128th Audio Engineering Society Convention, London, May 2010, paper 7981.