Adaptive normalization & stability for audio features

Improves audio analysis by introducing adaptive normalization and per-mode sensitivity profiles for spectrum, level, and band features. Adds temporal stability to note and chord detection, reducing jitter and false positives. Enhances note detection and visual feedback for whistling frequencies (800 Hz–5 kHz). These changes make both analysis and visualization more robust and responsive to varying input conditions.
This commit is contained in:
Michal Vrba
2026-02-13 21:01:09 +01:00
parent 2d535addd0
commit 488e3c64a3
2 changed files with 223 additions and 13 deletions
+13 -1
View File
@@ -1204,7 +1204,8 @@ public sealed class FractalRenderer : IDisposable
}
}
float spawnRate = features.DetectedNoteStrength * (0.3f + Clamp01(features.Beat) * 1.3f);
float whistleBoost = GetWhistleSpawnBoost(features.DominantFrequencyHz);
float spawnRate = features.DetectedNoteStrength * (0.9f + whistleBoost * 1.7f + Clamp01(features.Beat) * 0.35f);
_detectedNoteAccumulator += spawnRate * _runtimePerformanceScale;
while (_detectedNoteAccumulator >= 1f)
{
@@ -1231,6 +1232,17 @@ public sealed class FractalRenderer : IDisposable
}
}
private static float GetWhistleSpawnBoost(float frequencyHz)
{
if (frequencyHz < 800f || frequencyHz > 5000f)
{
return 0f;
}
float norm = (frequencyHz - 800f) / (5000f - 800f);
return Clamp01(norm);
}
private void RenderChordCenter(AudioFeatures features, float timeSeconds)
{
for (int y = 0; y < _internalHeight; y++)