speaker-calibration 2.2.192 → 2.2.194

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.2.192",
3
+ "version": "2.2.194",
4
4
  "description": "Speaker calibration library for auditory testing",
5
5
  "main": "dist/main.js",
6
6
  "directories": {
@@ -80,7 +80,7 @@ class PythonServerAPI {
80
80
 
81
81
  const data = JSON.stringify({
82
82
  task,
83
- payload,
83
+ 'payload': payload,
84
84
  'sample-rate': sampleRate,
85
85
  mls,
86
86
  numPeriods,
@@ -55,6 +55,7 @@ class AudioCalibrator extends AudioRecorder {
55
55
  /** @private */
56
56
  startTime;
57
57
 
58
+ numCalibratingRoundsCompleted=0;
58
59
  /**
59
60
  * Called when a call is received.
60
61
  * Creates a local audio DOM element and attaches it to the page.
@@ -240,6 +240,7 @@ class Combination extends AudioCalibrator {
240
240
  unfiltered: [],
241
241
  system: [],
242
242
  component: [],
243
+ warnings:[]
243
244
  };
244
245
 
245
246
  inDB;
@@ -604,6 +605,10 @@ class Combination extends AudioCalibrator {
604
605
  console.log('SD: ' + result['sd'] + ', less than _calibrateSoundBurstMaxSD_dB: ' + this._calibrateSoundBurstMaxSD_dB);
605
606
  } else {
606
607
  console.log('SD: ' + result['sd'] + ', greater than _calibrateSoundBurstMaxSD_dB: ' + this._calibrateSoundBurstMaxSD_dB);
608
+ this.recordingChecks['warnings'].push(`Redo all Hz recording because SD ${result['sd']} dB> ${this._calibrateSoundBurstMaxSD_dB} dB`);
609
+ this.status =
610
+ `Redoing all Hz recording because SD ${result['sd']} dB> ${this._calibrateSoundBurstMaxSD_dB} dB`.toString() +
611
+ this.generateTemplate().toString();
607
612
  }
608
613
  if (this.numSuccessfulCaptured == 1) {
609
614
  console.log('pop last unfiltered mls volume check');
@@ -624,15 +629,12 @@ class Combination extends AudioCalibrator {
624
629
  // let end = new Date().getTime() / 1000;
625
630
  // console.log("Time taken:", end - start, "seconds");
626
631
  const usedPeriodStart = this.num_mls_to_skip * this.sourceSamplingRate;
627
- const usedPeriodEnd = this.numMLSPerCapture * this.sourceSamplingRate;
628
- const payload_skipped_warmUp = payload.slice(usedPeriodStart, usedPeriodEnd);
629
- console.log(payload.length);
630
- console.log(payload_skipped_warmUp.length);
632
+ const payload_skipped_warmUp = payload.slice(usedPeriodStart);
631
633
  await this.pyServerAPI
632
634
  .getAutocorrelation({
635
+ mls:mls,
636
+ payload: payload_skipped_warmUp,
633
637
  sampleRate: this.sourceSamplingRate || 96000,
634
- payload,
635
- mls,
636
638
  numPeriods: this.numMLSPerCapture - this.num_mls_to_skip,
637
639
  })
638
640
  .then(async res => {
@@ -2249,6 +2251,12 @@ class Combination extends AudioCalibrator {
2249
2251
  };
2250
2252
 
2251
2253
  #playCalibrationAudioVolume = async () => {
2254
+ if (this.numCalibratingRoundsCompleted==1) {
2255
+ this.recordingChecks['warnings'].push(`Redo 1000 Hz, ${this.inDB} dB, recording because SD ${this.recordingChecks['volume'][this.inDB]['sd']} dB> ${this.calibrateSound1000HzMaxSD_dB} dB`);
2256
+ this.status =
2257
+ `Redoing 1000 Hz recording because SD ${this.recordingChecks['volume'][this.inDB]} dB> ${this.calibrateSound1000HzMaxSD_dB} dB`.toString() +
2258
+ this.generateTemplate().toString();
2259
+ }
2252
2260
  const totalDuration = this.CALIBRATION_TONE_DURATION * 1.2;
2253
2261
 
2254
2262
  this.calibrationNodes[0].start(0);
@@ -2344,6 +2352,7 @@ class Combination extends AudioCalibrator {
2344
2352
  //reset the values
2345
2353
  //this.incrementStatusBar();
2346
2354
 
2355
+ console.log(this.recordingChecks['warnings']);
2347
2356
  this.outDBSPL = null;
2348
2357
  this.outDBSPL = null;
2349
2358
  this.outDBSPL1000 = null;
@@ -2650,6 +2659,10 @@ class Combination extends AudioCalibrator {
2650
2659
  if (result) {
2651
2660
  if (result['sd'] > this._calibrateSoundBurstMaxSD_dB & this.numSuccessfulCaptured) {
2652
2661
  console.log('filtered recording sd too high');
2662
+ this.recordingChecks['warnings'].push(`Redo all Hz recording because SD ${result['sd']} dB> ${this._calibrateSoundBurstMaxSD_dB} dB`);
2663
+ this.status =
2664
+ `Redoing all Hz recording because SD ${result['sd']} dB> ${this._calibrateSoundBurstMaxSD_dB} dB`.toString() +
2665
+ this.generateTemplate().toString();
2653
2666
  // numSuccessfulCaptured no longer to count number of successful capture but count attemps
2654
2667
  // is sd below _calibrateSoundBurstMaxSD_dB then count two attemps
2655
2668
  // else count one attemp