Skip to content

Instantly share code, notes, and snippets.

@sammachin
Created December 1, 2017 09:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sammachin/ab3a2d2fb4d837b68d4aba51cc361fc9 to your computer and use it in GitHub Desktop.
Save sammachin/ab3a2d2fb4d837b68d4aba51cc361fc9 to your computer and use it in GitHub Desktop.
Node Downsample 16Khz > 8Khz
// 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