%% Calculate Harmonic Ratio
% Read in an audio file, calculate the harmonic ratio using default parameters, and then plot the results.

[audioIn,fs] = audioread('RandomOscThree-24-96-stereo-13secs.aif');
audioInMono = mean(audioIn,2);

hr = harmonicRatio(audioInMono,fs);

t = (0:length(audioInMono)-1)/fs;
subplot(2,1,1)
plot(t,audioInMono)
ylabel('Amplitude')

t = linspace(0,size(audioInMono,1)/fs,size(hr,1));
subplot(2,1,2)
plot(t,hr)
xlabel('Time (s)')
ylabel('Harmonic Ratio')

%
% Copyright 2018 The MathWorks, Inc.