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