%% Initial cleanup
clear all;
close all;
clc;

%% Paths and variables
addpath(genpath(pwd));

%% Read the audio files
files = dir('*.wav');

for k = 1:length(files)
nahravky{k} = audioread(files(k).name);
end

%% compute conventional features
fs = 16000;

for k = 1:length(nahravky)
% 
% MP(k) = monopitch_features(nahravky{1,k}, fs);
% 
% ML(k) = monoloudness_features(nahravky{1,k}, fs);
% 
SR(k) = derive_speech_rate(nahravky{1,k}, fs, 'Chcete vidět velký lov? Budu lovit v dungli slov. Osedlám si pegasa, chytím báseň do lasa.');
end 

%% compute novel features

window    = hamming(1*fs);
overlap   = round(length(window)/2);
padding   = 0;
decibels  = false;
semitones = false;
min_pitch = 75;
max_pitch = 400;

for k = 1:length(nahravky)
    
%PV(k) = pitch_variability(praat_F0(nahravky{1,k}, fs, min_pitch, max_pitch), fs, semitones);

%EV(k) = energy_variability(energy(nahravky{1,k}, fs, window, overlap, padding),fs ,decibels);

%SMP(k) = speech_monopitch(nahravky{1,k}, fs, min_pitch, max_pitch);

%SML(k) = speech_monoloudness(nahravky{1,k}, fs);

SI(k) = speech_intonation(nahravky{1,k}, fs, window, overlap, padding, min_pitch, max_pitch);

NTCH(k) = novel_time_characteristics(SR(k).TSR,SR(k).NSR,SR(k).AR,SR(k).SPIR);

GP(k) = global_parameter(SI(k).cumsum_slope,NTCH(k).USRC,NTCH(k).TNSR,NTCH(k).Tempovost,SR(k).TSR,SR(k).TST);
end