MCPcopy Create free account
hub / github.com/davy7125/polyphone / EQ

Method EQ

sources/core/sample/sampleutils.cpp:311–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309}
310
311QVector<float> SampleUtils::EQ(QVector<float> vData, quint32 dwSmplRate, QVector<int> eqGains)
312{
313 quint32 size;
314
315 // Conversion de baData en complexes
316 Complex * cpxData;
317 cpxData = fromFloatToComplex(vData, size);
318
319 // Calculer la fft du signal
320 Complex * fc_sortie_fft = FFT(cpxData, size);
321 delete [] cpxData;
322 // Filtrage
323 double freq;
324 double gain;
325 for (unsigned long i = 0; i < (size + 1) / 2; i++)
326 {
327 freq = static_cast<double>(i * dwSmplRate) / (size - 1);
328 gain = gainEQ(freq, eqGains);
329 fc_sortie_fft[i] *= gain;
330 fc_sortie_fft[size - 1 - i] *= gain;
331 }
332
333 // Calculer l'ifft du signal
334 cpxData = IFFT(fc_sortie_fft, size);
335 delete [] fc_sortie_fft;
336
337 // Prise en compte du facteur d'echelle
338 for (unsigned long i = 0; i < size; i++)
339 cpxData[i].real(cpxData[i].real() / size);
340
341 // Retour en QByteArray
342 QVector<float> vRet = fromComplexToFloat(cpxData, vData.size());
343 delete [] cpxData;
344 return vRet;
345}
346
347Complex * SampleUtils::FFT(Complex * x, quint32 N)
348{

Callers

nothing calls this directly

Calls 2

realMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected