1 | static float shortSamplesToPercentVolume(short[] samples) { |
2 | int min = 32767, max = -32768, n = l(samples); |
3 | for i to n: { |
4 | short sample = samples[i]; |
5 | min = min(min, sample); |
6 | max = max(max, sample); |
7 | } |
8 | ret (float) (100*min(1, max(0, max-min)/65534.0)); |
9 | } |
Began life as a copy of #1017151
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1017152 |
Snippet name: | shortSamplesToPercentVolume |
Eternal ID of this version: | #1017152/1 |
Text MD5: | 5e66e161b680d360713f48a628972be0 |
Author: | stefan |
Category: | javax / audio analysis |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-07-13 12:54:31 |
Source code size: | 278 bytes / 9 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 409 / 460 |
Referenced in: | [show references] |