speaker-calibration 2.2.255 → 2.2.257

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/utils.js CHANGED
@@ -200,6 +200,16 @@ export function convertAsterisksToList(content) {
200
200
  return result;
201
201
  }
202
202
 
203
-
203
+ export const reorderMLS = (mlsSignal, preSec, sourceSamplingRate) => {
204
+ // Number of samples to move
205
+ const numSamplesToMove = Math.round(preSec * sourceSamplingRate);
206
+ if (numSamplesToMove <= 0 || numSamplesToMove >= mlsSignal.length) {
207
+ // Nothing to reorder, return original
208
+ return mlsSignal;
209
+ }
210
+ const lastPart = mlsSignal.slice(-numSamplesToMove);
211
+ const firstPart = mlsSignal.slice(0, mlsSignal.length - numSamplesToMove);
212
+ return lastPart.concat(firstPart);
213
+ }
204
214
 
205
215
  export {sleep, saveToCSV, saveToJSON, csvToArray,findMinValue,findMaxValue, standardDeviation, interpolate};