本文整理汇总了C++中Signal::samplingFrequency方法的典型用法代码示例。如果您正苦于以下问题:C++ Signal::samplingFrequency方法的具体用法?C++ Signal::samplingFrequency怎么用?C++ Signal::samplingFrequency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Signal
的用法示例。
在下文中一共展示了Signal::samplingFrequency方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decimatedSpectrum
Contour<float> DioF0Estimator::estimate(const Signal &signal, double msFramePeriod)
{
int decimationRatio = qMax(1, qMin(12, (int)(signal.samplingFrequency() / decimatedFs)));
int decimatedLength = 1 + signal.size() / decimationRatio;
fft = new Fft(Fft::suitableLength(decimatedLength), Fft::Real);
Spectrum decimatedSpectrum(createDecimatedSpectrum(signal, decimationRatio));
Contour<float> result(estimate(decimatedSpectrum, signal.size(), signal.samplingFrequency(), msFramePeriod));
delete fft;
return result;
}
示例2: Spectrum
DioF0Estimator::Spectrum DioF0Estimator::createDecimatedSpectrum(const Signal &signal, int decimationRatio)
{
int decimatedLength = 1 + signal.size() / decimationRatio;
int fftLength = fft->fftLength;
double *decimatedWave = new double[fftLength];
Decimator::decimate(signal, decimationRatio, decimatedWave, decimatedLength);
double mean = 0.0;
for(int i = 0; i < decimatedLength; i++)
{
mean += decimatedWave[i];
}
mean /= decimatedLength;
for(int i = 0; i < decimatedLength; i++)
{
decimatedWave[i] -= mean;
}
for(int i = decimatedLength; i < fftLength; i++)
{
decimatedWave[i] = 0.0;
}
fft->execute(Fft::Forward, decimatedWave);
return Spectrum(decimatedWave, decimatedLength, fftLength, (double)signal.samplingFrequency() / decimationRatio);
}