Commit Graph

116 Commits

Author SHA1 Message Date
Christian Patterson
9e155cf94a Fix ES8388Source & ES7243 initialization.
Update ES8388Source::initialize and ES7243::initialize method signatures to match I2SSource::initialize so that when initialize is called on a AudioSource pointer the child class's method is used.
2023-09-17 14:12:20 -05:00
Frank
282d58a6fe
audioreactive: stack size tuning
This gives ~3KB extra free heap on -S2.
2023-09-14 18:26:57 +02:00
Frank
e9723de6c3 minor updates for audioreactive
* remove "not supported" warning on -S2
* minor tweaking of beat detector
* optimized parameters for arduinoFFT
* fixed a few implicit "double" promotions
* minor UDP protocol optimizations
* small optimization for fft task create / suspend
* completely remove analogmic settings for -S3/-S2/-C3 where analog is not supported

changes were already tested extensively in the MM fork.
2023-09-09 21:07:20 +02:00
Will Tatam
7d4fe341f1 Remove direct setup for I2C from ES8388 driver 2023-07-18 17:21:45 +01:00
Will Tatam
76acb7bb58 Merge branch 'main' into AC-ES8388 2023-07-18 16:36:42 +01:00
Will Tatam
63df85f7f9 AC lacks i2sMaster param to I2SSource 2023-06-19 13:33:46 +01:00
Will Tatam
b29611509e AC lacks ERRORSR_PRINTLN 2023-06-19 13:33:16 +01:00
Will Tatam
dd1cf0ec56 AC lacks ERRORSR_PRINTF 2023-06-19 13:27:54 +01:00
Blaz Kristan
82e448de7c Beta-3 changes
- remove I2C init  from usermods
- PCF8574 (&co) port expander support
- refactor PIR &  Rotary encoder & 4LD
- reboot race condition
- optimisations
2023-05-30 19:36:14 +02:00
TroyHacks
9831e7bc3b Warnings about AudioKit rubbish 2023-05-23 23:49:57 +01:00
TroyHacks
90e37439e5 Better ES8388 init and mic support 2023-05-23 23:49:40 +01:00
TroyHacks
65f2490e89 It's offically the LyraT, not Lyra-T. 2023-05-23 23:49:29 +01:00
TroyHacks
c14a921e5a Mic settings for ES8388. Also ALC, pass-thru, etc. 2023-05-23 23:49:14 +01:00
TroyHacks
2bc8ffefce Some fixes for LyraT and also better inits/docs 2023-05-23 23:46:37 +01:00
TroyHacks
b88d8c85cb ES8388 init optimizations and fixes 2023-05-23 23:42:01 +01:00
Ewoud
693f52d984 Merge pull request #5 from netmindz/ES8388
WiP - ES8388
2023-05-23 23:41:46 +01:00
srg74
8caeddde15
Spelling check by @wthomson (#2940)
A lot of spelling corrections. Now repo will sound like educated person :)

Co-authored-by: Bill Thomson <bt@kattt.org>
2022-12-10 16:12:55 +01:00
Blaž Kristan
9f1a7a1c20 Swap info. 2022-11-29 15:02:56 +01:00
Frank
98138a02e3
audioreactive usermod update (align with MoonMod code) (#2907)
* audioreactive driver update

- Better handling of PDM and I2S Line-in
- Bugfixes for ES7243 (allocateMultiplePins)
- More error messages for ES7243
- sample scaling (needed for sources that use full scale of samples)

* audiorective update

* align SR_DEBUG with WLED_DEBUG
* optional bandpass filter (needed for PDM mics)
* sample scaling for PDM and Line-In
* small improvements for analog input
* bugfixes and small performance improvements
* code for FFT task refactored, for better readablity. Introduces separate functions for filtering and post-processing
* small improvement for beat detection
* default mic settings can be configured at compile time
* correct mic type if MCU does not support PDM or ADC
* hide analog PIN config if not supported by MCU

* audioreactive updates

- minor updates to source code (see discussion in PR #2907)
- usermod readme improvements

* small readme update

* one think I overlooked

* ok, another edit. Now its final. Hopefully.

* small upps

wrong parameter order in debug message.
2022-11-28 20:52:33 +01:00
Ewoud
78e9f5bd1a
Clean up UserMod settings: grouping of variables and add preInfo to variables (#2894)
* Grouping um settings, add pre and post Info, update  SR & 4LD settings

Settings_um.htm: 
- modify addField (grouping)
- addInfo (pre and post texts)

Add preInfo to audio reactive and 4ld usermod

Extra:
platformio: wemos_shield: add audio reactive usermod and update to alt display

* um settings: cpp: lowercase, js: initcap

* um settings: txt only pre, txt2 only post and initCap as function

* Fix rotary encoder info string

Co-authored-by: Blaž Kristan <blaz@kristan-sp.si>
2022-11-26 03:44:04 +01:00
Frank
ba0bc31525 UDP sound sync: added decoder for legacy packets
support decoding of sound sync data from SR version > 0.13.0
2022-10-21 12:12:02 +02:00
Frank
64441b39ac critical bugfix
it's possible that volume samples become negative. In this scenario, our simple noise gate does stupid things, and it looks like "effects temporarily lost the sound".
This fix improves the situation, and makes sure that volume samples are always >= 0.
2022-10-06 15:39:28 +02:00
Frank
1ae0dd574d fix for ADC analog
the "wait until I2S buffer fills" trick does not work for ADC sources, as the I2S sampling does not run in background for ADC.
2022-10-04 16:00:36 +02:00
Frank
78e0c3dcca make MIC_LOGGER work again
- EVERY_N_MILLIS somehow does not work. Replaced it,
- make sure that WLED_DEBUG does not report "fake FFT times" whrn FFT code was not running
2022-10-04 13:47:07 +02:00
Frank
fb00bef05f AR - necessary constants for 166Khz sampling rate
16kHz might be a good compromise on small MCU's:
- GEQ will show frequencies up to ~6Khz
- FFT process may use up to 32millis (-> 100% CPU load). Try to stay below <60% so FreeRTOS can schedule all tasks properly.

- more CPU time is left for other WLED, so it maintains LED FPS and stays responsive on web UI.
2022-09-20 18:29:27 +02:00
Frank
d7bc6b1be7 AR: optimization for small MCUs, part2
Only run FFT when the result will be used.
Please note that this also means that `FFTTime` shown in Info is only meaningful when there is sound input and not silence.

--> To get exact FFT times, the optimization can be disabled by compiling with `-D SR_DEBUG`
2022-09-19 14:09:45 +02:00
Frank
79776ae8bc AR: optimization for smaller MCUs
- this reduces "lagging behind" of I2S sampling on smaller MCU's. The maximum time for FFT is now ~20 millis.
- small improvement for SR_DEBUG
2022-09-19 13:38:52 +02:00
Frank
90b3f009af AR: small improvement for ADC analog mics
ensure that ADC parameters are properly configured.
2022-09-19 13:30:13 +02:00
Frank
6f8deb83e3 some relaxations for S2 and C3
- AR: changed "error" into warning.
- reducing max_busses (for AR) not needed on S2
2022-09-17 22:00:33 +02:00
Frank
85fc8710dd mics that need MCLK should work 2022-09-17 20:39:23 +02:00
Frank
a766ddbebc make I2S microphones work with buggy IDF4.4.x
I2S microphones were not working any more in with the newest framework - only delivers silence.
Ther reason is stupid bug in espressif I2S "compatibility" driver: RIGHT and LEFT channel are swapped, so when only asking for LEFT, we get silence from RIGHT.

Workaround: simply change LEFT to RIGHT, until the problem is fixed in ESP-IDF --> Fix tested on "classic ESP32", but still need to check behavior on -S3.
Code compiles also on -S3, -S2, and -C3.

smaller changes:
- a few changes to use new APIs (MCLK, rouing and sample resolution)
- a few additional debug messages
- put correct value into _pinConfig.mck_io_num
2022-09-16 16:58:04 +02:00
Frank
01acb08c83 minor fix (typo) 2022-09-16 16:38:24 +02:00
Blaz Kristan
dfe4d70198 Merge branch 'audioreactive-prototype' into esp32-s2 2022-09-16 15:38:44 +02:00
Frank
925bc3b3dd AR: get rid of annoying "type conversion" warning 2022-09-11 14:32:00 +02:00
Frank
ac10b3a5c7 compilation support for audioreactive
putting all parts that will not compile between #ifdef .... #endif
Tested on S3, cannot say what will happen on other MCUs
2022-09-11 00:12:51 +02:00
Frank
cf93d6bb65 more precision for debug info (FFT timing)
keep more detailed timing info for FFT and I2S (WLED_DEBUG)
2022-09-08 22:45:32 +02:00
Blaz Kristan
e8942c2968 fix for repeating debug message 2022-09-06 15:52:09 +02:00
Blaz Kristan
42d1ab8a87 Separator in Info dialog. 2022-09-03 00:01:11 +02:00
Frank
77ace76e32 Bugfix: make UDP sound sync work in AP mode
- the connected() method only get called once a Wifi STA connection is established. UDP Sound Sync should also work when sender is in AP Mode.
- added a few comments that should help to understand the code structure.
2022-09-02 13:49:12 +02:00
Frank
37ba649930 audioreactive effect improvements
- Info Page: add a small horizontal line below usermod specific part. Improves readability.
- updated 2D mapping mode of some  1D soundreactive effects
- alllow some effects to fade slowly, even slower that possible with SEGMENT.fade_out(). Looks nice.

not sure why - most effects only fade when using SEGMENT.fade_out(), while some need SEGMENT.fadeToBlackBy().
2022-09-01 14:56:01 +02:00
Frank
64970772c7 optimization, and moving peak detection into own function
- save 1K of RAM by optimizing out
 fftBin[].
- moved several copies of the peak reset code into a single function
- moved peak detection out of getSample().
 - call peak detection function as last step of FFTcode. More optimal, and we can be sure that fresh FFT result are available.

Peak detection/reset are now called from both tasks, so I had to move some peak-related vars out of AudioReactive class and make them global (static).
2022-08-28 16:26:34 +02:00
Frank
5c792eb869 some cleanup and re-grouping of variables
- put variables with same context next to each other.
- removed a few vars that are not needed any more.
- replaced "16" by a more descriptive constant
2022-08-28 13:13:25 +02:00
Frank
be7e7ac274 AR: documentation
- clarified a misleading comment in FFTCode
- added a few more comments to describe steps of the processing
- removed some commented-out code
2022-08-22 10:08:22 +02:00
Blaz Kristan
720fae8720 Code sanitation.
Default analog pin -1
2022-08-21 19:15:42 +02:00
Frank
d053bc562f code cleanup, few optimizations, and fixing more overflows
- code cleanup in audio_reactive.h
- fixing some more under/overflows in fx.cpp
2022-08-21 13:10:16 +02:00
Blaz Kristan
ea363a8764 Minor cleanup & fix for connected(). 2022-08-21 09:51:15 +02:00
Frank
bbc8049832 The Right Thing to Do (makes GEQ look awesome)
... found that stupid commit messages get more attention ;-)

- use 22050 Hz for sampling, as it is a standard frequency. I think this is the best choise.
- redesigned the GEQ channels (fftResult[]) for 22Khz, based on channels found on old HiFi equalizer equipment. 1Kzh is now at the center; Bass/Trebble channels are using 1/4 on left/right side respectively - similar to real equalizers. Looks nice :-)

- adjusted effects that use FFT_MajorPeak so that the maximum frequency is supported.
2022-08-20 22:14:54 +02:00
Frank
b8db47e528 AR: new freq scaling option "square root"
also looks nice. It's a compromise between log() and linear. OK enough tinkering for today :-)
2022-08-19 16:11:50 +02:00
Frank
3c57e2e2b9 AR: special gain for GEO, some bugfixes andparameter tinkering
- new feature: "Input Level" (info page) can be used as global "GEQ gain" - only when AGC is ON (was already possible when AGC=off)

- some parameter tweaking in FFT function
- hidden feature: FFT decay  is slower when setting a high "dynamics Limiter Fall time" (steps: <1000, <2000, <3000, >3000)

- FFT_MajorPeak default 1.0f (as log(0.0) is invalid)
- FX.cppp: ensure that fftResult[] is always used inside array bounds
2022-08-19 14:36:47 +02:00
Blaz Kristan
753ae51dd5 Stop & restart UDP on pause/update. 2022-08-18 20:42:58 +02:00