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

15
LINES

< > BotCompany Repo | #1026898 // Test normalized normalizedAutocorrelationOfAudioSamples sanity [OK]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (7290L/51K).

1  
!7
2  
p-exp {
3  
  short[] x = new[44];
4  
  for i over x: x[i] = (short) random(-100, 100);
5  
  double a = autocorrelationOfAudioSamples(x);
6  
  double aa = normalizedAutocorrelationOfAudioSamples(x);
7  
  print(a);
8  
  for i over x: x[i] *= 2;
9  
  double b = autocorrelationOfAudioSamples(x);
10  
  double bb = normalizedAutocorrelationOfAudioSamples(x);
11  
  print(b);
12  
  print(doubleRatio(b, a)); // should be 4
13  
  print(aa + " " + bb);
14  
  print(doubleRatio(bb, aa)); // should be 1
15  
}

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: #1026898
Snippet name: Test normalized normalizedAutocorrelationOfAudioSamples sanity [OK]
Eternal ID of this version: #1026898/2
Text MD5: ec14e65af44c973e16b790a9cc766896
Transpilation MD5: ab5005ca96d361ce27b20c96af342ecb
Author: stefan
Category: javax / audio
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-02 15:28:52
Source code size: 472 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 319 / 979
Version history: 1 change(s)
Referenced in: [show references]