Libraryless. Click here for Pure Java version (3881L/22K).
static short[] convertSampleRate_shortArray_simple(short[] data, double oldSampleRate, double newSampleRate) { double ratio = doubleRatio(newSampleRate, oldSampleRate); if (ratio == 1) ret data; int l = l(data), l2 = iround(l(data)*ratio); short[] data2 = new[l2]; double j = 0, step = 1/ratio; for i to l2: { data2[i] = data[min(ifloor(j), l-1)]; j += step; } ret data2; } static short[] convertSampleRate_shortArray_simple(double oldSampleRate, double newSampleRate, short[] data) { ret convertSampleRate_shortArray_simple(data, oldSampleRate, newSampleRate); }
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: | 238 / 321 |
Version history: | 4 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1026943 - convertSampleRate_stereoShortArray_simple - fast version without anti-aliasing |