Get from Ico-github-logo

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Precedence-based cross-correlograms

  • functionTemplate(input_args)
    FUNCTIONTEMPLATE Summary of this function goes on this H1 line
  • iosr.acoustics.irStats(fi...
    IRSTATS Calculate RT, DRR, Cte, and EDT for impulse response file
  • iosr.acoustics.rtEst(abs_...
    RTEST Estimate reverberation time based on room size and absorption
  • iosr.auditory.azimuth2itd...
    AZIMUTH2ITD Convert azimuth in degrees to ITD
  • iosr.auditory.binSearch(S...
    Conduct a binary search
  • iosr.auditory.calcIld(L,R...
    CALCILD Calculate normalised interaural level difference
  • iosr.auditory.chXcorr(hc_...
    CHXCORR Calculate cross-correlograms with a wide range of options.
  • iosr.auditory.chXcorr2(hc...
    CHXCORR2 Calculate cross-correlograms with a range of options.
  • iosr.auditory.createWindo...
    Create a Hann or exp. window with specified onsets/offsets
  • iosr.auditory.dupWeight(f)
    DUP_WEIGHT Calculate duplex weighting coefficients for ITD and ILD
  • iosr.auditory.erbRate2hz(x)
    ERBRATE2HZ Convert ERB rate to Hz.
  • iosr.auditory.freqMulti(f)
    FREQMULTI Calculate frequency coefficient for ITD-azimuth warping
  • iosr.auditory.gammatoneFa...
    GAMMATONEFAST Produce an array of responses from gammatone filters via FFT
  • iosr.auditory.hz2erbRate(x)
    HZ2ERBRATE Convert Hz to ERB rate
  • iosr.auditory.instItd(l,r...
    INSTITD Calculate instantaneous ITD
  • iosr.auditory.iso226(phon...
    ISO226 ISO 226:2003 Normal equal-loudness-level contours
  • iosr.auditory.itd2azimuth...
    ITD2AZIMUTH Convert ITD to azimuth
  • iosr.auditory.lindemannIn...
    LINDEMANNINH Signal pre-processing for Lindemann's cross-correlation
  • iosr.auditory.loudWeight(...
    LOUDWEIGHT Calculate loudness weighting coefficients based on ISO 226
  • iosr.auditory.makeErbCFs(...
    MAKEERBCFS Make a series of center frequencies equally spaced in ERB-rate.
  • iosr.auditory.meddisHairC...
    Calculate Ray Meddis' hair cell model for a number of channels.
  • iosr.auditory.perceptualC...
    PERCEPTUALCENTROID Perceptual spectral centroid
  • iosr.auditory.xcorrLindem...
    XCORRLINDEMANN Cross-correlation based on Lindemann's precedence model
  • iosr.bss.applyIdealMasks(...
    APPLYIDEALMASKS Calculate and apply ideal masks via STFT
  • iosr.bss.applyMask(s,m,nf...
    APPLYMASK Apply a time-frequency mask to an STFT
  • iosr.bss.calcImr(m,im)
    CALCIMR Calculates the Ideal Mask Ratio (IMR)
  • iosr.bss.calcSnr(output,t...
    CALCSNR Calculate the separation SNR
  • iosr.bss.cfs2fcs(cfs,fs)
    CFS2FCS Calculate gammatone crossover frequencies.
  • iosr.bss.generateMixtures...
    GENERATEMIXTURES Generate arrays of mixtures from targets and interferers.
  • iosr.bss.getFullMask(m,fr...
    GETFULLMASK Convert frame rate mask to a sample-by-sample mask
  • iosr.bss.idealMasks(st,si...
    IDEALMASKS Calculate ideal time-frequency masks from STFTs
  • iosr.bss.resynthesise(x,f...
    RESYNTHESISE Resynthesise a target from a time-frequency mask
  • iosr.dsp.autocorr(x,Q,dim)
    AUTOCORR Perform autocorrelation via FFT
  • iosr.dsp.convFft(a,b,shape)
    CONVFFT Convolve two vectors using FFT multiplication
  • iosr.dsp.istft(s,nfft,hop...
    ISTFT Calculate the Inverse Short-Time Fourier Transform
  • iosr.dsp.lapwin(L,b)
    LAPWIN Laplace window.
  • iosr.dsp.localpeaks(x,mode)
    LOCALPEAKS Find local peaks and troughs in a vector
  • iosr.dsp.ltas(x,fs,varargin)
    LTAS calculate the long-term average spectrum of a signal
  • iosr.dsp.matchEQ(x,fs,mag...
    MATCHEQ Match the LTAS of a signal to an arbitrary spectral magnitude
  • iosr.dsp.rcoswin(N)
    RCOSWIN Raised cosine window.
  • iosr.dsp.rms(x,dim)
    RMS Calculate the rms of a vector or matrix
  • iosr.dsp.sincFilter(x,Wn,...
    SINCFILTER Apply a near-ideal low-pass or band-pass brickwall filter
  • iosr.dsp.smoothSpectrum(X...
    SMOOTHSPECTRUM Apply 1/N-octave smoothing to a frequency spectrum
  • iosr.dsp.stft(x,nfft,hop,fs)
    STFT Calculate the short-time Fourier transform of a signal
  • iosr.dsp.vsmooth(x,frame,...
    VSMOOTH Smooth a vector using mathematical functions
  • iosr.figures.chMap(M)
    CHMAP Create a monochrome-compatible colour map
  • iosr.figures.cmrMap(M)
    CMRMAP Create a monochrome-compatible colour map
  • iosr.figures.multiwaveplo...
    MULTIWAVEPLOT Stacked line plots from a matrix or vectors
  • iosr.figures.subfigrid(nr...
    SUBFIGRID Create axis positions for subfigures
  • iosr.general.cell2csv(C,f...
    CELL2CSV Output a cell array to a CSV file
  • iosr.general.checkMexComp...
    CHECKMEXCOMPILED Check if mex file is compiled for system
  • iosr.general.getContents(...
    GETCONTENTS Get the contents of a specified directory
  • iosr.general.updateConten...
    UPDATECONTENTS Create a Contents.m file including subdirectories
  • iosr.general.urn(varargin)
    URN Generate random number sequence without duplicates
  • iosr.install
    INSTALL Set search paths, and download and install dependencies.
  • iosr.statistics.getRmse(X...
    GETRMSE Calculate the root-mean-square error between input data
  • iosr.statistics.laprnd(va...
    LAPRND Pseudorandom numbers drawn from the Laplace distribution
  • iosr.statistics.qqPlot(va...
    QQPLOT Quantile-quantile plot with patch option
  • iosr.statistics.quantile(...
    QUANTILE Quantiles of a sample via various methods.
  • iosr.statistics.tab2box(X...
    TAB2BOX Prepare tabular data for boxPlot function
  • iosr.statistics.trirnd(va...
    TRIRND Pseudorandom numbers drawn from the triangular distribution
  • iosr.svn.buildSvnProfile(...
    BUILDSVNPROFILE Read data from files tagged with SVN keywords
  • iosr.svn.headRev(folders,...
    HEADREV Retrieve the head revision for specified files
  • iosr.svn.readSvnKeyword(f...
    READSVNKEYWORD Read data from a file tagged with an SVN keyword
  • boxPlot.m
  • classTemplate
    CLASSTEMPLATE Summary of this class goes on this H1 line
  • iosr.bss.mixture
    MIXTURE Class of sound source separation mixture.
  • iosr.bss.source
    SOURCE Class of sound source separation source.
    AUDIO Abstract superclass providing audio-related properties and methods.
  • iosr.statistics.functiona...
    FUNCTIONALSPREADPLOT Draw a functional plot showing data spread
  • iosr.statistics.statsPlot
    STATSPLOT An abstract superclass for classes that plot statistics
  • example.m
    determine STFT parameters
  • Contents.m
  • View all files
Be the first to rate this file! 6 Downloads (last 30 days) File Size: 682 KB File ID: #27776 Version: 1.16

Precedence-based cross-correlograms



27 May 2010 (Updated )

Calculate cross-correlograms with a wide range of options

| Watch this File

File Information

NOTE: this function is now available from the IoSR Matlab Toolbox as iosr.auditory.chXcorr.
Calculate cross-correlograms with a wide range of options.
  ccg = ch_xcorr(hc_L,hc_R,fs)
  ccg = ch_xcorr(hc_L,hc_R,fs,'parameter',value)
  [ccg,ic] = ch_xcorr(...)

  ccg = ch_xcorr(hc_L,hc_R,fs) cross-correlates the input
  2-D matrices hc_L and hc_R over 10ms frame with a
  maximum lag of 1ms. 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. ccg has dimensions
  [lag,frequency,frame]. The function calculates running
  cross-correlations for every sample and integrates these
  cross-correlations over each frame. The number of
  frames frame_count is calculated thus:

  frame_count = ...

  The underlying cross-correlation algorithm is based on
  that proposed by Faller & Merimaa [1]. In this
  implmentation, the time constant of the backward
  infinite exponential window is given by tau (in
  ccg = ch_xcorr(hc_L,hc_R,fs,'parameter',value) allows a
  number of options to be specified. The options are:

  ({} indicates the default value)

  'frame_length' : {round(0.01*fs)} | scalar
      The length of frames used to calculate for
      integrating cross-correlations.
  'noverlap' : {1} | scalar
      The number of frames over which to integrate the
      cross-correlations. Note that the frame count is
      reduced accordingly.
  'maxlag' : {round(0.001*fs)} | scalar
      The maximum lag of the cross-correlation.
  'tau' : {round(0.01*fs)} | scalar
      The time constant of the exponential window used to
      calculate running cross-correlations.
  'inhib' : {[]} | array
      Specificies an array with which to multiply the
      cross-correlations before they are integrated. The
      value defaults to an empty array, meaning that no
      inhibition will be applied.
  'ic_t' : {0} | scalar
      Specifies the interaural coherence (IC) threshold.
      Only samples for which the IC exceeds this threshold
      will be used to integrate cross-correlations. The
      algorithm calculates Interaural Coherence (IC)
      according to [1]. The value should be in the range
  'norm_flag' : {0} | scalar
      Specifies whether the cross-correlograms are
      calculated using normalised cross-correlations. A
      non-zero value indicates that normalised
      cross-correlations are used.
  'inhib_mode' : {'subtract'} | 'multiply'
      Specify how the inhibition is applied. The default
      'subtract' will subtract inhib from the running
      cross-correlations; 'multiply' will multiply inhib
      with the running cross-correlations.

  [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


  See the enclosed documentation for more details on the
  workings of the algorithm and an important caveat.


  [1] 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.

  Further Reading
  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.

MATLAB release MATLAB 8.3 (R2014a)
Other requirements Requires a C compiler and the following function:
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
24 Oct 2010 Christopher Hummersone

whoops, you'll need this file:

Comment only
27 Jul 2010 1.1

Updated the mex function

06 Aug 2010 1.2

Fixed an issue with an un-specified max function. Thanks to Lars Bramsløw for pointing it out.

06 Aug 2010 1.3

Whoops, fixed another silly mistake, thanks to Lars Bramsløw

21 Oct 2010 1.4

Added additional 'NOVERLAP' parameter for integrating over several frames. Added note to documentation on limitations for normalised cross-correlation.

22 Oct 2010 1.5

Created additional documentation explaining the algorithm.

26 Oct 2010 1.7

Fixed a bug that gave negative numbers when using the 'subtract' option. Updated the documentation accordingly.

11 Nov 2010 1.8

removed need to framecount parameter input, now calculated automatically.

18 Apr 2011 1.9

Updated check for inhib matrix size and shape

16 Jun 2011 1.10

Updated documentation, added verbose comments through source code

04 Aug 2011 1.11

Added updated check_mex_compiled.m

17 Aug 2011 1.12

Fixed a bug whereby output IC would not be the same size as the input data. Added check to ensure that they are the same size and transposition. Updated help to include dims of output CCG.

18 Jan 2012 1.13

Some bug fixes.

26 Jun 2013 1.14

Output IC now reflects specified threshold.

20 Feb 2015 1.15

Made many simplifications to the C source code, and added error checks to m code.

24 Feb 2015 1.16

A few simplifications made to the C source code. Overhauled the interface: dramatically reduced the number of required arguments, and added other arguments as optional parameter/value pairs.

11 Aug 2016 1.16

Migrated to GitHub.

01 Mar 2017 1.16

Corrected title.

Contact us