Libraryless. Click here for Pure Java version (2266L/15K).
static double[] autocorrelationTableForAudioSamples(short[] samples) { ret autocorrelationTableForAudioSamples(samples, 0, l(samples)); } static double[] autocorrelationTableForAudioSamples(short[] samples, int start, int end) { int n = end-start; double[] table = new[n]; // hmm. value at zero seems pointless for j to n: { double correlation = 0; for i to n: correlation += sixteenBitAudioSampleToDouble(samples[start+i]) * sixteenBitAudioSampleToDouble(samples[start+mod(i - j, n)]); table[j] = correlation; } ret table; } static double[] autocorrelationTableForAudioSamples(short[] samples, IntRange r) { ret autocorrelationTableForAudioSamples(samples, r.start, r.end); }
Began life as a copy of #1026895
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: | #1026907 |
Snippet name: | autocorrelationTableForAudioSamples |
Eternal ID of this version: | #1026907/1 |
Text MD5: | b83cd0bc99d09ac8932c5d9e97714c28 |
Transpilation MD5: | f24775e88e58fe755c5aba8c8f7f9112 |
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 16:40:00 |
Source code size: | 737 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 223 / 298 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1026909 - normalizedAutocorrelationTableForAudioSamples |