%% load sound files and play
load train
s1 = y;
load chirp
s2 = y;

%% listing 5.11
rms_s1 = sqrt(mean(s1.^2)); % rms mean of sound 1
rms_s2 = sqrt(mean(s2.^2)); % rms mean of sound 2
rms_ratio = rms_s1/rms_s2;
if rms_ratio > 1
    fprintf('The first was the loudest\n');
    s2 = s2 * rms_ratio;
else
    fprintf('The second was the loudest\n');
    s1 = s1 * rms_ratio;
end