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