Libraryless. Click here for Pure Java version (2269L/14K).
static double autocorrelationOfAudioSamples(short[] samples) { ret autocorrelationOfAudioSamples(samples, 0, l(samples)); } static double autocorrelationOfAudioSamples(short[] samples, int start, int end) { int n = end-start; double sum = 0; for j to n: { double correlation = 0; for i to n: correlation += sixteenBitAudioSampleToDouble(samples[start+i]) * sixteenBitAudioSampleToDouble(samples[start+mod(i - j, n)]); sum += correlation; } ret doubleRatio(sum, n); } static double autocorrelationOfAudioSamples(short[] samples, IntRange r) { ret autocorrelationOfAudioSamples(samples, r.start, r.end); }
Began life as a copy of #1026886
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: | #1026895 |
Snippet name: | autocorrelationOfAudioSamples |
Eternal ID of this version: | #1026895/3 |
Text MD5: | 835c0eab43df2569fac7ddc08a50e753 |
Transpilation MD5: | 4dcd035579df933b6a6fbdd0301b95fa |
Author: | stefan |
Category: | javax / audio |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-02-02 15:23:34 |
Source code size: | 664 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 218 / 298 |
Version history: | 2 change(s) |
Referenced in: | [show references] |