"Shifts" the frequency-domain envelope of the input signal. typically used for formant preservation. Tuned to work best with voice.
70{
71 assert(factor > 0);
73 return;
74
75 const auto fftSize =
mFft->getSize();
76 const auto numBins = fftSize / 2 + 1;
77
79
80
81
83 const float normalizer =
FastLog2(fftSize);
84 std::transform(powSpec, powSpec + numBins, pEnv, [&](
float power) {
86 });
87
88
92
93
95 if (binCutoff < fftSize / 2)
96 std::fill(pCepst + binCutoff + 1, pCepst + fftSize - binCutoff, 0.f);
97 mLogger.
Log(pCepst, fftSize,
"cepstrumLiftered");
98
99
101 std::transform(
103 [fftSize = fftSize](const std::complex<float>& env) {
104 return std::exp2(env.real() / fftSize);
105 });
107
108
109
110 std::transform(
112 [](float env) { return std::isnormal(env) ? 1.f / env : 0.f; });
113
114 const auto lastNonZeroedBin =
116
118 std::transform(
120 mWeights.begin(), [](
float env,
float weight) {
121
122
123
124
125 return std::min(env * weight, 100.f);
126 });
127
128
129
130
131
132
133
134
136
138
140 spec, numBins, "magnitude",
141 [fftSize = fftSize](const std::complex<float>& spec) {
142 return std::abs(spec) / fftSize;
143 });
144
145
146 std::transform(
147 spec, spec + numBins,
mWeights.begin(), spec,
148 std::multiplies<std::complex<float>>());
149
151 spec, numBins, "weightedMagnitude",
152 [fftSize = fftSize](const std::complex<float>& spec) {
153 return std::abs(spec) / fftSize;
154 });
155
157}
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