Browse Source

Critical fix for kaiser windows

master
Apostolos Fanakis 6 years ago
parent
commit
ba4e24d161
  1. 2
      Level_1/SSC.m
  2. BIN
      Level_1/decoded2.wav
  3. 12
      Level_1/filterbank.m
  4. 12
      Level_1/iFilterbank.m

2
Level_1/SSC.m

@ -29,7 +29,7 @@ function frameType = SSC(~, nextFrameT, prevFrameType)
% Determines the type of the next frame % Determines the type of the next frame
% Filters frame % Filters frame
nextFrameT = filter([0.7548, -0.7548], [1, -0.5095], nextFrameT, [], 1); nextFrameT = filter([0.7548 -0.7548], [1 -0.5095], nextFrameT, [], 1);
channelFrameType = {'nan', 'nan'}; channelFrameType = {'nan', 'nan'};

BIN
Level_1/decoded2.wav

Binary file not shown.

12
Level_1/filterbank.m

@ -20,19 +20,19 @@ function frameF = filterbank(frameT, frameType, winType)
persistent kaiserWindowLong kaiserWindowShort sinWindowLong sinWindowShort; persistent kaiserWindowLong kaiserWindowShort sinWindowLong sinWindowShort;
if isempty(kaiserWindowLong) || isempty(kaiserWindowShort) || ... if isempty(kaiserWindowLong) || isempty(kaiserWindowShort) || ...
isempty(sinWindowLong) || isempty(sinWindowShort) isempty(sinWindowLong) || isempty(sinWindowShort)
kaiserLong = kaiser(1024, 6*pi); kaiserLong = kaiser(1025, 6*pi);
kaiserSumLong = sum(kaiserLong); kaiserSumLong = sum(kaiserLong);
kaiserShort = kaiser(128, 4*pi); kaiserShort = kaiser(129, 4*pi);
kaiserSumShort = sum(kaiserShort); kaiserSumShort = sum(kaiserShort);
kaiserWindowLong(1:1024) = movsum(kaiserLong, [1024 0]); kaiserWindowLong(1:1024) = movsum(kaiserLong(1:1024), [1024 0]);
kaiserWindowLong(1025:2048) = movsum(flipud(kaiserLong), [0 1024]); kaiserWindowLong(1025:2048) = movsum(flipud(kaiserLong(1:1024)), [0 1024]);
kaiserWindowLong = sqrt(kaiserWindowLong ./ kaiserSumLong); kaiserWindowLong = sqrt(kaiserWindowLong ./ kaiserSumLong);
sinWindowLong = sin(pi * ((0:2047) + 0.5) / 2048); sinWindowLong = sin(pi * ((0:2047) + 0.5) / 2048);
kaiserWindowShort(1:128) = movsum(kaiserShort, [128 0]); kaiserWindowShort(1:128) = movsum(kaiserShort(1:128), [128 0]);
kaiserWindowShort(129:256) = movsum(flipud(kaiserShort), [0 128]); kaiserWindowShort(129:256) = movsum(flipud(kaiserShort(1:128)), [0 128]);
kaiserWindowShort = sqrt(kaiserWindowShort ./ kaiserSumShort); kaiserWindowShort = sqrt(kaiserWindowShort ./ kaiserSumShort);
sinWindowShort = sin(pi * ((0:255) + 0.5) / 256); sinWindowShort = sin(pi * ((0:255) + 0.5) / 256);

12
Level_1/iFilterbank.m

@ -20,19 +20,19 @@ function frameT = iFilterbank(frameF, frameType, winType)
persistent kaiserWindowLong kaiserWindowShort sinWindowLong sinWindowShort; persistent kaiserWindowLong kaiserWindowShort sinWindowLong sinWindowShort;
if isempty(kaiserWindowLong) || isempty(kaiserWindowShort) || ... if isempty(kaiserWindowLong) || isempty(kaiserWindowShort) || ...
isempty(sinWindowLong) || isempty(sinWindowShort) isempty(sinWindowLong) || isempty(sinWindowShort)
kaiserLong = kaiser(1024, 6*pi); kaiserLong = kaiser(1025, 6*pi);
kaiserSumLong = sum(kaiserLong); kaiserSumLong = sum(kaiserLong);
kaiserShort = kaiser(128, 4*pi); kaiserShort = kaiser(129, 4*pi);
kaiserSumShort = sum(kaiserShort); kaiserSumShort = sum(kaiserShort);
kaiserWindowLong(1:1024) = movsum(kaiserLong, [1024 0]); kaiserWindowLong(1:1024) = movsum(kaiserLong(1:1024), [1024 0]);
kaiserWindowLong(1025:2048) = movsum(flipud(kaiserLong), [0 1024]); kaiserWindowLong(1025:2048) = movsum(flipud(kaiserLong(1:1024)), [0 1024]);
kaiserWindowLong = sqrt(kaiserWindowLong ./ kaiserSumLong); kaiserWindowLong = sqrt(kaiserWindowLong ./ kaiserSumLong);
sinWindowLong = sin(pi * ((0:2047) + 0.5) / 2048); sinWindowLong = sin(pi * ((0:2047) + 0.5) / 2048);
kaiserWindowShort(1:128) = movsum(kaiserShort, [128 0]); kaiserWindowShort(1:128) = movsum(kaiserShort(1:128), [128 0]);
kaiserWindowShort(129:256) = movsum(flipud(kaiserShort), [0 128]); kaiserWindowShort(129:256) = movsum(flipud(kaiserShort(1:128)), [0 128]);
kaiserWindowShort = sqrt(kaiserWindowShort ./ kaiserSumShort); kaiserWindowShort = sqrt(kaiserWindowShort ./ kaiserSumShort);
sinWindowShort = sin(pi * ((0:255) + 0.5) / 256); sinWindowShort = sin(pi * ((0:255) + 0.5) / 256);

Loading…
Cancel
Save