/** Computes the RMS volume of a group of signal sizes ranging from -1 to 1. */
static double audio_rmsVolume(float[] raw) {
if (empty(raw)) ret 0;
double sum = 0;
for (int ii=0; ii<raw.length; ii++)
sum += raw[ii];
double average = sum/raw.length;
double sumMeanSquare = 0d;
for (int ii=0; ii<raw.length; ii++)
sumMeanSquare += Math.pow(raw[ii]-average, 2d);
double averageMeanSquare = sumMeanSquare/raw.length;
double rootMeanSquare = Math.sqrt(averageMeanSquare);
return rootMeanSquare;
}download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1009778 |
| Snippet name: | audio_rmsVolume |
| Eternal ID of this version: | #1009778/1 |
| Text MD5: | e37cae3e6a77ad16bab5b0150284ccdb |
| Author: | stefan |
| Category: | javax / audio |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-08-16 17:47:32 |
| Source code size: | 540 bytes / 17 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 838 / 1083 |
| Referenced in: | [show references] |