function out = monoloudness_features(y, fs, wind, winover, padd)

% out = monoloudness_features(y, fs, operator)
% 
% This function calculates speech features assessing degree of monotony 
% of loudness (monoloudness).
% 
% y                 - input column vector
% fs                - sampling frequency
% wind              - length of window in samples or window samples
% winover           - window overlapp in samples
% padd              - if set to 1, the last segment will be padded  
%                     by zeros if necessary (default: 0)

%% Paths and variables
if ((nargin < 3) || (isempty(wind)))
    wind = hamming(0.02*fs); 
end
if ((nargin < 4) || (isempty(winover)))
    winover =  length(wind)/2;
end
if ((nargin < 5) || (isempty(padd)))
    padd = 0;
end

%% Calculate the energy operators supperted by the algorithm
E = energy(y, wind, winover, padd);
T = tkeo(y);

%% Calculate the prosodic (monoloudness) features
out.E_std    = std(E);                    % standard deviation
out.E_VR     = max(E) - min(E);           % rel. tandard deviation
out.E_relSTD = out.E_std/mean(E)*100;     % variation range
out.E_relVR  = out.E_VR/mean(E)*100;      % rel. variation range
out.E_QCD    = iqr(E)/median(E);          % quartile coeff. of dispersion

out.T_std    = std(T);                    % standard deviation
out.T_VR     = max(T) - min(T);           % rel. tandard deviation
out.T_relSTD = out.T_std/mean(T)*100;     % variation range
out.T_relVR  = out.T_VR/mean(T)*100;      % rel. variation range
out.T_QCD    = iqr(T)/median(T);          % quartile coeff. of dispersion