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: docs/soundreactive/sync.md
+12-15Lines changed: 12 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,27 +61,24 @@ UDP_SYNC_HEADER is a versioning number that's defined in audio_reactive.h
61
61
62
62
### V2 Format - WLED version >= 0.14.0 (including MoonModules fork)
63
63
64
-
<div style="background-color: Gray">
65
-
66
-
```c++
64
+
``` { .cpp .copy }
67
65
#define UDP_SYNC_HEADER_V2 "00002"
68
66
69
67
// new "V2" audiosync struct - 44 Bytes
70
-
struct __attribute__ ((packed)) audioSyncPacket { // WLEDMM "packed" ensures that there are no additional gaps
71
-
char header[6]; // 06 Bytes offset 0 - "00002" for protocol version 2 ( includes \0 for c-style string termination)
72
-
uint8_t pressure[2]; // 02 Bytes, offset 6 - optional - sound pressure as fixed point (8bit integer, 8bit fraction)
73
-
float sampleRaw; // 04 Bytes offset 8 - either "sampleRaw" or "rawSampleAgc" depending on soundAgc setting
74
-
float sampleSmth; // 04 Bytes offset 12 - either "sampleAvg" or "sampleAgc" depending on soundAgc setting
75
-
uint8_t samplePeak; // 01 Bytes offset 16 - 0 no peak; >=1 peak detected. In future, this will also provide peak Magnitude
76
-
uint8_t frameCounter; // 01 Bytes offset 17 - optional - rolling counter to track duplicate/out of order packets
77
-
uint8_t fftResult[16]; // 16 Bytes offset 18 - 16 GEQ channels, each channel has one byte (uint8_t)
78
-
uint16_t zeroCrossingCount; // 02 Bytes, offset 34 - optional - number of zero crossings seen in 23ms
79
-
float FFT_Magnitude; // 04 Bytes offset 36 - largest FFT result from a single run (raw value, can go up to 4096)
80
-
float FFT_MajorPeak; // 04 Bytes offset 40 - frequency (Hz) of largest FFT result
68
+
struct __attribute__ ((packed)) audioSyncPacket {
69
+
char header[6]; // 06 Bytes offset 0 - "00002" for protocol version 2 ( includes \0 for c-style string termination)
70
+
uint8_t pressure[2]; // 02 Bytes, offset 6 - optional - sound pressure as fixed point (8bit integer, 8bit fraction)
71
+
float sampleRaw; // 04 Bytes offset 8 - either "sampleRaw" or "rawSampleAgc" depending on soundAgc setting
72
+
float sampleSmth; // 04 Bytes offset 12 - either "sampleAvg" or "sampleAgc" depending on soundAgc setting
73
+
uint8_t samplePeak; // 01 Bytes offset 16 - 0 no peak; >=1 peak detected. In future, this will also provide peak Magnitude
74
+
uint8_t frameCounter; // 01 Bytes offset 17 - optional - rolling counter to track duplicate/out of order packets
75
+
uint8_t fftResult[16]; // 16 Bytes offset 18 - 16 GEQ channels, each channel has one byte (uint8_t)
76
+
uint16_t zeroCrossingCount; // 02 Bytes, offset 34 - optional - number of zero crossings seen in 23ms
77
+
float FFT_Magnitude; // 04 Bytes offset 36 - largest FFT result from a single run (raw value, can go up to 4096)
78
+
float FFT_MajorPeak; // 04 Bytes offset 40 - frequency (Hz) of largest FFT result
81
79
};
82
80
83
81
```
84
-
</div>
85
82
86
83
The V2 format expects that AGC is performed by the sender, so there is no need to transmit "AGC"and"non-AGC" samples separately. To save bandwidth, the `myvals[]` array was removed, and all numbers are either `float` or `uint8_t`.
0 commit comments