speaker-calibration 2.2.241 → 2.2.242

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.241",
3
+ "version": "2.2.242",
4
4
  "description": "Speaker calibration library for auditory testing",
5
5
  "main": "dist/main.js",
6
6
  "directories": {
@@ -320,7 +320,7 @@ class Combination extends AudioCalibrator {
320
320
  .replace('111', this.sourceSamplingRate)
321
321
  .replace('222', this.sinkSamplingRate)
322
322
  .replace('333', this.calibrateSoundSamplingDesiredBits);
323
- const reportParameters = `${samplingParamText}`;
323
+ const reportParameters = `${samplingParamText} ↓${this._calibrateSoundBurstDownsample}:1`;
324
324
  if (this.flags) {
325
325
  flags = `<br> autoGainControl: ${this.flags.autoGainControl}, echoCancellation: ${this.flags.echoCancellation}, noiseSuppression: ${this.flags.noiseSuppression}`;
326
326
  }
@@ -710,7 +710,7 @@ class Combination extends AudioCalibrator {
710
710
  binDesiredSec: this._calibrateSoundPowerBinDesiredSec,
711
711
  burstSec: this.desired_time_per_mls,
712
712
  repeats: this.numMLSPerCapture - this.num_mls_to_skip,
713
- warmUp: this.num_mls_to_skip,
713
+ warmUp: this._calibrateSoundBurstPreSec,
714
714
  downsample: this._calibrateSoundBurstDownsample,
715
715
  })
716
716
  .then(async result => {
@@ -757,7 +757,7 @@ class Combination extends AudioCalibrator {
757
757
  `(${pre.toFixed(1)} + ${repeats}×${burst.toFixed(1)} + ${post.toFixed(
758
758
  1
759
759
  )} s) of MLS ver.` +
760
- ` ${this.icapture}. SD = ${result['sd']} > ${this._calibrateSoundBurstMaxSD_dB}`
760
+ ` ${this.icapture}. SD = ${result['sd']} <= ${this._calibrateSoundBurstMaxSD_dB}`
761
761
  );
762
762
  } else {
763
763
  console.log(
@@ -857,22 +857,30 @@ class Combination extends AudioCalibrator {
857
857
  message: this.status,
858
858
  });
859
859
  let time_to_wait = 0;
860
- const fMLS = this.sourceSamplingRate / this._calibrateSoundBurstDownsample;
861
860
  if (this.mode === 'unfiltered') {
862
861
  //unfiltered
863
- time_to_wait = (this.#mls[0].length / fMLS) * this.numMLSPerCapture;
864
- time_to_wait = time_to_wait + this._calibrateSoundBurstPostSec;
862
+ //should be: pre + (burst * repeats) + post
863
+ // time_to_wait = (this.#mls[0].length / this.sourceSamplingRate) * this.numMLSPerCapture;
864
+ // time_to_wait = time_to_wait + this._calibrateSoundBurstPostSec;
865
+ time_to_wait =
866
+ this._calibrateSoundBurstPreSec +
867
+ this._calibrateSoundBurstSec * this._calibrateSoundBurstRepeats +
868
+ this._calibrateSoundBurstPostSec;
865
869
  } else if (this.mode === 'filtered') {
866
870
  //filtered
867
871
  // time_to_wait =
868
872
  // (this.#currentConvolution.length / this.sourceSamplingRate) *
869
873
  // (this.numMLSPerCapture / (this.num_mls_to_skip + this.numMLSPerCapture));
870
- time_to_wait = (this.#currentConvolution.length / fMLS) * this.numMLSPerCapture;
871
- time_to_wait = time_to_wait + this._calibrateSoundBurstPostSec;
874
+ // time_to_wait =
875
+ // (this.#currentConvolution.length / this.sourceSamplingRate) * this.numMLSPerCapture;
876
+ // time_to_wait = time_to_wait + this._calibrateSoundBurstPostSec;
877
+ time_to_wait =
878
+ this._calibrateSoundBurstPreSec +
879
+ this._calibrateSoundBurstSec * this._calibrateSoundBurstRepeats +
880
+ this._calibrateSoundBurstPostSec;
872
881
  } else {
873
882
  throw new Error('Mode broke in awaitDesiredMLSLength');
874
883
  }
875
-
876
884
  await sleep(time_to_wait);
877
885
  };
878
886
 
@@ -908,15 +916,15 @@ class Combination extends AudioCalibrator {
908
916
  });
909
917
  let number_of_bursts_to_skip = 0;
910
918
  let time_to_sleep = 0;
911
- const fMLS = this.sourceSamplingRate / this._calibrateSoundBurstDownsample;
912
919
  if (this.mode === 'unfiltered') {
913
- time_to_sleep = (this.#mls[0].length / fMLS) * number_of_bursts_to_skip;
920
+ time_to_sleep = (this.#mls[0].length / this.sourceSamplingRate) * number_of_bursts_to_skip;
914
921
  } else if (this.mode === 'filtered') {
915
922
  console.log(this.#currentConvolution.length);
916
923
  // time_to_sleep =
917
924
  // (this.#currentConvolution.length / this.sourceSamplingRate) *
918
925
  // (number_of_bursts_to_skip / (number_of_bursts_to_skip + this.numMLSPerCapture));
919
- time_to_sleep = (this.#currentConvolution.length / fMLS) * number_of_bursts_to_skip;
926
+ time_to_sleep =
927
+ (this.#currentConvolution.length / this.sourceSamplingRate) * number_of_bursts_to_skip;
920
928
  } else {
921
929
  throw new Error('Mode broke in awaitSignalOnset');
922
930
  }
@@ -2410,7 +2418,7 @@ class Combination extends AudioCalibrator {
2410
2418
  const gainNode = audioContext.createGain();
2411
2419
  const taperGainNode = audioContext.createGain();
2412
2420
  const offsetGainNode = audioContext.createGain();
2413
- const totalDuration = this.CALIBRATION_TONE_DURATION * 1.2;
2421
+ const totalDuration = this.CALIBRATION_TONE_DURATION;
2414
2422
 
2415
2423
  oscilator.frequency.value = this.#CALIBRATION_TONE_FREQUENCY;
2416
2424
  oscilator.type = this.#CALIBRATION_TONE_TYPE;
@@ -2493,7 +2501,7 @@ class Combination extends AudioCalibrator {
2493
2501
  message: this.status,
2494
2502
  });
2495
2503
  }
2496
- const totalDuration = this.CALIBRATION_TONE_DURATION * 1.2;
2504
+ const totalDuration = this.CALIBRATION_TONE_DURATION;
2497
2505
  console.log('this.calibrationNodes', this.calibrationNodes);
2498
2506
  this.calibrationNodes[0].start(0);
2499
2507
  this.calibrationNodes[0].stop(totalDuration);
@@ -2544,7 +2552,7 @@ class Combination extends AudioCalibrator {
2544
2552
  getPower(rec.slice(0, this.calibrateSound1000HzPreSec * this.sourceSamplingRate)).toFixed(1)
2545
2553
  );
2546
2554
  console.log(
2547
- 'pre period power: ',
2555
+ 'sec period power: ',
2548
2556
  getPower(
2549
2557
  rec.slice(
2550
2558
  this.calibrateSound1000HzPreSec * this.sourceSamplingRate,
@@ -2553,7 +2561,7 @@ class Combination extends AudioCalibrator {
2553
2561
  ).toFixed(1)
2554
2562
  );
2555
2563
  console.log(
2556
- 'pre period power: ',
2564
+ 'post period power: ',
2557
2565
  getPower(
2558
2566
  rec.slice(
2559
2567
  (this.calibrateSound1000HzPreSec + this.calibrateSound1000HzSec) * this.sourceSamplingRate
@@ -2948,7 +2956,7 @@ class Combination extends AudioCalibrator {
2948
2956
  binDesiredSec: this._calibrateSoundPowerBinDesiredSec,
2949
2957
  burstSec: this.desired_time_per_mls,
2950
2958
  repeats: this.numMLSPerCapture - this.num_mls_to_skip,
2951
- warmUp: this.num_mls_to_skip,
2959
+ warmUp: this._calibrateSoundBurstPreSec,
2952
2960
  downsample: this._calibrateSoundBurstDownsample,
2953
2961
  })
2954
2962
  .then(result => {