MCPcopy Create free account
hub / github.com/LabSound/LabSound / addConstantGroupDelay

Method addConstantGroupDelay

src/internal/src/FFTFrame.cpp:205–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205void FFTFrame::addConstantGroupDelay(double sampleFrameDelay)
206{
207 int halfSize = fftSize() / 2;
208
209 float * realP = realData();
210 float * imagP = imagData();
211
212 const double kSamplePhaseDelay = (2.0 * static_cast<double>(LAB_PI)) / double(fftSize());
213
214 double phaseAdj = -sampleFrameDelay * kSamplePhaseDelay;
215
216 // Add constant group delay
217 for (int i = 1; i < halfSize; i++)
218 {
219 Complex c(realP[i], imagP[i]);
220 double mag = abs(c);
221 double phase = arg(c);
222
223 phase += i * phaseAdj;
224
225 Complex c2 = std::polar(mag, phase);
226
227 realP[i] = static_cast<float>(c2.real());
228 imagP[i] = static_cast<float>(c2.imag());
229 }
230}
231
232#ifndef NDEBUG
233void FFTFrame::print()

Callers 1

createImpulseResponseMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected