MoonModules / WLED

Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi! MoonModules adds features on top of upstream.
https://mm.kno.wled.ge
European Union Public License 1.2
228 stars 70 forks source link

(audio feature) detect frozen / stuck input signal #62

Open softhack007 opened 1 year ago

softhack007 commented 1 year ago

development note for a future feature

Is your feature request related to a problem? Please describe.

To help diagnose wrong configuration, it would be useful to make a difference between "silence" (some signal but below thresholds) and "frozen" signal (constantly at the same value for long time).

Describe the solution you'd like

Implementation should be straight forward, with some potential for optimizations as we only need to consider "sample batches" that are all at the same value.

Additional context

I2S is basically single-direction from programming perspective, so you set pins, then start reading values. There is no feedback available about bad configuration, for example missing/broken MCLK signal.

Thanks @netmindz and a few other discord users who suggested a detection scheme for "frozen" signals.

At the moment it feels like there are too many failure possibilities that all just result in the info page saying silence. For example, you can set the wrong pin for master clock and just get Silence, when surely without clock we are getting no meaningful data at all, so reading the same sample value all the time?

dosipod commented 1 year ago

Great idea and for sure will eliminate some of the guess work . I do hope you could also consider analog as that would be helpful for line-in as some are still on the DIY listed in the wiki ( works really well when it does )

netmindz commented 1 year ago

It would not be possible to do this for analog @dosipod as the value read this way will never be exactly 0 or freeze if a connection comes loose.

The idea here was to help uses get better feedback when trying to wire up I2S devices, but using the wrong pins etc. Better to indicate some form of error rather than just say "silence"