comparison toolboxes/MIRtoolbox1.3.2/MIRToolbox/mirattacktime.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 = mirattacktime(orig,varargin)
2 % a = mirattacktime(x) returns the duration (in s.) of each note attack.
3 % Optional arguments:
4 % a = mirattacktime(x,l) specifies whether to consider the duration in s.
5 % (l='Lin') or the logarithm of that duration (l='Log') following the
6 % approach proposed in Krimphoff et al. (1994).
7 % Default value: l='Lin'.
8 %
9 % Krimphoff, J., McAdams, S. & Winsberg, S. (1994), Caractérisation du
10 % timbre des sons complexes. II : Analyses acoustiques et quantification
11 % psychophysique. Journal de Physique, 4(C5), 625-628.
12
13 scale.type = 'String';
14 scale.choice = {'Lin','Log'};
15 scale.default = 'Lin';
16 option.scale = scale;
17
18 specif.option = option;
19
20 varargout = mirfunction(@mirattacktime,orig,varargin,nargout,specif,@init,@main);
21
22
23 function [o type] = init(x,option)
24 o = mironsets(x,'Attack');
25 type = mirtype(x);
26
27
28 function at = main(o,option,postoption)
29 if iscell(o)
30 o = o{1};
31 end
32 po = get(o,'PeakPosUnit');
33 pa = get(o,'AttackPosUnit');
34 at = mircompute(@algo,po,pa,option.scale);
35 fp = mircompute(@frampose,pa,po);
36 at = mirscalar(o,'Data',at,'FramePos',fp,'Title','Attack Time');
37 at = {at,o};
38
39
40 function fp = frampose(pa,po)
41 pa = sort(pa{1});
42 po = sort(po{1});
43 fp = [pa';po'];
44
45
46 function at = algo(po,pa,sc)
47 po = sort(po{1});
48 pa = sort(pa{1});
49 at = po-pa;
50 if strcmpi(sc,'Log')
51 at = log10(at);
52 end
53 at = at';