--------------------------------------------------------------------------- Human-readable report ---------------------------------------------------------------------------
| 293 | // Human-readable report |
| 294 | // --------------------------------------------------------------------------- |
| 295 | static void emitReport(int samples, int bands, float fmin, float fmax, |
| 296 | int sampleRate, int numSteps) { |
| 297 | float nyquist = static_cast<float>(sampleRate) / 2.0f; |
| 298 | |
| 299 | fl::printf("===========================================================\n"); |
| 300 | fl::printf(" Pitch Sweep Aliasing Test\n"); |
| 301 | fl::printf("===========================================================\n"); |
| 302 | fl::printf(" Samples: %d Bands: %d Rate: %d Hz\n", samples, bands, |
| 303 | sampleRate); |
| 304 | fl::printf(" Freq range: %.1f - %.1f Hz (Nyquist: %.1f Hz)\n", fmin, |
| 305 | fmax, nyquist); |
| 306 | fl::printf(" Sweep steps: %d (log-spaced, fmin to Nyquist)\n", numSteps); |
| 307 | fl::printf("===========================================================\n"); |
| 308 | |
| 309 | fl::vector<SweepPoint> points; |
| 310 | |
| 311 | // --- In-band section --- |
| 312 | fl::printf("\n --- IN-BAND (%.0f - %.0f Hz) ---\n\n", fmin, fmax); |
| 313 | fl::printf("%-12s %-16s %5s %5s %8s %8s\n", "Mode", "Window", "Alias", |
| 314 | "!Mon", "MinConc", "AvgConc"); |
| 315 | fl::printf( |
| 316 | "-----------------------------------------------------------\n"); |
| 317 | |
| 318 | for (int m = 0; m < NUM_MODES; m++) { |
| 319 | for (int w = 0; w < NUM_WINDOWS; w++) { |
| 320 | runSweep(MODES[m].mode, WINDOWS[w].window, samples, bands, fmin, |
| 321 | fmax, sampleRate, numSteps, points); |
| 322 | SweepSummary s = computeSummary(points, true); |
| 323 | fl::printf("%-12s %-16s %5d %5d %7.1f%% %7.1f%%\n", |
| 324 | MODES[m].label, WINDOWS[w].label, s.aliasingEvents, |
| 325 | s.nonMonotonicEvents, s.minConcentration * 100.0f, |
| 326 | s.avgConcentration * 100.0f); |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | // --- Out-of-band section --- |
| 331 | fl::printf("\n --- OUT-OF-BAND (%.0f - %.0f Hz) ---\n\n", fmax, nyquist); |
| 332 | fl::printf("%-12s %-16s %5s %5s %8s %8s\n", "Mode", "Window", "Alias", |
| 333 | "!Mon", "MinConc", "AvgConc"); |
| 334 | fl::printf( |
| 335 | "-----------------------------------------------------------\n"); |
| 336 | |
| 337 | for (int m = 0; m < NUM_MODES; m++) { |
| 338 | for (int w = 0; w < NUM_WINDOWS; w++) { |
| 339 | runSweep(MODES[m].mode, WINDOWS[w].window, samples, bands, fmin, |
| 340 | fmax, sampleRate, numSteps, points); |
| 341 | SweepSummary s = computeSummary(points, false); |
| 342 | fl::printf("%-12s %-16s %5d %5d %7.1f%% %7.1f%%\n", |
| 343 | MODES[m].label, WINDOWS[w].label, s.aliasingEvents, |
| 344 | s.nonMonotonicEvents, s.minConcentration * 100.0f, |
| 345 | s.avgConcentration * 100.0f); |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | fl::printf("\n Alias = peak freq dropped >20%% vs previous step\n"); |
| 350 | fl::printf(" !Mon = non-monotonic peak bin progression\n"); |
| 351 | fl::printf(" Conc = energy concentration in peak +/- 1 bins\n"); |
| 352 | fl::printf("\n"); |
no test coverage detected