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