|
@ -38,49 +38,50 @@ function frameF = filterbank(frameT, frameType, winType) |
|
|
sinWindowShort = sin(pi * ((0:255) + 0.5) / 256); |
|
|
sinWindowShort = sin(pi * ((0:255) + 0.5) / 256); |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
% Initializes output array |
|
|
frameF(1024, 2) = 0; |
|
|
frameF(1024, 2) = 0; |
|
|
|
|
|
|
|
|
% Applies appropriate window to the frame |
|
|
% Applies appropriate window to the frame |
|
|
for channel=1:2 |
|
|
|
|
|
if strcmp(frameType, 'OLS') |
|
|
if strcmp(frameType, 'OLS') |
|
|
if strcmp(winType, 'KBD') |
|
|
if strcmp(winType, 'KBD') |
|
|
frameT(:, channel) = frameT(:, channel) .* kaiserWindowLong(:); |
|
|
frameT = bsxfun(@times, frameT, kaiserWindowLong'); |
|
|
elseif strcmp(winType, 'SIN') |
|
|
elseif strcmp(winType, 'SIN') |
|
|
frameT(:, channel) = frameT(:, channel) .* sinWindowLong(:); |
|
|
frameT = bsxfun(@times, frameT, sinWindowLong'); |
|
|
else |
|
|
else |
|
|
error('filterbank, l[20]: Unsupported window type input!') |
|
|
error('filterbank, l[20]: Unsupported window type input!') |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
frameF(:, channel) = mdct4(frameT(:, channel)); |
|
|
frameF = mdct4(frameT); |
|
|
elseif strcmp(frameType, 'LSS') |
|
|
elseif strcmp(frameType, 'LSS') |
|
|
if strcmp(winType, 'KBD') |
|
|
if strcmp(winType, 'KBD') |
|
|
frameT(1:1024, channel) = frameT(1:1024, channel) .* kaiserWindowLong(1:1024)'; |
|
|
frameT(1:1024, :) = bsxfun(@times, frameT(1:1024, :), kaiserWindowLong(1:1024)'); |
|
|
frameT(1473:1600, channel) = frameT(1473:1600, channel) .* kaiserWindowShort(129:end)'; |
|
|
frameT(1473:1600, :) = bsxfun(@times, frameT(1473:1600, :), kaiserWindowShort(129:end)'); |
|
|
frameT(1601:end, channel) = 0; |
|
|
frameT(1601:end, :) = 0; |
|
|
elseif strcmp(winType, 'SIN') |
|
|
elseif strcmp(winType, 'SIN') |
|
|
frameT(1:1024, channel) = frameT(1:1024, channel) .* sinWindowLong(1:1024)'; |
|
|
frameT(1:1024, :) = bsxfun(@times, frameT(1:1024, :), sinWindowLong(1:1024)'); |
|
|
frameT(1473:1600, channel) = frameT(1473:1600, channel) .* sinWindowShort(129:end)'; |
|
|
frameT(1473:1600, :) = bsxfun(@times, frameT(1473:1600, :), sinWindowShort(129:end)'); |
|
|
frameT(1601:end, channel) = 0; |
|
|
frameT(1601:end, :) = 0; |
|
|
else |
|
|
else |
|
|
error('filterbank, l[20]: Unsupported window type input!') |
|
|
error('filterbank, l[20]: Unsupported window type input!') |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
frameF(:, channel) = mdct4(frameT(:, channel)); |
|
|
frameF = mdct4(frameT); |
|
|
elseif strcmp(frameType, 'LPS') |
|
|
elseif strcmp(frameType, 'LPS') |
|
|
if strcmp(winType, 'KBD') |
|
|
if strcmp(winType, 'KBD') |
|
|
frameT(1:448, channel) = 0; |
|
|
frameT(1:448, :) = 0; |
|
|
frameT(449:576, channel) = frameT(449:576, channel) .* kaiserWindowShort(1:128)'; |
|
|
frameT(449:576, :) = bsxfun(@times, frameT(449:576, :), kaiserWindowShort(1:128)'); |
|
|
frameT(1025:end, channel) = frameT(1025:end, channel) .* kaiserWindowLong(1025:end)'; |
|
|
frameT(1025:end, :) = bsxfun(@times, frameT(1025:end, :), kaiserWindowLong(1025:end)'); |
|
|
elseif strcmp(winType, 'SIN') |
|
|
elseif strcmp(winType, 'SIN') |
|
|
frameT(1:448, channel) = 0; |
|
|
frameT(1:448, :) = 0; |
|
|
frameT(449:576, channel) = frameT(449:576, channel) .* sinWindowShort(1:128)'; |
|
|
frameT(449:576, :) = bsxfun(@times, frameT(449:576, :), sinWindowShort(1:128)'); |
|
|
frameT(1025:end, channel) = frameT(1025:end, channel) .* sinWindowLong(1025:end)'; |
|
|
frameT(1025:end, :) = bsxfun(@times, frameT(1025:end, :), sinWindowLong(1025:end)'); |
|
|
else |
|
|
else |
|
|
error('filterbank, l[20]: Unsupported window type input!') |
|
|
error('filterbank, l[20]: Unsupported window type input!') |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
frameF(:, channel) = mdct4(frameT(:, channel)); |
|
|
frameF = mdct4(frameT); |
|
|
elseif strcmp(frameType, 'ESH') |
|
|
elseif strcmp(frameType, 'ESH') |
|
|
|
|
|
for channel = 1:2 |
|
|
% Splits the frame into sub-frames |
|
|
% Splits the frame into sub-frames |
|
|
[subFrames, ~] = buffer(frameT(449:end-448, channel), 256, 128, 'nodelay'); |
|
|
[subFrames, ~] = buffer(frameT(449:end-448, channel), 256, 128, 'nodelay'); |
|
|
|
|
|
|
|
@ -91,7 +92,8 @@ function frameF = filterbank(frameT, frameType, winType) |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
for subFrameIndex = 1:8 |
|
|
for subFrameIndex = 1:8 |
|
|
frameF((subFrameIndex - 1) * 128 + 1:subFrameIndex * 128, channel) = mdct4(subFrames(:, subFrameIndex)); |
|
|
frameF((subFrameIndex - 1) * 128 + 1:subFrameIndex * 128, channel) = ... |
|
|
|
|
|
mdct4(subFrames(:, subFrameIndex)); |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|