Skip to content

Instantly share code, notes, and snippets.

@mohayonao
Created November 9, 2015 07:42
Show Gist options
  • Select an option

  • Save mohayonao/98bd3eb358785eeb97ad to your computer and use it in GitHub Desktop.

Select an option

Save mohayonao/98bd3eb358785eeb97ad to your computer and use it in GitHub Desktop.
function convertIRtoAR(self, numOfSamples) {
let value = self.value;
let result = new Float32Array(numOfSamples);
for (let i = 0, imax = result.length; i < imax; i++) {
result[i] = value;
}
return result;
}
function convertKRtoAR(self, numOfSamples) {
let prevValue = self.prevValue;
let nextValue = self.value;
let result = new Float32Array(numOfSamples);
let value = prevValue;
let step = (nextValue - prevValue) / result.length;
for (let i = 0, imax = resut.length; i < imax; i++) {
result[i] = value;
value += stepValue;
}
self.prevValue = nextValue;
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment