You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,16 @@
2
2
3
3
Here are a few suggestions to make it easier for you to contribute!
4
4
5
+
### Describe your PR
6
+
7
+
Please add a description of your proposed code changes. It does not need to be an exhaustive essay, however a PR with no description or just a few words might not get accepted, simply because very basic information is missing.
8
+
9
+
A good description helps us to review and understand your proposed changes. For example, you could say a few words about
10
+
* what you try to achieve (new feature, fixing a bug, refactoring, security enhancements, etc.)
11
+
* how your code works (short technical summary - focus on important aspects that might not be obvious when reading the code)
12
+
* testing you performed, known limitations, open ends you possibly could not solve.
13
+
* any areas where you like to get help from an experienced maintainer (yes WLEDMM has become big 😉)
14
+
5
15
### Code style
6
16
7
17
When in doubt, it is easiest to replicate the code style you find in the files you want to edit :)
@@ -79,4 +89,5 @@ Good:
79
89
80
90
There is no set character limit for a comment within a line,
81
91
though as a rule of thumb you should wrap your comment if it exceeds the width of your editor window.
92
+
82
93
Inline comments are OK if they describe that line only and are not exceedingly wide.
; ; -D WLED_USE_UNREAL_MATH ;; may cause wrong sunset/sunrise times, but saves 7064 bytes FLASH and 975 bytes RAM
474
489
475
490
[env:esp07]
476
491
board = esp07
@@ -963,6 +978,7 @@ build_flags_S =
963
978
; -D WLED_DISABLE_2D ;; un-comment to build a firmware without 2D matrix support
964
979
; -D WLED_USE_CIE_BRIGHTNESS_TABLE ;; experimental: use different color / brightness lookup table
965
980
-D USERMOD_AUDIOREACTIVE
981
+
-D USERMOD_AUTO_PLAYLIST
966
982
-D UM_AUDIOREACTIVE_USE_NEW_FFT ; use latest (upstream) FFTLib, instead of older library modified by blazoncek. Slightly faster, more accurate, needs 2KB RAM extra
967
983
; -D USERMOD_ARTIFX ;; WLEDMM usermod - temporarily moved into "_M", due to problems in "_S" when compiling with -O2
968
984
-D WLEDMM_FASTPATH ;; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions.
staticfloat fftCalc[NUM_GEQ_CHANNELS] = {0.0f}; // Try and normalize fftBin values to a max of 4096, so that 4096/16 = 256. (also used by dynamics limiter)
142
143
staticfloat fftAvg[NUM_GEQ_CHANNELS] = {0.0f}; // Calculated frequency channel results, with smoothing (used if dynamics limiter is ON)
143
144
145
+
staticuint16_t zeroCrossingCount = 0; // number of zero crossings in the current batch of 512 samples
146
+
144
147
// TODO: probably best not used by receive nodes
145
148
staticfloat agcSensitivity = 128; // AGC sensitivity estimation, based on agc gain (multAgc). calculated by getSensitivity(). range 0..255
// find highest sample in the batch, and count zero crossings
547
553
float maxSample = 0.0f; // max sample from FFT batch
554
+
uint_fast16_t newZeroCrossingCount = 0;
548
555
for (int i=0; i < samplesFFT; i++) {
549
-
// set imaginary parts to 0
550
-
vImag[i] = 0;
551
556
// pick our our current mic sample - we take the max value from all samples that go into FFT
552
557
if ((vReal[i] <= (INT16_MAX - 1024)) && (vReal[i] >= (INT16_MIN + 1024))) //skip extreme values - normally these are artefacts
553
558
if (fabsf((float)vReal[i]) > maxSample) maxSample = fabsf((float)vReal[i]);
559
+
560
+
// WLED-MM/TroyHacks: Calculate zero crossings
561
+
//
562
+
if (i < (samplesFFT-1)) {
563
+
if (__builtin_signbit(vReal[i]) != __builtin_signbit(vReal[i+1])) // test sign bit: sign changed -> zero crossing
564
+
newZeroCrossingCount++;
565
+
}
554
566
}
567
+
newZeroCrossingCount = (newZeroCrossingCount*2)/3; // reduce value so it typicially stays below 256
568
+
zeroCrossingCount = newZeroCrossingCount; // update only once, to avoid that effects pick up an intermediate value
569
+
555
570
// release highest sample to volume reactive effects early - not strictly necessary here - could also be done at the end of the function
556
571
// early release allows the filters (getSample() and agcAvg()) to work with fresh values - we will have matching gain and noise gate values when we want to process the FFT results.
0 commit comments