Download Jar. Libraryless. Click here for Pure Java version (3071L/22K).
1 | !7 |
2 | |
3 | static int bufSize = 40960; |
4 | |
5 | p { |
6 | short[] loop1 = decodeWAVToStereoSamples(loadLibrary(#1400093)); |
7 | short[] loop2 = decodeWAVToStereoSamples(newFile(downloadsDir(), "27130__pryght-one__harp.wav")); |
8 | VF1<short[]> vf = mixLoops(loop1, loop2); |
9 | playAudioFromSampleMakingFunction(bufSize, vf); |
10 | } |
11 | |
12 | static VF1<short[]> mixLoops(final short[] loop1, final short[] loop2) { |
13 | ret new VF1<short[]>() { |
14 | int i = 0; |
15 | |
16 | void get(short[] pair) { |
17 | int j = max(0, min(l(loop2), 2*iround(i/2*((double) l(loop2))/l(loop1)))); |
18 | pair[0] = (short) ((loop1[i] + loop2[j])/2); |
19 | pair[1] = (short) ((loop1[i+1] + loop2[j+1])/2); |
20 | i = (i+2) % l(loop1); |
21 | } |
22 | }; |
23 | } |
Began life as a copy of #1016688
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1016690 |
Snippet name: | Mix 2 Loops (OK) |
Eternal ID of this version: | #1016690/6 |
Text MD5: | ee65cfaf40d902d83c24ceebcd543bfd |
Transpilation MD5: | 42b8c3c0a0518907b2e66247a2c262f7 |
Author: | stefan |
Category: | javax / sound |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-06-28 00:56:24 |
Source code size: | 699 bytes / 23 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 410 / 1038 |
Version history: | 5 change(s) |
Referenced in: | [show references] |