"Shifts" the frequency-domain envelope of the input signal. typically used for formant preservation. Tuned to work best with voice.
69{
70 assert(factor > 0);
72 return;
73
74 const auto fftSize =
mFft->getSize();
75 const auto numBins = fftSize / 2 + 1;
76
78
79
80
82 const float normalizer =
FastLog2(fftSize);
83 std::transform(powSpec, powSpec + numBins, pEnv, [&](
float power) {
85 });
86
87
91
92
94 if (binCutoff < fftSize / 2)
95 std::fill(pCepst + binCutoff + 1, pCepst + fftSize - binCutoff, 0.f);
96 mLogger.
Log(pCepst, fftSize,
"cepstrumLiftered");
97
98
100 std::transform(
102 [fftSize = fftSize](const std::complex<float>& env) {
103 return std::exp2(env.real() / fftSize);
104 });
106
107
108
109 std::transform(
111 [](float env) { return std::isnormal(env) ? 1.f / env : 0.f; });
112
113 const auto lastNonZeroedBin =
115
117 std::transform(
119 mWeights.begin(), [](
float env,
float weight) {
120
121
122
123
124 return std::min(env * weight, 100.f);
125 });
126
127
128
129
130
131
132
133
135
137
139 spec, numBins, "magnitude",
140 [fftSize = fftSize](const std::complex<float>& spec) {
141 return std::abs(spec) / fftSize;
142 });
143
144
145 std::transform(
146 spec, spec + numBins,
mWeights.begin(), spec,
147 std::multiplies<std::complex<float>>());
148
150 spec, numBins, "weightedMagnitude",
151 [fftSize = fftSize](const std::complex<float>& spec) {
152 return std::abs(spec) / fftSize;
153 });
154
156}
constexpr float FastLog2(float x)
Approximates the base-2 logarithm of a float to two decimal places, adapted from https://stackoverflo...
T * getPtr(int32_t channel)
constexpr fastfloat_really_inline int32_t power(int32_t q) noexcept