Commit Graph

334 Commits

Author SHA1 Message Date
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
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
b27686bd2b audioreactive small optimization
* clear vImag[] using memset
* zerocrossing detection: directly check sign bit
2024-04-10 12:34:32 +02:00
Frank
1ca7faf142 Merge branch 'mdev' into pr/124 2024-04-06 21:15:24 +02: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
Frank
c9c9f409f4 Merge branch 'pr/125' into pr/124 2024-04-04 23:53:59 +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
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
d9dceb64ed Attempt at adding zeroCrossingCount to audio-sync 2024-03-28 20:06:47 +00:00
Will Tatam
cce7d4c79e Cleanup 2024-03-28 19:57:42 +00:00
Will Tatam
9eabbf3789 Sync audio_rective changes from auto-playlist branch 2024-03-28 19:40:59 +00:00
Troy
9b8f0ba873 Bug fix with um_data length 2024-03-27 16:12:38 -04:00
Troy
58184a5a74 Moved calcs into usermod except zero crossings 2024-03-27 15:45:32 -04:00
Troy
cc01e38cad Comments added. 2024-03-25 12:15:31 -04:00
Troy
5ff44755d8 calculations based on normalized FFT results 2024-03-25 08:19:05 -04:00
Troy
2fe86bde5d Feature complete... and better! 2024-03-23 17:41:34 -04:00
Troy
8d687b3a86 Debugging 2024-03-23 10:10:09 -04:00
Troy
734ba39399 Fixes. Auto is too animated. 2024-03-23 09:29:32 -04:00
Will Tatam
9923a7a7d8 Swap to unsigned and pointers 2024-03-08 00:51:12 +00:00
Will Tatam
45d2ae7744 Clearer variable names 2024-03-07 19:21:03 +00:00
Will Tatam
6550504f60 Troy's extra data 2024-03-05 23:35:23 +00:00
Blaž Kristan
d484df0d06 Merge pull request #3732 from wled-install/patch-1
UM Audioreactive: add two compiler options
2024-02-12 22:02:04 +01:00
Troy
3c2feb82ed Settings to reject mic noise during line-in use. 2024-02-06 14:36:22 -05:00
Frank
2277d81699 AR sound sync bugfix
local samples were "sneaking in" when mode "receive or local" was receiving from network source.
2024-01-27 17:44:04 +01:00
Frank
14ab70dffe AR sound sync - document data offsets
The compiler has added gaps, to align our struct for hardware compatibility.

* made the gaps explicit
* added  `__attribute__ ((packed))`, to ensure that the data layout is the same on all platforms (extensa, risc-v, 8266)
2024-01-26 22:26:09 +01:00
Frank
b95a2094ce AR sound sync - make sequence checks user configurable
to support scenarios where several sending nodes are needed.
2023-12-30 19:50:07 +01:00
Frank
04136791b5 sound sync: shown "v2+" when framecounter is used
v2+ = improved format (MM fork only) including sequence frameCounter.
2023-12-18 10:44:05 +01:00
Frank
9024872f63 code spell checking - part3 (usermods)
if you can spell Fahrenheit, you can't spell Celsius. And vice versa :-)
2023-12-14 22:22:46 +01:00
Frank
4f30f69584 found a way to increase TCP stacksize (for AudioReactive UI)
we can use `-D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=xxxx` to increase the stack size of AsyncWebserver - default is 8196.
This should give us a bit of headroom for new UI items.

We still need PR #94 for more savings.
2023-12-12 00:43:48 +01:00
Frank
6cd9d80dbe small fixie for audioreactive (info page)
info page was not showing "AGC gain" when local mic was in use during "receive or local" mode.
2023-12-06 12:32:57 +01:00
Frank
d2fc1f7bf9 experimental: Souns Sync "receive or local" mode
new "Receive or Local" mode:
if UDP sound is missing or interrupted for too long, switch back to local audio input.
UDP sound resumes when a fresh packet is received again.

--> still needs testing, and even more regression testing.
2023-12-05 23:46:01 +01:00
Frank
e14d5e6975 sound sync: replace magic numbers with constants 2023-12-05 21:30:29 +01:00
Frank
7c68c14e63 FASTPATH: minimize UDP sound latency
The standard build is sending packets each 20ms, which means there are double packets (no new FFT results yet) and the max. delay between sampling and sending is up to 50ms.

* (FASTPATH only): FFT Task directly notifies UDP send when it has new data, reducing delays to the absolute minimum. this also optimizes UDP packets throughput, by avoiding duplicates.

* (FASTPATH only): receiver polling frequency is increased, to process new packets earlier (may increase CPU load)
2023-11-29 13:08:14 +01:00
Frank
38352c9d20 Sound Sync: prevent GEQ hickups and stalls
UDP transfers have some delays (measured between 2ms and 400ms). As consequence, FFT results sometimes "freeze" for a short time as no new data is arriving.
To hide these freezes, we apply the same "dynamics limiter" method as for volumeSmth.
2023-11-29 12:25:22 +01:00
Frank
1ac24439d4 AR: fastpath optimizations
Some optimizations in FASTPATH mode, to ensure that audio processing takes places as soon as new samples are arriving:
* raise fftTask prio to 4 (above async_tcp) - to ensure that other gimmicks (MQTT, IR, alexa, live preview (ws), json API, or web UI) cannot cause delays by preempting audio.
* changed the "be nice" condition in AR::loop
2023-11-27 15:56:38 +01:00
Frank
d3d08f813b sound sync: prevent sequence "roll-back" due to late packets (1->254)
this is to prevent that an "old" packet with high sequence number (before counter roll-over) gets accepted wrongly.
2023-11-16 10:55:43 +01:00
Frank
ec4bdf90af sound sync: better handling of framecounter roll-over 2023-11-15 16:21:03 +01:00
TroyHacks
3ba2fe4ee0 WM8978 support for PicoDSP, etc. 2023-10-20 01:23:10 -04:00
netmindz
5476a90a69 Merge pull request #76 from MoonModules/audio-sync-framecounter
Audio sync framecounter
2023-10-09 18:28:49 +01:00
Will Tatam
f99856e863 Log packet counters 2023-10-08 19:35:26 +01:00
Frank
9ff7f56eb8 fix for partly uninitialized sound sync packets (audioreactive)
audioSyncPacket contains four "invisible" padding bytes added by the compiler. These need to be initialized to zero, as future versions of the protocol will make use of these fields.
2023-10-08 20:23:31 +02:00
Will Tatam
3b5c95b5e0 Try adding frame counter to detect duplicate or out of order sync frames 2023-10-08 14:10:48 +01:00