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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user