Regler „Effekt“: ein Parameter je Effekt (Tempo, Farbe, Empfindlichkeit, …)

- Tempo (66 Effekte): eigene Effekt-Uhr 0,25- bis 4-mal so schnell; bei
  mehr Tempo mehrere Rechenschritte pro Bild (aufwändige Effekte nur
  einer), bei weniger nicht in jedem Bild
- Farbe (Blitzlicht, Blaulicht, Geschenk, Fraktalwolken, Lampe): Farbton
  des fertigen Bilds drehen
- Empfindlichkeit (Musik): Pegel und Spektrum verstärken, Beat-Schwelle
- Eigene: Gewitter Blitze, Feuer Hitze, Regen Stärke, Schnee Dichte,
  Weihnachtsbaum Kugelfarbe
- Mitte 128 = ursprünglicher Effekt; Wert je Effekt im Flash
- API: param in /api/state, Parametername in /api/effects
- App: Regler „Effekt“ unter der Helligkeit (Titel antippen = Mitte),
  Schalter in einer Zeile, „Alle Kategorien“ heißt jetzt „Zufällig“

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mikeandClaude Opus 5.5 committed 2026-11-17 15:57:13 +01:00
1 parent a1dc881fb1
commit a8fee0e960
15 files changed
+278 -73

No files matched your search

+6 -3
View File
@@ -24,6 +24,8 @@ uint32_t lastClap = 0;
bool clapPending = false;
float loudness = 0;
float audioSensitivity = 1; // Regler "Empfindlichkeit" der Musik-Effekte, 0,25..4
float bassLow = 0; // Tiefpass (~150 Hz) für die Beat-Erkennung
float bassAvg = 0; // mittlere Bass-Energie der letzten ~0,4 s
uint32_t lastBeat = 0;
@@ -125,9 +127,10 @@ void audioUpdate(uint32_t now) {
// Mit Musik abgestimmt: klarer Kick (123 BPM) 48 von 50 Schlägen getroffen.
float bass = sqrtf(bassEnergy / n);
if (bassAvg == 0) bassAvg = bass;
bool bassLoud = bassRange(20 * log10f(bass + 1)) > 0.3f;
bool bassLoud = bassRange(20 * log10f(bass + 1)) > 0.3f / audioSensitivity;
uint32_t sinceBeat = now - lastBeat;
float threshold = sinceBeat < 400 ? 2.0f : max(1.4f, 2.0f - (sinceBeat - 400) * 0.0015f);
threshold = max(1.15f, threshold / sqrtf(audioSensitivity)); // empfindlicher = niedrigere Schwelle
if (bass > bassAvg * threshold && bassLoud && sinceBeat > 250) {
lastBeat = now;
beatPending = true;
@@ -152,7 +155,7 @@ bool audioClap() {
}
float audioLevel() {
return max(loudness, 0.0f);
return min(1.0f, max(loudness, 0.0f) * audioSensitivity);
}
void audioSpectrum(float bands[CUBE_SIZE]) {
@@ -173,6 +176,6 @@ void audioSpectrum(float bands[CUBE_SIZE]) {
for (uint8_t k = BAND_EDGES[b]; k < BAND_EDGES[b + 1]; k++) sum += re[k];
float v = bandRange[b](20 * log10f(sum + 1));
shown[b] = v > shown[b] ? v : max(shown[b] - 0.04f, 0.0f); // Säulen fallen langsam
bands[b] = shown[b];
bands[b] = min(1.0f, shown[b] * audioSensitivity);
}
}