Run makeFullBandMix at a given ratio for N frames.
| 873 | |
| 874 | /// Run makeFullBandMix at a given ratio for N frames. |
| 875 | inline 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 |
no test coverage detected