Libraryless. Click here for Pure Java version (3881L/22K).
1 | static short[] convertSampleRate_shortArray_simple(short[] data, double oldSampleRate, double newSampleRate) { |
2 | double ratio = doubleRatio(newSampleRate, oldSampleRate); |
3 | if (ratio == 1) ret data; |
4 | int l = l(data), l2 = iround(l(data)*ratio); |
5 | short[] data2 = new[l2]; |
6 | double j = 0, step = 1/ratio; |
7 | for i to l2: { |
8 | data2[i] = data[min(ifloor(j), l-1)]; |
9 | j += step; |
10 | } |
11 | ret data2; |
12 | } |
13 | |
14 | static short[] convertSampleRate_shortArray_simple(double oldSampleRate, double newSampleRate, short[] data) { |
15 | ret convertSampleRate_shortArray_simple(data, oldSampleRate, newSampleRate); |
16 | } |
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: | #1026902 |
Snippet name: | convertSampleRate_shortArray_simple - fast version without anti-aliasing |
Eternal ID of this version: | #1026902/5 |
Text MD5: | 40d4a877d797c9fceae8f10739e019c8 |
Transpilation MD5: | 8599b0c22d8e51c3c1ca2ef285a7b2b9 |
Author: | stefan |
Category: | javax / audio |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-17 19:13:34 |
Source code size: | 607 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 237 / 320 |
Version history: | 4 change(s) |
Referenced in: | [show references] |