本文整理汇总了C++中Samples::getNumberOfSamples方法的典型用法代码示例。如果您正苦于以下问题:C++ Samples::getNumberOfSamples方法的具体用法?C++ Samples::getNumberOfSamples怎么用?C++ Samples::getNumberOfSamples使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Samples
的用法示例。
在下文中一共展示了Samples::getNumberOfSamples方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawSpectogram
void drawSpectogram(Samples& samples, const char * file) {
uint16_t samplesInFrame = static_cast<uint16_t>(std::ceil(samples.getNumberOfSamples() / MfccProperty::MAX_FRAME));
Aquila::FramesCollection frames = Aquila::FramesCollection(samples, samplesInFrame,
static_cast<unsigned int>(std::round(0.2 * samplesInFrame)));
std::cout << "samples per frame "<< frames.getSamplesPerFrame();
Aquila::Spectrogram spectrogram{frames};
size_t w = 800;
size_t h = 600;
std::cout << " w = " << w << " h = " << h << std::endl;
cimg_library::CImg<unsigned char> simg{static_cast<unsigned int>(800), static_cast<unsigned int>(600), 1, 2, 0};
for (std::size_t x = 0; x < spectrogram.getFrameCount(); ++x) {
// output only half of the spectrogram, below Nyquist frequency
for (std::size_t y = h/2; y < h ; ++y) {
Aquila::ComplexType point = spectrogram.getPoint(x, y);
unsigned char color[] = {0, 0, 0};
double value = point.real() * point.real() + point.imag() * point.imag();
value = 0.5 * std::log10(value + 1);
std::cout << "value = " << value << std::endl;
getColor(value, color);
// color[0] = (unsigned char) (125 + sDb);
// color[1] = (unsigned char) (125 + sDb);
// color[2] = (unsigned char) (125 + sDb);
simg.draw_point(x, y, 0, color);
}
}
simg.save_jpeg(file);
}