speaker-calibration 2.1.2 → 2.1.3

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.2",
3
+ "version": "2.1.3",
4
4
  "description": "Speaker calibration library for auditory testing",
5
5
  "main": "dist/main.js",
6
6
  "directories": {
@@ -27,6 +27,12 @@ class Volume extends AudioCalibrator {
27
27
  /** @private */
28
28
  soundGainDBSPL = null;
29
29
  outDBSPL = null;
30
+ power = null;
31
+ power1000 = null;
32
+ RMS = null;
33
+ THD = null;
34
+ outDBSPL1000 = null;
35
+ soundGainDBSPL1000 = null;
30
36
 
31
37
  handleIncomingData = data => {
32
38
  console.log('Received data: ', data);
@@ -125,6 +131,12 @@ class Volume extends AudioCalibrator {
125
131
  if (this.outDBSPL === null) {
126
132
  this.outDBSPL = res['outDbSPL'];
127
133
  this.soundGainDBSPL = res['soundGainDbSPL'];
134
+ this.outDBSPL1000 = res['outDbSPL1000'];
135
+ this.power = res['power']
136
+ this.power1000 = res['power1000']
137
+ this.THD = res['thd']
138
+ this.RMS = res['rms']
139
+ this.soundGainDBSPL1000 = res['soundGainDbSPL1000'];
128
140
  }
129
141
  })
130
142
  .catch(err => {
@@ -135,9 +147,15 @@ class Volume extends AudioCalibrator {
135
147
  startCalibration = async (stream, gainValues) => {
136
148
  const trialIterations = gainValues.length;
137
149
  const soundGainDBSPLValues = [];
150
+ const soundGainDBSPL1000Values = [];
151
+ const power1000Values = [];
152
+ const powerValues = [];
153
+ const rmsValues = [];
154
+ const thdValues = [];
138
155
  const inDBValues = [];
139
156
  let inDB = 0;
140
157
  const outDBSPLValues = [];
158
+ const outDBSPL1000Values = [];
141
159
 
142
160
  // run the calibration at different gain values provided by the user
143
161
  for (let i = 0; i < trialIterations; i++) {
@@ -155,28 +173,44 @@ class Volume extends AudioCalibrator {
155
173
  gainValues[i]
156
174
  );
157
175
  } while (this.outDBSPL === null);
176
+ outDBSPL1000Values.push(this.outDBSPL1000);
177
+ power1000Values.push(this.power1000);
178
+ powerValues.push(this.power);
179
+ rmsValues.push(this.RMS);
180
+ thdValues.push(this.THD);
158
181
  outDBSPLValues.push(this.outDBSPL);
159
182
  soundGainDBSPLValues.push(this.soundGainDBSPL);
183
+ soundGainDBSPL1000Values.push(this.soundGainDBSPL1000);
184
+
160
185
  this.outDBSPL = null;
161
186
  this.soundGainDBSPL = null;
187
+ this.power1000 = null;
188
+ this.power = null;
189
+ this.outDBSPL1000 = null;
190
+ this.RMS = null;
191
+ this.THD = null;
192
+ this.soundGainDBSPL1000=null;
162
193
  }
163
194
 
164
195
  // get the volume calibration parameters from the server
165
196
  const parameters = await this.pyServerAPI
166
- .getVolumeCalibrationParameters({inDBValues: inDBValues, outDBSPLValues: outDBSPLValues})
197
+ .getVolumeCalibrationParameters({inDBValues: inDBValues, outDBSPLValues: outDBSPL1000Values})
167
198
  .then(res => {
168
- // console.log(res);
169
199
  return res;
170
200
  });
171
- // console.log('Parameters: ', parameters);
172
- // return soundGainDBSPLValues;
173
201
  const result = {
174
202
  parameters: parameters,
175
203
  inDBValues: inDBValues,
176
204
  outDBSPLValues: outDBSPLValues,
177
205
  soundGainDBSPLValues: soundGainDBSPLValues,
206
+ powerValues: powerValues,
207
+ power1000Values: power1000Values,
208
+ outDBSPL1000Values: outDBSPL1000Values,
209
+ rmsValues: rmsValues,
210
+ thdValues: thdValues,
211
+ soundGainDBSPL1000Values: soundGainDBSPL1000Values
178
212
  };
179
- // console.log('Result: ', result);
213
+
180
214
  return result;
181
215
  };
182
216
  }