wolffd@0: function varargout = mirbrightness(x,varargin) wolffd@0: % b = mirbrightness(s) calculates the spectral brightness, i.e. the amount wolffd@0: % of spectral energy corresponding to frequencies higher than a given wolffd@0: % cut-off threshold. wolffd@0: % Optional arguments: wolffd@0: % b = mirbrightness(s,'CutOff',f) specifies the frequency cut-off wolffd@0: % threshold in Hz. wolffd@0: % Default value: f = 1500 Hz. wolffd@0: % wolffd@0: % Typical values for the frequency cut-off threshold: wolffd@0: % 3000 Hz in Juslin 2000, p. 1802. wolffd@0: % 1000 Hz and 500 Hz in Laukka, Juslin and Bresin 2005. wolffd@0: % wolffd@0: % Juslin, P. N. (2000). Cue utilization in communication of emotion in wolffd@0: % music performance: relating performance to perception. Journal of wolffd@0: % Experimental Psychology: Human Perception and Performance, 26(6), 1797?813. wolffd@0: % Laukka, P., Juslin, P. N., and Bresin, R. (2005). A dimensional approach wolffd@0: % to vocal expression of emotion. Cognition and Emotion, 19, 633?653. wolffd@0: wolffd@0: wolffd@0: cutoff.key = 'CutOff'; wolffd@0: cutoff.type = 'Integer'; wolffd@0: cutoff.default = 1500; wolffd@0: option.cutoff = cutoff; wolffd@0: wolffd@0: specif.option = option; wolffd@0: specif.defaultframelength = .05; wolffd@0: specif.defaultframehop = .5; wolffd@0: wolffd@0: wolffd@0: varargout = mirfunction(@mirbrightness,x,varargin,nargout,specif,@init,@main); wolffd@0: wolffd@0: wolffd@0: function [x type] = init(x,option) wolffd@0: if not(isamir(x,'mirspectrum')) wolffd@0: x = mirspectrum(x); wolffd@0: end wolffd@0: type = 'mirscalar'; wolffd@0: wolffd@0: wolffd@0: function b = main(s,option,postoption) wolffd@0: if iscell(s) wolffd@0: s = s{1}; wolffd@0: end wolffd@0: m = get(s,'Magnitude'); wolffd@0: f = get(s,'Frequency'); wolffd@0: w = warning('query','MATLAB:divideByZero'); wolffd@0: warning('off','MATLAB:divideByZero'); wolffd@0: v = mircompute(@algo,m,f,option.cutoff); wolffd@0: warning(w.state,'MATLAB:divideByZero'); wolffd@0: b = mirscalar(s,'Data',v,'Title','Brightness'); wolffd@0: wolffd@0: wolffd@0: function v = algo(m,f,k) wolffd@0: if not(any(max(f)>k)) wolffd@0: warning('WARNING in MIRBRIGHTNESS: Frequency range of the spectrum too low for the estimation of brightness.'); wolffd@0: end wolffd@0: sm = sum(m); wolffd@0: v = sum(m(f(:,1,1) > k,:,:)) ./ sm;