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