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).

static short[] normalizeShortArray(short[] l) {
  int max = min(32767, absShortMax(l));
  if (max == 0 || max == 32767) ret l;
  int n = l(l);
  short[] l2 = new[n];
  double factor = 32767.0/max;
  for i to n:
    l2[i] = roundToShort(l[i]*factor);
  ret l2;
}

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: 275 / 381
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1027010 - normalizeShortArrays (does it in place)