|
@ -15,13 +15,23 @@ function SNR = demoAAC1(fNameIn, fNameOut) |
|
|
|
|
|
|
|
|
[audioData, ~] = audioread(fNameIn); |
|
|
[audioData, ~] = audioread(fNameIn); |
|
|
|
|
|
|
|
|
|
|
|
% 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)); |
|
|
|
|
|
|
|
|
figure() |
|
|
figure() |
|
|
plot(audioData(1:length(decodedAudio), 1) - decodedAudio(1:end, 1)) |
|
|
plot(audioData(1024:length(decodedAudio)-1024, 1) - decodedAudio(1024:end-1024, 1)) |
|
|
figure() |
|
|
figure() |
|
|
plot(audioData(1:length(decodedAudio), 2) - decodedAudio(1:end, 2)) |
|
|
plot(audioData(1024:length(decodedAudio)-1024, 2) - decodedAudio(1024:end-1024, 2)) |
|
|
|
|
|
|
|
|
snr(audioData(1:length(decodedAudio), 1), audioData(1:length(decodedAudio), 1) - decodedAudio(1:end, 1)) |
|
|
snr(audioData(1024:length(decodedAudio)-1024, 1), audioData(1024:length(decodedAudio)-1024, 1) - decodedAudio(1024:end-1024, 1)) |
|
|
snr(audioData(1:length(decodedAudio), 2), audioData(1:length(decodedAudio), 2) - decodedAudio(1:end, 2)) |
|
|
snr(audioData(1024:length(decodedAudio)-1024, 2), audioData(1024:length(decodedAudio)-1024, 2) - decodedAudio(1024:end-1024, 2)) |
|
|
SNR = 10*log10((sum(audioData(1:length(decodedAudio), :)) .^ 2) ./ ... |
|
|
SNR = 10*log10((var(audioData(1024:length(decodedAudio)-1024, :)) .^ 2) ./ ... |
|
|
(sum(audioData(1:length(decodedAudio), :) - decodedAudio) .^ 2)); |
|
|
(var(audioData(1024:length(decodedAudio)-1024, :) - decodedAudio(1024:end-1024, :)) .^ 2)); |
|
|
end |
|
|
end |
|
|