Commit Graph

1189 Commits

Author SHA1 Message Date
Frank
61afb26d21 Update audio_reactive.h - fix compile error 2024-07-01 15:53:20 +02:00
Frank
2987f0d045 SR_STATS: filter time
adding "Filtering Time" to SR statistics (info page)
2024-07-01 15:46:51 +02:00
Frank
9803cecee2 new idea to reduce stack buffer usage
the JS string can be shortened, by putting the usermod into a variable `ux` that is used instead of repeating the string 'Aduioreactive'.

For now its just an experiment, to see if the idea works on several browsers.
2024-07-01 02:46:14 +02:00
Frank
f3cbe75506 remove support for old ArduinoFFT library < 1.9.2
there is no reason any more to still use the old arduinoFFT library version.
2024-07-01 02:39:44 +02:00
Frank
4f9f250a1d only run FFT.dcRemoval() when no filtering was applied
FFT.dcRemoval() may introduce unwanted artifacts into the FFT result.
2024-07-01 02:29:14 +02:00
Frank
f432cb20dc remove experiments:freqRMS option
the default value seems to work well.
2024-07-01 02:14:00 +02:00
Frank
c876267c95 Update audio_reactive.h - debug fix 2024-06-24 17:14:09 +02:00
Frank
899899094f sound sync: use last remaining gap to transmit soundPressure
* use last remaining two bytes in audioSyncPacket for transmitting soundPressure
* 0x0 is treated as "legacy value" --> soundPressure = volumeSmth;
* decodeAudioData: ensure receivedPacket struct members  are correctly aligned -
strictly speaking it is not safe to cast a uint8_t* as it does not offer any alignment guarantees.
* remove 8266 special handling in audioreactive::setup()
2024-06-24 17:01:43 +02:00
Will Tatam
827cdc2f5b AutoPlaylist - prevent swapping playlist after silence ended when Suspended 2024-05-26 13:47:52 +01:00
Frank
2144613423 compatibility with upstream arduinoFFT 2.x
its still recommended to use the softhack007 version - -> optimized for ESP32 boards, and  reduced memory footprint
 https://github.com/softhack007/arduinoFFT.git#develop @ 1.9.2
2024-05-11 13:57:49 +02:00
Frank
7b58727254 bugfix for sound sync - fftResult[] did not use 255
transmitData.fftResult[] and fftResult[] are both uint8, no need to constrain the value.
2024-05-08 21:39:38 +02:00
Frank
5a377103b5 small accuracy improvement
(int)currentResult is a truncation, so we need to add 0.5 for proper rounding.
also changed inefficient "constrain" into faster max(min( ...))
2024-05-08 21:04:07 +02:00
Frank
adf5afe84a include the GPLv3 permission statement in some MM-specific files
Please note that these statements are included for clarification purposes only.
WLED-MM specific source code is always provided under GPLv3, see LICENSE.
2024-05-08 12:52:07 +02:00
Frank
daec240c52 small improvement for athom music 2024-05-04 13:55:25 +02:00
Frank
ecf7acbc76 AR pin config: SCK == 1 --> PDM microphone 2024-05-04 13:36:56 +02:00
Frank
fc66dcc0ce squeezing a few KB out of builds that are close to 100% flash usage 2024-05-04 01:44:14 +02:00
Frank
714d4850af minor cleanup
* startup message from UM autoplaylist
* zeroCrossingCount added to sound simulation
* debug messages cleanup
2024-04-30 12:47:45 +02:00
Frank
3567243d18 small improvements for audioreactive
* added ESP_INTR_FLAG_IRAM to reduce lost samples (only on ESP32 without PSRAM) --> may cause crash if used wrongly
* FFT_MajorPeak stabilized, by ignoring extreme results
2024-04-28 18:52:19 +02:00
Frank
0f677c35f5 typo 2024-04-18 21:09:28 +02:00
Frank
7dc6659e70 audioreactive: better do DC removal after FFT.complexToMagnitude(); 2024-04-18 13:36:00 +02:00
Frank
0e0728b15d audioreactive: workaround for ArduinoFFT bug 93
This fix works around a problem that was solved in upstream ArduinoFFT 2.0.2
2024-04-18 12:57:29 +02:00
netmindz
0f79e9b7ff Merge pull request #124 from netmindz/auto-playlist
New Usermod - Auto Playlist
2024-04-16 22:38:56 +01:00
Frank
d42148d994 Info page optimizations
* reduce from 3 lines to two lines
* don't add to info when usermod is disabled in UM settings
* show current playlist id
2024-04-16 17:57:31 +02:00
Frank
acfbe890b3 suspend playlist engine while auto-change is active
* adding suspendPlaylist() to playlist engine code
* autoplaylist usermod calls suspendPlaylist() before switching to another preset
* fix a potential overflow on `lfc` (uint8_t -> uint16_t)
2024-04-16 13:25:21 +02:00
Troy
11315a81b5 unsigned wraparound prevention 2024-04-14 15:32:13 -04:00
Troy
dfab0ca402 Accepting more Softhack007 suggestings 2024-04-14 15:21:07 -04:00
Troy
af028b5890 Accepting some Softhack007 suggestions 2024-04-14 14:39:15 -04:00
Frank
6e24850073 ar_energy: improved energy reconstruction
fftResult[] is indended to look good on GEQ, and has a very "twisted" representation of FFT results only. This change improves reconstruction of signal energy, by on-doing some of the "GEQ enhancements" in fftResults[].
2024-04-10 18:56:23 +02:00
Frank
70bfbd5a43 ar_energy: fix a math error
fixing mis-optimized math when calculating energy.
energy = sum(amplitude^2). this is not the same as sum(amplitude)^2.

Example:
1+5+7 = 13; 13 * 13 = 169
1*1 + 5*5 + 7*7 = 75
2024-04-10 13:42:21 +02:00
Frank
b27686bd2b audioreactive small optimization
* clear vImag[] using memset
* zerocrossing detection: directly check sign bit
2024-04-10 12:34:32 +02:00
Frank
03cbc52c65 ar_energy small improvements
* use named constant instead of "100"
* make change_threshold_change more robust against negatives
* unloadPlaylist() before activating a new playlist
2024-04-09 19:23:28 +02:00
Frank
2a4810f437 autoplaylist filter improvements
* initialize slow and fast filters with current values (first call only) - reduces time for filter stabilization

* use slightly optimized variant of "rolling average" filter (result is exactly the same)
  --> replaced `xX = xX * (1-a) + newX * a;`  by  `xX = xX + a * (newX - Xx);`

* use constants for filter parameters (for tinkering and improved readability)
2024-04-07 21:31:53 +02:00
Frank
5186c0fdb6 autoplaylist bugfix for playlists with only one preset
* prevent infinite loop in case that there is only one preset in a playlist
* fixing two typos
2024-04-07 21:23:01 +02:00
Frank
1ca7faf142 Merge branch 'mdev' into pr/124 2024-04-06 21:15:24 +02:00
Troy
02b464f283 Smoothing sound detection 2024-04-05 15:45:21 -04:00
Troy
f9eb6d2300 functionality_enabled logic 2024-04-05 12:04:39 -04:00
Troy
abc811484d Added new internal functionality enabled tracking 2024-04-05 11:31:08 -04:00
Frank
bf6932ecb7 ar_energy: reduced zeroCrossingCount magnitude by 1/3
zero crossing counter is often larger than in the prototype by @troyhacks - due to calculation after filtering (catches more crossings), and due to the fixed condition for detecting zero crossings (doubles the number of crossings).

This patch reduces the final value to 2/3, so it typically stays below 256.
2024-04-05 14:57:55 +02:00
Troy
39f7a2e187 Removed button, bettr Info pane, debug flag. 2024-04-04 21:32:26 -04:00
Frank
b72e402a2d bugfixing
* make filters work (requires float instead of integer)
* avoid "expression propagation to double" by using float constants
* use unsigned long for all variables that depend on millis()
2024-04-05 00:31:14 +02:00
Frank
c9c9f409f4 Merge branch 'pr/125' into pr/124 2024-04-04 23:53:59 +02:00
Frank
f6fa2232e5 Merge branch 'mdev' into pr/124 2024-04-04 23:53:34 +02:00
Frank
33b46b820f optimizations and bugfixing
* calculate zero crossings after filtering out DC offsets
* update effect variable only once
* fix a logic error when detecting zero crossings
* fix array bounds violation when creating umdata entries
2024-04-04 23:52:31 +02:00
Frank
4efdb2457e Merge branch 'mdev' into pr/125 2024-04-04 23:01:34 +02:00
Troy
c3bf851613 Higher possible change threshold 2024-03-30 15:09:59 -04:00
Troy
1f659aa1bf "Enabled" mostly working 2024-03-30 12:54:28 -04:00
Troy
c36adbdad0 Button added to Info panel. Logic needs work. 2024-03-30 12:30:32 -04:00
Troy
04a8681f71 WM8978 fix for IDF below 4.2.0 2024-03-30 11:09:14 -04:00
Will Tatam
ebab56ada5 Update logger 2024-03-29 13:39:09 +00:00
Will Tatam
1e934d3426 Prevent crash trying to load playlist -1 2024-03-29 12:47:51 +00:00