Mercurial > hg > mauch-mirex-2010
view _misc/featureextraction/.svn/text-base/mmcq2hpcp.m.svn-base @ 9:4ea6619cb3f5 tip
removed log files
author | matthiasm |
---|---|
date | Fri, 11 Apr 2014 15:55:11 +0100 |
parents | b5b38998ef3b |
children |
line wrap: on
line source
% CQ2HPCP Convert Constant Q spectrum to a HPCP % % CQ2HPCP(cqframes, info) % % cqframes = vector or matrix constant q spectrum / spectra % info = info structure containing parameters % function [hpcpframes] = mmcq2hpcp(cqframes, info) %get cq parameters from info structure num_win = info.numberframes; cqbins = size(cqframes,1); bpo = info.binsperoctave; % calculate the number of octaves we have in the spectrum num_oct = floor(cqbins/bpo)-1; hpcpframes(1:num_win, 1:bpo) = 0; % for each window calculate chromagram for i = 1 : num_win % add each octave of the spectrum into the chromagram for oct = 0:num_oct; ind = oct*bpo; hpcpframes(i, 1:bpo) = hpcpframes(i, 1:bpo) + abs(cqframes(ind+1:ind+bpo,i))'; end; % normalise % hpcpframes(i,1:bpo) = hpcpframes(i,1:bpo)/max(hpcpframes(i,1:bpo)); meanc = mean(hpcpframes(i,1:bpo)); if meanc > 0.0000001 hpcpframes(i,1:bpo) = hpcpframes(i,1:bpo)/mean(hpcpframes(i,1:bpo)); %scale to be a distribution! else hpcpframes(i,1:bpo) = (bpo)^(-1); end end;