mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
moved from sum to mean
This commit is contained in:
parent
7d2168a0e7
commit
392e0bf930
1 changed files with 3 additions and 3 deletions
|
@ -877,11 +877,11 @@ class RF:
|
||||||
|
|
||||||
# Calculate audio RMS
|
# Calculate audio RMS
|
||||||
# https://stackoverflow.com/a/9763652
|
# https://stackoverflow.com/a/9763652
|
||||||
# calculate RMS every 150 cycles for reducing CPU load
|
# calculate RMS every 50 cycles for reducing CPU load
|
||||||
rms_counter += 1
|
rms_counter += 1
|
||||||
if rms_counter > 150:
|
if rms_counter > 50:
|
||||||
d = np.frombuffer(self.fft_data, np.int16).astype(np.float)
|
d = np.frombuffer(self.fft_data, np.int16).astype(np.float)
|
||||||
static.AUDIO_RMS = int(np.sqrt((d * d).sum() / len(d)))
|
static.AUDIO_RMS = int(np.sqrt(np.mean(d ** 2)))
|
||||||
rms_counter = 0
|
rms_counter = 0
|
||||||
|
|
||||||
# Check for signals higher than average by checking for "100"
|
# Check for signals higher than average by checking for "100"
|
||||||
|
|
Loading…
Reference in a new issue