-
Notifications
You must be signed in to change notification settings - Fork 6
/
calc_sbpca.m
36 lines (27 loc) · 1.04 KB
/
calc_sbpca.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function [pcas, params] = calc_sbpca(d, sr)
% [pcas, params] = calc_sbpca(d, sr)
% Rebuild of SBPCA calculation - up to subband PCA part
% Output pca has dimensions <pcadims> x <nsubbands> x <nframes>
% 2013-05-27 Dan Ellis [email protected]
% parameters
params.wintime = 0.025;
params.hoptime = 0.010;
params.sr = sr;
% Setup the filterbank
%bpo = 6; nchs = 24;
%fmin = 100; fb_q = 8; ord = 2; ftype = 2;
%[params.fbank.b, params.fbank.a, params.fbank.t, w, params.fbank.cf] ...
% = bpfiltbank(params.sr, fmin, bpo, nchs, fb_q, ord, ftype);
params.fbank = sbpca_filterbank(params.sr);
%%%%%%%%%%% Calculation %%%%%%%%%%%%
% subbands - <nch> x <ntime>
subbands = sbpca_subbands(d, sr, params);
% autocorrelate - <nlag> x <nch> x <nframe>
autocos = sbpca_autoco(subbands, params);
% load the PCA basis functions
mapfile = 'pca_sr8k_bpo6_sb24_k10.mat';
M = load(mapfile);
params.mapping = M.mapping;
% principal components - <nPC> x <nch> x <nframe>
pcas = sbpca_pca(autocos, params);
% 2013-08-07 Up to here now verified as identical to calcSBPCA