Daniel@0: function varargout = mirattacktime(orig,varargin) Daniel@0: % a = mirattacktime(x) returns the duration (in s.) of each note attack. Daniel@0: % Optional arguments: Daniel@0: % a = mirattacktime(x,l) specifies whether to consider the duration in s. Daniel@0: % (l='Lin') or the logarithm of that duration (l='Log') following the Daniel@0: % approach proposed in Krimphoff et al. (1994). Daniel@0: % Default value: l='Lin'. Daniel@0: % Daniel@0: % Krimphoff, J., McAdams, S. & Winsberg, S. (1994), Caractérisation du Daniel@0: % timbre des sons complexes. II : Analyses acoustiques et quantification Daniel@0: % psychophysique. Journal de Physique, 4(C5), 625-628. Daniel@0: Daniel@0: scale.type = 'String'; Daniel@0: scale.choice = {'Lin','Log'}; Daniel@0: scale.default = 'Lin'; Daniel@0: option.scale = scale; Daniel@0: Daniel@0: specif.option = option; Daniel@0: Daniel@0: varargout = mirfunction(@mirattacktime,orig,varargin,nargout,specif,@init,@main); Daniel@0: Daniel@0: Daniel@0: function [o type] = init(x,option) Daniel@0: o = mironsets(x,'Attack'); Daniel@0: type = mirtype(x); Daniel@0: Daniel@0: Daniel@0: function at = main(o,option,postoption) Daniel@0: if iscell(o) Daniel@0: o = o{1}; Daniel@0: end Daniel@0: po = get(o,'PeakPosUnit'); Daniel@0: pa = get(o,'AttackPosUnit'); Daniel@0: at = mircompute(@algo,po,pa,option.scale); Daniel@0: fp = mircompute(@frampose,pa,po); Daniel@0: at = mirscalar(o,'Data',at,'FramePos',fp,'Title','Attack Time'); Daniel@0: at = {at,o}; Daniel@0: Daniel@0: Daniel@0: function fp = frampose(pa,po) Daniel@0: pa = sort(pa{1}); Daniel@0: po = sort(po{1}); Daniel@0: fp = [pa';po']; Daniel@0: Daniel@0: Daniel@0: function at = algo(po,pa,sc) Daniel@0: po = sort(po{1}); Daniel@0: pa = sort(pa{1}); Daniel@0: at = po-pa; Daniel@0: if strcmpi(sc,'Log') Daniel@0: at = log10(at); Daniel@0: end Daniel@0: at = at';