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

9
LINES

< > BotCompany Repo | #1017152 // shortSamplesToPercentVolume

JavaX fragment (include)

static float shortSamplesToPercentVolume(short[] samples) {
  int min = 32767, max = -32768, n = l(samples);
  for i to n: {
    short sample = samples[i];
    min = min(min, sample);
    max = max(max, sample);
  }
  ret (float) (100*min(1, max(0, max-min)/65534.0));
}

Author comment

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: 315 / 365
Referenced in: [show references]