|
@ -14,35 +14,8 @@ function SNR = demoAAC1(fNameIn, fNameOut) |
|
|
decodedAudio = iAACoder1(AACSeq1, fNameOut); |
|
|
decodedAudio = iAACoder1(AACSeq1, fNameOut); |
|
|
|
|
|
|
|
|
[audioData, ~] = audioread(fNameIn); |
|
|
[audioData, ~] = audioread(fNameIn); |
|
|
|
|
|
|
|
|
% figure() |
|
|
|
|
|
% plot(audioData(1025:length(decodedAudio)-1024, 1) - decodedAudio(1025:end-1024, 1)) |
|
|
|
|
|
% for frame = 1:length(AACSeq1) |
|
|
|
|
|
% if strcmp(AACSeq1(frame).frameType, 'LSS') || strcmp(AACSeq1(frame).frameType, 'LPS') |
|
|
|
|
|
% % Add lines |
|
|
|
|
|
% h1 = line([(frame-1)*1024+1 (frame-1)*1024+1],[-2*10^(-15) 2*10^(-15)]); |
|
|
|
|
|
% h2 = line([frame*1024+1 frame*1024+1],[-2*10^(-15) 2*10^(-15)]); |
|
|
|
|
|
% % Set properties of lines |
|
|
|
|
|
% set([h1 h2],'Color','y','LineWidth',2) |
|
|
|
|
|
% % Add a patch |
|
|
|
|
|
% patch([(frame-1)*1024+1 frame*1024+1 frame*1024+1 (frame-1)*1024+1],[-2*10^(-15) -2*10^(-15) 2*10^(-15) 2*10^(-15)],'y') |
|
|
|
|
|
% elseif strcmp(AACSeq1(frame).frameType, 'ESH') |
|
|
|
|
|
% % Add lines |
|
|
|
|
|
% h1 = line([(frame-1)*1024+1 (frame-1)*1024+1],[-2*10^(-15) 2*10^(-15)]); |
|
|
|
|
|
% h2 = line([frame*1024+1 frame*1024+1],[-2*10^(-15) 2*10^(-15)]); |
|
|
|
|
|
% % Set properties of lines |
|
|
|
|
|
% set([h1 h2],'Color','r','LineWidth',2) |
|
|
|
|
|
% % Add a patch |
|
|
|
|
|
% patch([(frame-1)*1024+1 frame*1024+1 frame*1024+1 (frame-1)*1024+1],[-2*10^(-15) -2*10^(-15) 2*10^(-15) 2*10^(-15)],'r') |
|
|
|
|
|
% end |
|
|
|
|
|
% end |
|
|
|
|
|
% set(gca,'children',flipud(get(gca,'children'))) |
|
|
|
|
|
% |
|
|
|
|
|
% figure() |
|
|
|
|
|
% plot(audioData(1025:length(decodedAudio)-1024, 2) - decodedAudio(1025:end-1024, 2)) |
|
|
|
|
|
|
|
|
|
|
|
snr(audioData(1025:length(decodedAudio)-1024, 1), audioData(1025:length(decodedAudio)-1024, 1) - decodedAudio(1025:end-1024, 1)) |
|
|
snr(audioData(1025:length(decodedAudio)-1024, 1), audioData(1025:length(decodedAudio)-1024, 1) - decodedAudio(1025:end-1024, 1)) |
|
|
snr(audioData(1025:length(decodedAudio)-1024, 2), audioData(1025:length(decodedAudio)-1024, 2) - decodedAudio(1025:end-1024, 2)) |
|
|
snr(audioData(1025:length(decodedAudio)-1024, 2), audioData(1025:length(decodedAudio)-1024, 2) - decodedAudio(1025:end-1024, 2)) |
|
|
SNR = 10*log10((sum(audioData(1025:length(decodedAudio)-1024, :)) .^ 2) ./ ... |
|
|
SNR = snr(audioData(1025:length(decodedAudio)-1024, :), audioData(1025:length(decodedAudio)-1024, :) - decodedAudio(1025:end-1024, :)); |
|
|
(sum(audioData(1025:length(decodedAudio)-1024, :) - decodedAudio(1025:end-1024, :)) .^ 2)); |
|
|
|
|
|
end |
|
|
end |
|
|