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

Function runSignal

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

Source from the content-addressed store, hash-verified

817};
818
819inline FeatureSnapshot runSignal(audio::Sample (*gen)(fl::u32), int frames = 15) {
820 audio::detector::Vocal det;
821 det.setSampleRate(44100);
822 for (int i = 0; i < frames; ++i) {
823 auto sample = gen(i * 12);
824 auto ctx = fl::make_shared<audio::Context>(sample);
825 ctx->setSampleRate(44100);
826 ctx->getFFT(64);
827 det.update(ctx);
828 }
829 FeatureSnapshot s;
830 s.flatness = Diag::getSpectralFlatness(det);
831 s.formant = Diag::getFormantRatio(det);
832 s.presence = Diag::getVocalPresenceRatio(det);
833 s.density = Diag::getHarmonicDensity(det);
834 s.centroid = Diag::getSpectralCentroid(det)
835 / static_cast<float>(Diag::getNumBins(det));
836 s.rolloff = Diag::getSpectralRolloff(det);
837 s.jitter = Diag::getEnvelopeJitter(det);
838 s.acfIrreg = Diag::getAutocorrelationIrregularity(det);
839 s.zcCV = Diag::getZeroCrossingCV(det);
840 s.variance = Diag::getSpectralVariance(det);
841 s.confidence = det.getConfidence();
842 s.isVocal = det.isVocal();
843 return s;
844}
845
846/// Run makeVocalInFullMix at a given ratio for N frames.
847inline FeatureSnapshot runMix(float ratio, int frames = 20) {

Callers 1

vocal.hppFile · 0.85

Calls 5

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

Tested by

no test coverage detected