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

Function runMix

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

Run makeVocalInFullMix at a given ratio for N frames.

Source from the content-addressed store, hash-verified

845
846/// Run makeVocalInFullMix at a given ratio for N frames.
847inline FeatureSnapshot runMix(float ratio, int frames = 20) {
848 audio::detector::Vocal det;
849 det.setSampleRate(44100);
850 for (int i = 0; i < frames; ++i) {
851 auto sample = makeVocalInFullMix(ratio, i * 12);
852 auto ctx = fl::make_shared<audio::Context>(sample);
853 ctx->setSampleRate(44100);
854 ctx->getFFT(64);
855 det.update(ctx);
856 }
857 FeatureSnapshot s;
858 s.flatness = Diag::getSpectralFlatness(det);
859 s.formant = Diag::getFormantRatio(det);
860 s.presence = Diag::getVocalPresenceRatio(det);
861 s.density = Diag::getHarmonicDensity(det);
862 s.centroid = Diag::getSpectralCentroid(det)
863 / static_cast<float>(Diag::getNumBins(det));
864 s.rolloff = Diag::getSpectralRolloff(det);
865 s.jitter = Diag::getEnvelopeJitter(det);
866 s.acfIrreg = Diag::getAutocorrelationIrregularity(det);
867 s.zcCV = Diag::getZeroCrossingCV(det);
868 s.variance = Diag::getSpectralVariance(det);
869 s.confidence = det.getConfidence();
870 s.isVocal = det.isVocal();
871 return s;
872}
873
874/// Run makeFullBandMix at a given ratio for N frames.
875inline FeatureSnapshot runFullBandMix(float ratio, int frames = 20) {

Callers 1

vocal.hppFile · 0.85

Calls 6

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

Tested by

no test coverage detected