Slightly improve the Hann windows

There's no need to include the 0 terms on the ends since they'll never
contribute a sample. So extend the width to have the 0 terms just outside the
window where it wouldn't contribute anyway.
This commit is contained in:
Chris Robinson
2020-05-08 01:25:32 -07:00
parent 301f8f5db5
commit 48fbad9836
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -50,8 +50,8 @@ std::array<double,HIL_SIZE> InitHannWindow()
/* Create lookup table of the Hann window for the desired size, i.e. HIL_SIZE */
for(size_t i{0};i < HIL_SIZE>>1;i++)
{
constexpr double scale{al::MathDefs<double>::Pi() / double{HIL_SIZE-1}};
const double val{std::sin(static_cast<double>(i) * scale)};
constexpr double scale{al::MathDefs<double>::Pi() / double{HIL_SIZE}};
const double val{std::sin(static_cast<double>(i+1) * scale)};
ret[i] = ret[HIL_SIZE-1-i] = val * val;
}
return ret;
+2 -2
View File
@@ -56,8 +56,8 @@ std::array<double,STFT_SIZE> InitHannWindow()
/* Create lookup table of the Hann window for the desired size, i.e. STFT_SIZE */
for(size_t i{0};i < STFT_SIZE>>1;i++)
{
constexpr double scale{al::MathDefs<double>::Pi() / double{STFT_SIZE-1}};
const double val{std::sin(static_cast<double>(i) * scale)};
constexpr double scale{al::MathDefs<double>::Pi() / double{STFT_SIZE}};
const double val{std::sin(static_cast<double>(i+1) * scale)};
ret[i] = ret[STFT_SIZE-1-i] = val * val;
}
return ret;