// Generate MinBLEP And Return It In An Array Of Floating Point Values float *GenerateMinBLEP(int zeroCrossings, int overSampling) { int i, n; float r, a, b; float *buffer1, *buffer2, *minBLEP; n = (zeroCrossings * 2 * overSampling) + 1; buffer1 = new float[n]; buffer2 = new float[n]; // Generate Sinc a = (float)-zeroCrossings; b = (float)zeroCrossings; for(i = 0; i < n; i++) { r = ((float)i) / ((float)(n - 1)); buffer1[i] = SINC(a + (r * (b - a))); } // Window Sinc BlackmanWindow(n, buffer2); for(i = 0; i < n; i++) buffer1[i] *= buffer2[i]; // Minimum Phase Reconstruction RealCepstrum(n, buffer1, buffer2); MinimumPhase(n, buffer2, buffer1); // Integrate Into MinBLEP minBLEP = new float[n]; a = 0.0f; for(i = 0; i < n; i++) { a += buffer1[i]; minBLEP[i] = a; } // Normalize a = minBLEP[n - 1]; a = 1.0f / a; for(i = 0; i < n; i++) minBLEP[i] *= a; delete buffer1; delete buffer2; return minBLEP; }
static void RDFtoRP(const Curve &rdf, int npoints, Curve *rp) { const float wstep = 1.f / sqrtf(npoints); Curve tmp(rdf); for (int i = 0; i < rp->size(); ++i) { const float u0 = rp->ToX(i); const float u = TWOPI * u0; const float wndsize = rdf.x1 * std::min(0.5f, std::max(0.2f, 4.f * u0 * wstep)); for (int j = 0; j < tmp.size(); ++j) { float x = rdf.ToX(j); float wnd = BlackmanWindow(x, wndsize); tmp[j] = (rdf[j] - 1) * j0f(u*x) * x * wnd; } (*rp)[i] = fabsf(1.f + TWOPI * Integrate(tmp) * npoints); } }
std::vector<double> testHighBlack(SignalData::Samples& data, unsigned int order, double cutoff) { SignalData::Ptr sig = SignalData::create(data, TEST_SAMPLING_FREQ); testHigh(sig, order, cutoff, BlackmanWindow(order*2+1)); return sig->data(); }