Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1004842 // pcmToLevel

JavaX fragment (include)

static float pcmToLevel(byte[] pcm) {
  float sum = 0, max = 0;
  for i over pcm: {
    int p = (int) pcm[i];
    float l = abs(p)/128f;
    sum += l;
    max = max(max, l);
  }
  //float l = sum/pcm.length;
  float l = max;
  //print(bytesToHex(pcm) + " " + l);
  ret l;
}

Author comment

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: 535 / 536
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)