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

10
LINES

< > BotCompany Repo | #1026911 // normalizeShortArray

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2182L/14K).

1  
static short[] normalizeShortArray(short[] l) {
2  
  int max = min(32767, absShortMax(l));
3  
  if (max == 0 || max == 32767) ret l;
4  
  int n = l(l);
5  
  short[] l2 = new[n];
6  
  double factor = 32767.0/max;
7  
  for i to n:
8  
    l2[i] = roundToShort(l[i]*factor);
9  
  ret l2;
10  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026911
Snippet name: normalizeShortArray
Eternal ID of this version: #1026911/6
Text MD5: e3deffea03c7f089439566d98deaebe0
Transpilation MD5: d712f4221aee1f3553b9ba8567f6187a
Author: stefan
Category: javax / audio recognition
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-02 17:18:21
Source code size: 270 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 274 / 381
Version history: 5 change(s)
Referenced in: [show references]