speaker-calibration 2.1.7 → 2.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speaker-calibration",
3
- "version": "2.1.7",
3
+ "version": "2.1.8",
4
4
  "description": "Speaker calibration library for auditory testing",
5
5
  "main": "dist/main.js",
6
6
  "directories": {
@@ -20,7 +20,7 @@ class PythonServerAPI {
20
20
  * @returns
21
21
  * @example
22
22
  */
23
- getImpulseResponse = async ({payload, sampleRate, P}) => {
23
+ getImpulseResponse = async ({mls, payload, sampleRate, P}) => {
24
24
  const task = 'impulse-response';
25
25
  let res = null;
26
26
 
@@ -30,6 +30,7 @@ class PythonServerAPI {
30
30
  task,
31
31
  payload,
32
32
  'sample-rate': sampleRate,
33
+ mls,
33
34
  P,
34
35
  });
35
36
 
@@ -48,7 +49,6 @@ class PythonServerAPI {
48
49
  .catch(error => {
49
50
  throw error;
50
51
  });
51
-
52
52
  return res.data[task];
53
53
  };
54
54
 
@@ -16,11 +16,12 @@ class ImpulseResponse extends AudioCalibrator {
16
16
  * @param {number} [calibratorParams.numCaptures = 5] - number of captures to perform
17
17
  * @param {number} [calibratorParams.numMLSPerCapture = 4] - number of bursts of MLS per capture
18
18
  */
19
- constructor({download = false, mlsOrder = 18, numCaptures = 3, numMLSPerCapture = 3}) {
19
+ constructor({download = false, mlsOrder = 18, numCaptures = 3, numMLSPerCapture = 4}) {
20
20
  super(numCaptures, numMLSPerCapture);
21
21
  this.#mlsOrder = parseInt(mlsOrder, 10);
22
22
  this.#P = 2 ** mlsOrder - 1;
23
23
  this.#download = download;
24
+ this.#mls = [];
24
25
  }
25
26
 
26
27
  /** @private */
@@ -41,6 +42,9 @@ class ImpulseResponse extends AudioCalibrator {
41
42
  /** @private */
42
43
  #mlsOrder;
43
44
 
45
+ /** @private */
46
+ #mls;
47
+
44
48
  /** @private */
45
49
  #P;
46
50
 
@@ -86,6 +90,7 @@ class ImpulseResponse extends AudioCalibrator {
86
90
  sendRecordingToServerForProcessing = signalCsv => {
87
91
  const allSignals = this.getAllRecordedSignals();
88
92
  const numSignals = allSignals.length;
93
+ const mls = this.#mls;
89
94
  const payload =
90
95
  signalCsv && signalCsv.length > 0 ? csvToArray(signalCsv) : allSignals[numSignals - 1];
91
96
 
@@ -95,6 +100,7 @@ class ImpulseResponse extends AudioCalibrator {
95
100
  .getImpulseResponse({
96
101
  sampleRate: this.sourceSamplingRate || 96000,
97
102
  payload,
103
+ mls,
98
104
  P: this.#P,
99
105
  })
100
106
  .then(res => {
@@ -337,6 +343,7 @@ class ImpulseResponse extends AudioCalibrator {
337
343
  */
338
344
  #playCalibrationAudio = () => {
339
345
  this.calibrationNodes[0].start(0);
346
+ this.#mls = this.calibrationNodes[0].buffer.getChannelData(0);
340
347
  this.emit('update', {message: 'playing the calibration tone...'});
341
348
  };
342
349