Repository navigation
Expand file tree
/
Copy pathkeysom.m
More file actions
58 lines (45 loc) · 1.3 KB
/
Copy pathkeysom.m
File metadata and controls
58 lines (45 loc) · 1.3 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
% MUS.KEYSOM
%
% Copyright (C) 2017 Olivier Lartillot
% © 2007-2009 Olivier Lartillot & University of Jyvaskyla
%
% All rights reserved.
% License: New BSD License. See full text of the license in LICENSE.txt in
% the main folder of the MiningSuite distribution.
function varargout = keysom(varargin)
varargout = sig.operate('mus','chromagram',initoptions,...
@init,@main,@after,varargin);
end
function options = initoptions
options = sig.signal.signaloptions('FrameAuto',2,.05);
end
%%
function [x type] = init(x,option,frame)
x = mus.chromagram(x,'FrameConfig',frame,'Normal');
type = {'mus.KeySOM'};
end
function out = main(orig,option)
orig = orig{1};
load keysomaudiodata;
z = sig.compute(@routine,orig.Ydata,somw);
som = mus.KeySOM(z,'Srate',orig.Srate,'Ssize',orig.Ssize,...
'FbChannels',orig.fbchannels);
out = {som};
end
function z = routine(m,somw)
z = m.apply(@algo,{somw},{'element','sample'},2,'{}');
end
function out = algo(m,somw)
z = zeros(24,size(m,2),36);
for k = 1:size(m,2)
for kk=1:36
for ll=1:24
tmp = corrcoef([m(:,k) somw(:,kk,ll)]);
z(ll,k,kk) = tmp(1,2);
end
end
end
out = {z};
end
function x = after(x,option)
end