function out = monopitch_features(y, fs, minimum_pitch, maximum_pitch)

% out = monopitch_features(y, fs, minimum_pitch, maximum_pitch)
% 
% This function calculates speech features assessing degree of monopitch
% intonation (it represents the global assessment of speech intonation).
% 
% y                 - input column vector
% fs                - sampling frequency
% minimum_pitch     - minimum frequency (default: 75Hz)
% maximum_pitch     - minimum frequency (default: 400Hz)

%% Paths and variables
if ((nargin < 3) || (isempty(minimum_pitch)))
    minimum_pitch = 75;
end
if ((nargin < 4) || (isempty(maximum_pitch)))
    maximum_pitch = 400;
end

%% Calculate the fundamental frequency using Praat
F0 = praat_F0(y, fs, minimum_pitch, maximum_pitch);

%% Calculate the prosodic (monopitch) features
out.F0_std    = std(F0);                  % standard deviation
out.F0_VR     = max(F0) - min(F0);        % rel. tandard deviation
out.F0_relSTD = out.F0_std/mean(F0)*100;  % variation range
out.F0_relVR  = out.F0_VR/mean(F0)*100;   % rel. variation range
out.F0_QCD    = iqr(F0)/median(F0);       % quartile coeff. of dispersion