MCPcopy Create free account
hub / github.com/FastLED/FastLED / runFullBandMix

Function runFullBandMix

tests/fl/audio/detector/vocal.hpp:875–900  ·  view source on GitHub ↗

Run makeFullBandMix at a given ratio for N frames.

Source from the content-addressed store, hash-verified

873
874/// Run makeFullBandMix at a given ratio for N frames.
875inline FeatureSnapshot runFullBandMix(float ratio, int frames = 20) {
876 audio::detector::Vocal det;
877 det.setSampleRate(44100);
878 for (int i = 0; i < frames; ++i) {
879 auto sample = makeFullBandMix(ratio, i * 12);
880 auto ctx = fl::make_shared<audio::Context>(sample);
881 ctx->setSampleRate(44100);
882 ctx->getFFT(64);
883 det.update(ctx);
884 }
885 FeatureSnapshot s;
886 s.flatness = Diag::getSpectralFlatness(det);
887 s.formant = Diag::getFormantRatio(det);
888 s.presence = Diag::getVocalPresenceRatio(det);
889 s.density = Diag::getHarmonicDensity(det);
890 s.centroid = Diag::getSpectralCentroid(det)
891 / static_cast<float>(Diag::getNumBins(det));
892 s.rolloff = Diag::getSpectralRolloff(det);
893 s.jitter = Diag::getEnvelopeJitter(det);
894 s.acfIrreg = Diag::getAutocorrelationIrregularity(det);
895 s.zcCV = Diag::getZeroCrossingCV(det);
896 s.variance = Diag::getSpectralVariance(det);
897 s.confidence = det.getConfidence();
898 s.isVocal = det.isVocal();
899 return s;
900}
901
902} // namespace test_vocal
903

Callers 1

vocal.hppFile · 0.85

Calls 6

makeFullBandMixFunction · 0.85
getFFTMethod · 0.80
isVocalMethod · 0.80
setSampleRateMethod · 0.45
updateMethod · 0.45
getConfidenceMethod · 0.45

Tested by

no test coverage detected