Created
December 1, 2017 09:57
-
-
Save sammachin/ab3a2d2fb4d837b68d4aba51cc361fc9 to your computer and use it in GitHub Desktop.
Node Downsample 16Khz > 8Khz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Downsample frames from 16Khz to 8Khz | |
function convert(message){ | |
var arr = [] | |
var x = 0; | |
var y; | |
var i; | |
for (i = 0; i < 160; i++) { | |
y = x+2 | |
arr.push(message.slice(x,y)) | |
x += 4; | |
} | |
var data = Buffer.concat(arr); | |
return data | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment