Chris@2: function intCQT = getCQT(Xcqt,fSlice,tSlice,iFlag) Chris@2: %outCQ = getCQT(Xcqt,fSlice,tSlice,iFlag) computes a rasterized representation of Chris@2: %the amplitudes of the calculated CQT coefficients for the frequency bins definded in vector fSlice and the Chris@2: %points in time (time frames) defined in vector tSlice using the interpolation method defined in iFlag. Chris@2: %Valid values for iFlag are: Chris@2: % Chris@2: %'linear' ... linear interpolation (default) Chris@2: %'spline' ... spline interpolation Chris@2: %'nearest' ... nearest neighbor interpolation Chris@2: %'cubic' ... piecewise cubic interpolation Chris@2: % Chris@2: %If the entire CQT representation should be rasterized, set fSlice and Chris@2: %tSlice to 'all'. Chris@2: %The input parameter Xcqt is the structure gained using cqt(...). Chris@2: %The output parameter 'intCQT' is the same size as Xcqt.spCQT but is no Chris@2: %longer sparse since the zeros between two coefficients are replaced by Chris@2: %the interpolated values. The coefficients stored in 'intCQT' are now Chris@2: %real-valued since only the absolute values of the coefficients are Chris@2: %interpolated. If a spectrogram-like (rasterized) version of the CQT Chris@2: %coefficients including phase information is required, use the function Chris@2: %cqtPerfectRast() (see documentation for further information) Chris@2: % Chris@2: %Christian Schörkhuber, Anssi Klapuri 2010-06 Chris@2: Chris@2: Chris@2: if ischar(fSlice), fSlice = 1:(Xcqt.bins*Xcqt.octaveNr); end; Chris@2: if ischar(tSlice) Chris@2: lastEnt = find(Xcqt.spCQT(1,:),1,'last'); Chris@2: tSlice = 1:lastEnt; Chris@2: end Chris@2: if nargin < 4, iFlag = 'linear'; end; Chris@2: Chris@2: intCQT = zeros(length(fSlice),length(tSlice)); Chris@2: bins = Xcqt.bins; Chris@2: spCQT = Xcqt.spCQT; Chris@2: octaveNr = Xcqt.octaveNr; Chris@2: spCQT = spCQT.'; Chris@2: Chris@2: for k=1:length(fSlice) Chris@2: oct = octaveNr-floor((fSlice(k)-0.1)/bins); Chris@2: stepVec = 1:2^(oct-1):size(spCQT,1); Chris@2: Xbin = full(spCQT(stepVec,fSlice(k))); Chris@2: intCQT(k,:) = interp1(stepVec,abs(Xbin),tSlice,iFlag); Chris@2: end Chris@2: Chris@2: Chris@2: