1 | static float pcmToLevel(byte[] pcm) { |
2 | float sum = 0, max = 0; |
3 | for i over pcm: { |
4 | int p = (int) pcm[i]; |
5 | float l = abs(p)/128f; |
6 | sum += l; |
7 | max = max(max, l); |
8 | } |
9 | //float l = sum/pcm.length; |
10 | float l = max; |
11 | //print(bytesToHex(pcm) + " " + l); |
12 | ret l; |
13 | } |
Began life as a copy of #1004840
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004842 |
Snippet name: | pcmToLevel |
Eternal ID of this version: | #1004842/1 |
Text MD5: | 8171a721aa2e54d89e2b8224bd1db91d |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-09-03 17:09:41 |
Source code size: | 285 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 536 / 537 |
Referenced in: | [show references] |