Semester assignment for the course "Multimedia systems and virtual reality" of THMMY in AUTH university.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.8 KiB

6 years ago
function SNR = demoAAC1(fNameIn, fNameOut)
%Implementation of WHAT?? //TODO!!
% Usage SNR = demoAAC1(fNameIn, fNameOut), where:
% Inputs
% - fNameIn is the filename and path of the file to encode
% - fNameOut is the filename and path of the file that will be
% written after decoding
%
% Output
% - SNR is the signal to noise ration computed after successively
% encoding and decoding the audio signal
AACSeq1 = AACoder1(fNameIn);
decodedAudio = iAACoder1(AACSeq1, fNameOut);
[audioData, ~] = audioread(fNameIn);
6 years ago
% figure()
% plot(audioData(1:length(decodedAudio), 1) - decodedAudio(1:end, 1))
% figure()
% plot(audioData(1:length(decodedAudio), 2) - decodedAudio(1:end, 2))
%
% snr(audioData(1:length(decodedAudio), 1), audioData(1:length(decodedAudio), 1) - decodedAudio(1:end, 1))
% snr(audioData(1:length(decodedAudio), 2), audioData(1:length(decodedAudio), 2) - decodedAudio(1:end, 2))
% SNR = 10*log10((sum(audioData(1:length(decodedAudio), :)) .^ 2) ./ ...
% (sum(audioData(1:length(decodedAudio), :) - decodedAudio) .^ 2));
6 years ago
figure()
plot(audioData(1024:length(decodedAudio)-1024, 1) - decodedAudio(1024:end-1024, 1))
6 years ago
figure()
plot(audioData(1024:length(decodedAudio)-1024, 2) - decodedAudio(1024:end-1024, 2))
6 years ago
snr(audioData(1024:length(decodedAudio)-1024, 1), audioData(1024:length(decodedAudio)-1024, 1) - decodedAudio(1024:end-1024, 1))
snr(audioData(1024:length(decodedAudio)-1024, 2), audioData(1024:length(decodedAudio)-1024, 2) - decodedAudio(1024:end-1024, 2))
SNR = 10*log10((var(audioData(1024:length(decodedAudio)-1024, :)) .^ 2) ./ ...
(var(audioData(1024:length(decodedAudio)-1024, :) - decodedAudio(1024:end-1024, :)) .^ 2));
6 years ago
end