speaker-calibration 2.2.199 → 2.2.201

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.199",
3
+ "version": "2.2.201",
4
4
  "description": "Speaker calibration library for auditory testing",
5
5
  "main": "dist/main.js",
6
6
  "directories": {
@@ -205,7 +205,8 @@ class Speaker extends AudioPeer {
205
205
  params.calibrateSound1000HzMaxSD_dB,
206
206
  params._calibrateSoundBurstMaxSD_dB,
207
207
  params.calibrateSoundSamplingDesiredBits,
208
- params.language
208
+ params.language,
209
+ params.loudspeakerModelName,
209
210
  );
210
211
  speaker.#removeUIElems();
211
212
  resolve(speaker.result);
@@ -709,7 +710,10 @@ class Speaker extends AudioPeer {
709
710
  params.calibrateSoundBurstNormalizeBy1000HzGainBool,
710
711
  params.calibrateSoundBurstScalarDB,
711
712
  params.calibrateSound1000HzMaxSD_dB,
712
- params._calibrateSoundBurstMaxSD_dB
713
+ params._calibrateSoundBurstMaxSD_dB,
714
+ params.calibrateSoundSamplingDesiredBits,
715
+ params.language,
716
+ params.loudspeakerModelName,
713
717
  );
714
718
  this.#removeUIElems();
715
719
  resolve(result);
@@ -315,9 +315,9 @@ class Combination extends AudioCalibrator {
315
315
  const samplingParamText = phrases.RC_SamplingHzBits[this.language].replace('111', this.sourceSamplingRate).replace('222',this.sinkSamplingRate).replace('333', this.calibrateSoundSamplingDesiredBits);
316
316
  const reportParameters = `<br> ${samplingParamText}`;
317
317
  if (this.flags) {
318
- flags = `<br> autoGainControl: ${this.flags.autoGainControl}
319
- <br>echoCancellation: ${this.flags.echoCancellation}
320
- <br>noiseSuppression: ${this.flags.noiseSuppression}`;
318
+ flags = `<br> autoGainControl: ${this.flags.autoGainControl};
319
+ echoCancellation: ${this.flags.echoCancellation};
320
+ noiseSuppression: ${this.flags.noiseSuppression}`;
321
321
  }
322
322
  if (this.SDofFilteredRange['mls']) {
323
323
  MLSsd = `<br> Recorded MLS power SD: ${this.SDofFilteredRange['mls']} dB`;
@@ -328,15 +328,15 @@ class Combination extends AudioCalibrator {
328
328
  if (this.SDofFilteredRange['component']) {
329
329
  componentSD = `<br> ${this.transducerType} correction SD: ${this.SDofFilteredRange['component']} dB`;
330
330
  }
331
- const template = `<div style="display: flex; justify-content: flex-start; margin-top:0.8rem;"><div style="width: 800px; height: 20px; border: 2px solid #000; border-radius: 10px;"><div style="width: ${this.percent_complete}%; height: 100%; background-color: #00aaff; border-radius: 8px;"></div></div></div>`;
331
+ const template = `<div style="display: flex; justify-content: flex-start; margin-top: 0.4rem;"><div style="width: 100%; height: 20px; border: 2px solid #000; border-radius: 10px;"><div style="width: ${this.percent_complete}%; height: 100%; background-color: #00aaff; border-radius: 8px;"></div></div></div>`;
332
332
  return `
333
333
  ${reportWebAudioNames}
334
- ${reportParameters}
335
- <br>${status}
334
+ ${reportParameters}
336
335
  ${MLSsd}
337
336
  ${systemSD}
338
337
  ${componentSD}
339
338
  ${flags}
339
+ <br>${status}
340
340
  ${template }`;
341
341
  };
342
342
 
@@ -612,7 +612,7 @@ class Combination extends AudioCalibrator {
612
612
  } else {
613
613
  console.log('SD: ' + result['sd'] + ', greater than _calibrateSoundBurstMaxSD_dB: ' + this._calibrateSoundBurstMaxSD_dB);
614
614
  this.recordingChecks['warnings'].push(`Redo all Hz recording because SD ${result['sd']} dB> ${this._calibrateSoundBurstMaxSD_dB} dB`);
615
- this.status = this.generateTemplate(`Redoing all Hz recording because SD ${result['sd']} dB> ${this._calibrateSoundBurstMaxSD_dB} dB`.toString()).toString();
615
+ this.status = this.generateTemplate(`All Hz: Re-recording at ${this.inDB} dB because SD ${result['sd']} > ${this._calibrateSoundBurstMaxSD_dB} dB`.toString()).toString();
616
616
  this.emit('update', {
617
617
  message: this.status,
618
618
  });
@@ -2194,8 +2194,8 @@ class Combination extends AudioCalibrator {
2194
2194
  #playCalibrationAudioVolume = async () => {
2195
2195
  if (this.numCalibratingRoundsCompleted==1) {
2196
2196
  this.recordingChecks['warnings'].push(`Redo 1000 Hz, ${this.inDB} dB, recording because SD ${(this.recordingChecks['volume'][this.inDB]['sd'])} dB> ${this.calibrateSound1000HzMaxSD_dB} dB`);
2197
- const currentStatus = `Redoing 1000 Hz recording because SD
2198
- ${this.recordingChecks['volume'][this.inDB]['sd']} dB>
2197
+ const currentStatus = `1000 Hz: Re-recording at ${this.inDB} dB because SD
2198
+ ${this.recordingChecks['volume'][this.inDB]['sd']} >
2199
2199
  ${this.calibrateSound1000HzMaxSD_dB} dB`.toString();
2200
2200
  this.status = this.generateTemplate(currentStatus).toString();
2201
2201
  this.emit('update', {
@@ -2220,9 +2220,12 @@ class Combination extends AudioCalibrator {
2220
2220
  #sendToServerForProcessing = async lCalib => {
2221
2221
  console.log('Sending data to server');
2222
2222
  const total_dur = this.calibrateSound1000HzPreSec + this.calibrateSound1000HzSec + this.calibrateSound1000HzPostSec;
2223
- this.addTimeStamp(`Record ${total_dur.toFixed(1)} s of 1000 Hz at ${this.inDB} dB.
2224
- (${this.calibrateSound1000HzPreSec.toFixed(1)} s pre + ${this.calibrateSound1000HzSec.toFixed(1)}
2225
- s used + ${this.calibrateSound1000HzPostSec.toFixed(1)} s post) ”`);
2223
+ this.addTimeStamp("Record " + total_dur.toFixed(1) + " s of 1000 Hz at " + this.inDB +
2224
+ " dB. (" + this.calibrateSound1000HzPreSec.toFixed(1) +
2225
+ " s pre + " + this.calibrateSound1000HzSec.toFixed(1) +
2226
+ " s used + " + this.calibrateSound1000HzPostSec.toFixed(1) +
2227
+ " s post)"
2228
+ );
2226
2229
  let left = this.calibrateSound1000HzPreSec;
2227
2230
  let right = this.calibrateSound1000HzPreSec + this.calibrateSound1000HzSec;
2228
2231
  if (this.isCalibrating) return null;
@@ -2607,7 +2610,7 @@ class Combination extends AudioCalibrator {
2607
2610
  if (result['sd'] > this._calibrateSoundBurstMaxSD_dB && this.numSuccessfulCaptured == 0) {
2608
2611
  console.log('filtered recording sd too high');
2609
2612
  this.recordingChecks['warnings'].push(`Redo all Hz recording because SD ${result['sd']} dB> ${this._calibrateSoundBurstMaxSD_dB} dB`);
2610
- this.status = this.generateTemplate(`Redoing all Hz recording because SD ${result['sd']} dB> ${this._calibrateSoundBurstMaxSD_dB} dB`.toString()).toString();
2613
+ this.status = this.generateTemplate(`All Hz: Re-recording at ${this.inDB} dB because SD ${result['sd']} > ${this._calibrateSoundBurstMaxSD_dB} dB`.toString()).toString();
2611
2614
  this.emit('update', {
2612
2615
  message: this.status,
2613
2616
  });
@@ -2705,8 +2708,11 @@ class Combination extends AudioCalibrator {
2705
2708
  _calibrateSoundBurstMaxSD_dB = 4,
2706
2709
  calibrateSoundSamplingDesiredBits = 24,
2707
2710
  language,
2711
+ loudspeakerModelName='',
2708
2712
 
2709
2713
  ) => {
2714
+ this.micModelName = micModelName,
2715
+ this.loudspeakerModelName = loudspeakerModelName;
2710
2716
  this.language = language;
2711
2717
  this.TAPER_SECS = _calibrateSoundTaperSec;
2712
2718
  this.calibrateSoundLimit = calibrateSoundLimit;
@@ -2738,9 +2744,9 @@ class Combination extends AudioCalibrator {
2738
2744
  this.webAudioDeviceNames = webAudioDeviceNames;
2739
2745
  this.calibrateSoundSamplingDesiredBits = calibrateSoundSamplingDesiredBits;
2740
2746
  if (isSmartPhone) this.webAudioDeviceNames.microphone = this.deviceInfo.microphoneFromAPI;
2741
- this.webAudioDeviceNames.microphoneText = this.webAudioDeviceNames.microphoneText
2742
- .replace('xxx', this.webAudioDeviceNames.microphone)
2743
- .replace('XXX', this.webAudioDeviceNames.microphone);
2747
+ // this.webAudioDeviceNames.microphoneText = this.webAudioDeviceNames.microphoneText
2748
+ // .replace('xxx', this.webAudioDeviceNames.microphone)
2749
+ // .replace('XXX', this.webAudioDeviceNames.microphone);
2744
2750
  //feed calibration goal here
2745
2751
  this._calibrateSoundCheck = _calibrateSoundCheck;
2746
2752
  this.calibrateSound1000HzMaxSD_dB = calibrateSound1000HzMaxSD_dB;