Uses 911K of libraries. Click here for Pure Java version (4681L/24K).
1 | !7 |
2 | |
3 | cmodule AudioInputCorrelationTest > DynPrintLogAndEnabled { |
4 | double windowSize = 1; // milliseconds |
5 | transient short[] buffer; |
6 | |
7 | start { |
8 | dm_addAudioListener(voidfunc(short[] data) enter { |
9 | if (!enabled) ret; |
10 | |
11 | buffer = cloneArray(data); |
12 | dm_q(r { |
13 | if (q.size() > 2) ret with print("overload"); |
14 | short[] buf = buffer; |
15 | Float sampleRate = dm_audioInputSampleRate(); |
16 | if (sampleRate == null) ret; |
17 | int windowLength = msToSamples_int(windowSize, sampleRate); |
18 | //printWithMilliseconds("Window length (" + sampleRate + "): " + windowLength); |
19 | new L<Double> l; |
20 | for (IntRange r : intRangeChunks(data, windowLength)) |
21 | l.add(normalizedAutocorrelationOfAudioSamples(data, r)); |
22 | double result = doubleAverage(l); |
23 | print(iround(result) + ", max=" + iround(doubleMax(l)) + " " + takeFirst(5, l)); |
24 | }); |
25 | }); |
26 | } |
27 | } |
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: | #1026891 |
Snippet name: | Audio Input Autocorrelation Test |
Eternal ID of this version: | #1026891/21 |
Text MD5: | 95ecb94107eec14b38bdfb3080185d58 |
Transpilation MD5: | e52005d4ca8cf20ecaf73269fd6db09f |
Author: | stefan |
Category: | javax / audio |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-02-02 15:40:46 |
Source code size: | 944 bytes / 27 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 279 / 602 |
Version history: | 20 change(s) |
Referenced in: | [show references] |