speaker-calibration 2.2.263 → 2.2.265

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.263",
3
+ "version": "2.2.265",
4
4
  "description": "Speaker calibration library for auditory testing",
5
5
  "main": "dist/main.js",
6
6
  "directories": {
@@ -525,8 +525,8 @@ class Speaker extends AudioPeer {
525
525
  explanation.style.lineHeight = '1.5';
526
526
  explanation.innerHTML = formatLineBreak(
527
527
  this.phrases.RC_skipQR_ExplanationWithoutPreferNot[this.language]
528
- .replace('xxx', `<b style="user-select: text">${shortURL}</b>`)
529
- .replace('𝕏𝕏𝕏', `<b style="user-select: text">${shortURL}</b>`),
528
+ .replace('[[xxx]]', `<b style="user-select: text">${shortURL}</b>`)
529
+ .replace('[[XXX]]', `<b style="user-select: text">${shortURL}</b>`),
530
530
  this.phrases.RC_checkInternetConnection[this.language]
531
531
  );
532
532
 
@@ -622,14 +622,17 @@ class Speaker extends AudioPeer {
622
622
  // p.style.fontWeight = 'normal';
623
623
  // p.style.paddingTop = '20px';
624
624
  // const timeToCalibrateText = phrases.RC_howLongToCalibrate['en-US'];
625
- // p.innerHTML = timeToCalibrateText.replace('111', this.timeToCalibrate);
625
+ // p.innerHTML = timeToCalibrateText.replace('[[N11]]', this.timeToCalibrate);
626
626
  // instructionDisplay.appendChild(p);
627
627
  }
628
628
 
629
629
  const timeToCalibrateDisplay = document.getElementById(this.timeToCalibrateDisplay);
630
630
  if (timeToCalibrateDisplay) {
631
631
  const timeToCalibrateText = this.phrases.RC_howLongToCalibrate[this.language];
632
- timeToCalibrateDisplay.innerHTML = timeToCalibrateText.replace('𝟙𝟙𝟙', this.timeToCalibrate);
632
+ timeToCalibrateDisplay.innerHTML = timeToCalibrateText.replace(
633
+ '[[N11]]',
634
+ this.timeToCalibrate
635
+ );
633
636
  timeToCalibrateDisplay.style.fontWeight = 'normal';
634
637
  timeToCalibrateDisplay.style.fontSize = '1rem';
635
638
  // timeToCalibrateDisplay.style.paddingTop = '20px';
@@ -375,9 +375,9 @@ class Combination extends AudioCalibrator {
375
375
  : '';
376
376
 
377
377
  const samplingParamText = this.phrases.RC_SamplingHzBits[this.language]
378
- .replace('𝟙𝟙𝟙', this.sourceSamplingRate)
379
- .replace('𝟚𝟚𝟚', this.sinkSamplingRate)
380
- .replace('𝟛𝟛𝟛', this.calibrateSoundSamplingDesiredBits);
378
+ .replace('[[N11]]', this.sourceSamplingRate)
379
+ .replace('[[N22]]', this.sinkSamplingRate)
380
+ .replace('[[N33]]', this.calibrateSoundSamplingDesiredBits);
381
381
  const reportParameters = `${simulateText}${samplingParamText} ↓${this._calibrateSoundBurstDownsample}:1`;
382
382
  if (this.flags) {
383
383
  flags = `<br> autoGainControl: ${this.flags.autoGainControl}, echoCancellation: ${this.flags.echoCancellation}, noiseSuppression: ${this.flags.noiseSuppression}`;
@@ -843,12 +843,14 @@ class Combination extends AudioCalibrator {
843
843
  }
844
844
  this.recordingChecks['unfiltered'].push(result);
845
845
  console.log('start calculate impulse response');
846
- const usedPeriodStart = this._calibrateSoundBurstPreSec * this.sourceSamplingRate;
846
+ // const usedPeriodStart = this._calibrateSoundBurstPreSec * this.sourceSamplingRate;
847
+ const usedPeriodStart = this.num_mls_to_skip * this.sourceSamplingRate;
847
848
  const usedPeriodEnd =
848
849
  (this._calibrateSoundBurstPreSec +
849
850
  this._calibrateSoundBurstRepeats * this._calibrateSoundBurstSec) *
850
851
  this.sourceSamplingRate;
851
- const payload_skipped_warmUp = payload.slice(usedPeriodStart, usedPeriodEnd);
852
+ // const payload_skipped_warmUp = payload.slice(usedPeriodStart, usedPeriodEnd);
853
+ const payload_skipped_warmUp = payload.slice(usedPeriodStart);
852
854
 
853
855
  console.log('payload.length', payload.length);
854
856
  console.log('usedPeriodStart', usedPeriodStart);
@@ -1075,11 +1077,12 @@ class Combination extends AudioCalibrator {
1075
1077
  * @example
1076
1078
  */
1077
1079
  #createCalibrationNodeFromBuffer = dataBuffer => {
1078
- const mlsSignal = reorderMLS(
1079
- dataBuffer,
1080
- this.calibrateSound1000HzPreSec,
1081
- this.sourceSamplingRate
1082
- );
1080
+ const mlsSignal = dataBuffer;
1081
+ // reorderMLS(
1082
+ // dataBuffer,
1083
+ // this.calibrateSound1000HzPreSec,
1084
+ // this.sourceSamplingRate
1085
+ // );
1083
1086
  console.log('length databuffer');
1084
1087
  console.log(mlsSignal.length);
1085
1088
  if (!this.sourceAudioContext) {
@@ -2396,11 +2399,12 @@ class Combination extends AudioCalibrator {
2396
2399
  // Followed by two whole MLS. Followed by the initial 1 sec of MLS. Again, all the pieces together
2397
2400
  // should be one contiguous piece cut out from an infinitely repeating MLS.
2398
2401
  // Get the MLS signal for this capture
2399
- const mlsSignal = reorderMLS(
2400
- this.#mlsBufferView[this.icapture],
2401
- this.calibrateSound1000HzPreSec,
2402
- this.sourceSamplingRate
2403
- );
2402
+ const mlsSignal = this.#mlsBufferView[this.icapture];
2403
+ // reorderMLS(
2404
+ // this.#mlsBufferView[this.icapture],
2405
+ // this.calibrateSound1000HzPreSec,
2406
+ // this.sourceSamplingRate
2407
+ // );
2404
2408
 
2405
2409
  // Run the simulation
2406
2410
  await this.simulatedMLSCalibration(
@@ -3438,7 +3442,11 @@ class Combination extends AudioCalibrator {
3438
3442
  );
3439
3443
  console.log('this.recordingChecks: ', this.recordingChecks);
3440
3444
  console.log('this.soundCheck: ', this.soundCheck);
3441
- this.recordingChecks[this.soundCheck].push(result);
3445
+ if (this.recordingChecks[this.soundCheck]) {
3446
+ this.recordingChecks[this.soundCheck].push(result);
3447
+ } else {
3448
+ this.recordingChecks[this.soundCheck] = [result];
3449
+ }
3442
3450
  // Now we do at most 2 attempts if sd > _calibrateSoundBurstMaxSD_dB
3443
3451
  // Second attempt is the final
3444
3452
  if (this.numSuccessfulCaptured < 2) {
package/src/utils.js CHANGED
@@ -136,7 +136,7 @@ function interpolate(x, x0, x1, y0, y1) {
136
136
  export const formatLineBreak = (inputStr, checkInternetConnection) => {
137
137
  let finalStr = inputStr
138
138
  .replace(/\n/g, '<br>')
139
- .replace('𝕃𝕃𝕃', `<a href="#" id="check-connection">${checkInternetConnection}</a>`);
139
+ .replace('[[LLL]]', `<a href="#" id="check-connection">${checkInternetConnection}</a>`);
140
140
 
141
141
  console.log(finalStr);
142
142