|
|
@ -25,17 +25,17 @@ function frameF = filterbank(frameT, frameType, winType) |
|
|
|
kaiserShort = kaiser(129, 4*pi); |
|
|
|
kaiserSumShort = sum(kaiserShort); |
|
|
|
|
|
|
|
kaiserWindowLong(1:1024) = movsum(kaiserLong(1:1024), [1024 0]); |
|
|
|
kaiserWindowLong(1025:2048) = movsum(flipud(kaiserLong(1:1024)), [0 1024]); |
|
|
|
kaiserWindowLong(1:1024, 1) = movsum(kaiserLong(1:1024), [1024 0]); |
|
|
|
kaiserWindowLong(1025:2048, 1) = movsum(flipud(kaiserLong(1:1024)), [0 1024]); |
|
|
|
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(1:128), [128 0]); |
|
|
|
kaiserWindowShort(129:256) = movsum(flipud(kaiserShort(1:128)), [0 128]); |
|
|
|
kaiserWindowShort(1:128, 1) = movsum(kaiserShort(1:128), [128 0]); |
|
|
|
kaiserWindowShort(129:256, 1) = movsum(flipud(kaiserShort(1:128)), [0 128]); |
|
|
|
kaiserWindowShort = sqrt(kaiserWindowShort ./ kaiserSumShort); |
|
|
|
|
|
|
|
sinWindowShort = sin(pi * ((0:255) + 0.5) / 256); |
|
|
|
sinWindowShort = sin(pi * ((0:255) + 0.5) / 256)'; |
|
|
|
end |
|
|
|
|
|
|
|
% Initializes output array |
|
|
@ -44,9 +44,9 @@ function frameF = filterbank(frameT, frameType, winType) |
|
|
|
% Applies appropriate window to the frame |
|
|
|
if strcmp(frameType, 'OLS') |
|
|
|
if strcmp(winType, 'KBD') |
|
|
|
frameT = bsxfun(@times, frameT, kaiserWindowLong'); |
|
|
|
frameT = bsxfun(@times, frameT, kaiserWindowLong); |
|
|
|
elseif strcmp(winType, 'SIN') |
|
|
|
frameT = bsxfun(@times, frameT, sinWindowLong'); |
|
|
|
frameT = bsxfun(@times, frameT, sinWindowLong); |
|
|
|
else |
|
|
|
error('filterbank, l[20]: Unsupported window type input!') |
|
|
|
end |
|
|
@ -54,12 +54,12 @@ function frameF = filterbank(frameT, frameType, winType) |
|
|
|
frameF = mdct4(frameT); |
|
|
|
elseif strcmp(frameType, 'LSS') |
|
|
|
if strcmp(winType, 'KBD') |
|
|
|
frameT(1:1024, :) = bsxfun(@times, frameT(1:1024, :), kaiserWindowLong(1:1024)'); |
|
|
|
frameT(1473:1600, :) = bsxfun(@times, frameT(1473:1600, :), kaiserWindowShort(129:end)'); |
|
|
|
frameT(1:1024, :) = bsxfun(@times, frameT(1:1024, :), kaiserWindowLong(1:1024)); |
|
|
|
frameT(1473:1600, :) = bsxfun(@times, frameT(1473:1600, :), kaiserWindowShort(129:end)); |
|
|
|
frameT(1601:end, :) = 0; |
|
|
|
elseif strcmp(winType, 'SIN') |
|
|
|
frameT(1:1024, :) = bsxfun(@times, frameT(1:1024, :), sinWindowLong(1:1024)'); |
|
|
|
frameT(1473:1600, :) = bsxfun(@times, frameT(1473:1600, :), sinWindowShort(129:end)'); |
|
|
|
frameT(1:1024, :) = bsxfun(@times, frameT(1:1024, :), sinWindowLong(1:1024)); |
|
|
|
frameT(1473:1600, :) = bsxfun(@times, frameT(1473:1600, :), sinWindowShort(129:end)); |
|
|
|
frameT(1601:end, :) = 0; |
|
|
|
else |
|
|
|
error('filterbank, l[20]: Unsupported window type input!') |
|
|
@ -69,12 +69,12 @@ function frameF = filterbank(frameT, frameType, winType) |
|
|
|
elseif strcmp(frameType, 'LPS') |
|
|
|
if strcmp(winType, 'KBD') |
|
|
|
frameT(1:448, :) = 0; |
|
|
|
frameT(449:576, :) = bsxfun(@times, frameT(449:576, :), kaiserWindowShort(1:128)'); |
|
|
|
frameT(1025:end, :) = bsxfun(@times, frameT(1025:end, :), kaiserWindowLong(1025:end)'); |
|
|
|
frameT(449:576, :) = bsxfun(@times, frameT(449:576, :), kaiserWindowShort(1:128)); |
|
|
|
frameT(1025:end, :) = bsxfun(@times, frameT(1025:end, :), kaiserWindowLong(1025:end)); |
|
|
|
elseif strcmp(winType, 'SIN') |
|
|
|
frameT(1:448, :) = 0; |
|
|
|
frameT(449:576, :) = bsxfun(@times, frameT(449:576, :), sinWindowShort(1:128)'); |
|
|
|
frameT(1025:end, :) = bsxfun(@times, frameT(1025:end, :), sinWindowLong(1025:end)'); |
|
|
|
frameT(449:576, :) = bsxfun(@times, frameT(449:576, :), sinWindowShort(1:128)); |
|
|
|
frameT(1025:end, :) = bsxfun(@times, frameT(1025:end, :), sinWindowLong(1025:end)); |
|
|
|
else |
|
|
|
error('filterbank, l[20]: Unsupported window type input!') |
|
|
|
end |
|
|
@ -86,9 +86,9 @@ function frameF = filterbank(frameT, frameType, winType) |
|
|
|
[subFrames, ~] = buffer(frameT(449:end-448, channel), 256, 128, 'nodelay'); |
|
|
|
|
|
|
|
if strcmp(winType, 'KBD') |
|
|
|
subFrames = subFrames .* repmat(kaiserWindowShort', [1 8]); |
|
|
|
subFrames = subFrames .* repmat(kaiserWindowShort, [1 8]); |
|
|
|
elseif strcmp(winType, 'SIN') |
|
|
|
subFrames = subFrames .* repmat(sinWindowShort', [1 8]); |
|
|
|
subFrames = subFrames .* repmat(sinWindowShort, [1 8]); |
|
|
|
end |
|
|
|
|
|
|
|
for subFrameIndex = 1:8 |
|
|
|