Fixed audio stopping bug

- Added basic noisegate
- Handling more voice connection statuses
This commit is contained in:
Logan Cusano
2023-05-06 14:09:09 -04:00
parent d1a8059cb9
commit 4fbed169ab
3 changed files with 81 additions and 15 deletions

View File

@@ -0,0 +1,21 @@
exports.calcRmsSync = (arr , n) => {
var square = 0;
var mean = 0;
var root = 0;
// Calculate square.
for (i = 0; i < n; i++) {
square += Math.pow(arr[i], 2);
}
// Calculate Mean.
mean = (square / (n));
// Calculate Root.
root = Math.sqrt(mean);
// Normalize the output
root = root / 10
return root;
}