comparison toolboxes/MIRtoolbox1.3.2/MIRToolbox/@mirkeysom/mirkeysom.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function varargout = mirkeysom(orig,varargin)
2 % ks = mirkeysom(x) projects a chromagram on a self-organizing map.
3 % Creates a pseudocolor map showing the projection of chromagram onto a
4 % self-organizing map trained with the Krumhansl-Kessler profiles (modified
5 % for chromagrams). Colors correspond to Pearson correlation values.
6 % References:
7 % Toiviainen, P. & Krumhansl, C. L. (2003). Measuring and modeling
8 % real-time responses to music: the dynamics of tonality induction.
9 % Perception, 32(6), 741-766.
10 % Krumhansl, C. L., & Toiviainen, P. (2001) Tonal cognition.
11 % In R. J. Zatorre & I. Peretz (Eds.), The Biological Foundations of Music.
12 % Annals of the New York Academy of Sciences.
13
14 % filename.key = 'File';
15 % filename.type = 'String';
16 % filename.default = 0;
17 % option.filename = filename;
18
19 specif.option = struct;
20 specif.defaultframelength = 1;
21 specif.defaultframehop = .5;
22
23 varargout = mirfunction(@mirkeysom,orig,varargin,nargout,specif,@init,@main);
24
25
26 function [c type] = init(orig,option)
27 c = mirchromagram(orig,'Normal');
28 type = 'mirkeysom';
29
30
31 function s = main(c,option,postoption)
32 if iscell(c)
33 c = c{1};
34 end
35 load keysomaudiodata;
36 m = get(c,'Magnitude');
37 disp('Projecting the chromagram to a self-organizing map...')
38 z = cell(1,length(m));
39 p = cell(1,length(m));
40 for i = 1:length(m)
41 mi = m{i};
42 if not(iscell(mi))
43 mi = {mi};
44 end
45 zi = cell(1,length(mi));
46 pi = cell(1,length(mi));
47 for j = 1:length(mi)
48 mj = mi{j};
49 zj = zeros(24,size(mj,2),size(mj,3),36);
50 pi{j} = zeros(24,size(mj,2),size(mj,3),36);
51 for k = 1:size(mj,2)
52 for l = 1:size(mj,3)
53 for kk=1:36
54 for ll=1:24
55 tmp = corrcoef([mj(:,k,l) somw(:,kk,ll)]);
56 zj(ll,k,l,kk) = tmp(1,2);
57 end
58 end
59 end
60 end
61 zi{j} = zj;
62 end
63 z{i} = zi;
64 p{i} = pi;
65 end
66 s = class(struct,'mirkeysom',mirdata(c));
67 s = purgedata(s);
68 s = set(s,'Title','Key SOM','Abs','','Ord','','Weight',z,'Pos',p);
69 %if option.filename
70 % mov = display(s,option.filename);
71 %else
72 % mov = display(s);
73 %end
74 %s = {s,mov};