speaker-calibration 2.2.145 → 2.2.147

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.145",
3
+ "version": "2.2.147",
4
4
  "description": "Speaker calibration library for auditory testing",
5
5
  "main": "dist/main.js",
6
6
  "directories": {
@@ -99,6 +99,7 @@ class Speaker extends AudioPeer {
99
99
  params.calibrateSoundBurstDb,
100
100
  params.calibrateSoundBurstFilteredExtraDb,
101
101
  params.calibrateSoundBurstLevelReTBool,
102
+ params.calibrateSoundBurstUses1000HzGainBool,
102
103
  params.calibrateSoundBurstRepeats,
103
104
  params.calibrateSoundBurstSec,
104
105
  params.calibrateSoundBurstsWarmup,
@@ -503,6 +504,7 @@ class Speaker extends AudioPeer {
503
504
  params.calibrateSoundBurstDb,
504
505
  params.calibrateSoundBurstFilteredExtraDb,
505
506
  params.calibrateSoundBurstLevelReTBool,
507
+ params.calibrateSoundBurstUses1000HzGainBool,
506
508
  params.calibrateSoundBurstRepeats,
507
509
  params.calibrateSoundBurstSec,
508
510
  params.calibrateSoundBurstsWarmup,
@@ -111,6 +111,9 @@ class Combination extends AudioCalibrator {
111
111
  /** @private */
112
112
  componentConvolution;
113
113
 
114
+ /** @private */
115
+ componentConvolutionNoBandpass;
116
+
114
117
  /** @private */
115
118
  componentIROrigin = {
116
119
  Freq: [],
@@ -120,6 +123,9 @@ class Combination extends AudioCalibrator {
120
123
  /** @private */
121
124
  systemConvolution;
122
125
 
126
+ /** @private */
127
+ systemConvolutionNoBandpass;
128
+
123
129
  ////////////////////////volume
124
130
  /** @private */
125
131
  #CALIBRATION_TONE_FREQUENCY = 1000; // Hz
@@ -375,6 +381,7 @@ class Combination extends AudioCalibrator {
375
381
  this.systemInvertedImpulseResponseNoBandpass = res['iirNoBandpass'];
376
382
  this.systemAttenuatorGainDB = res['attenuatorGain_dB'];
377
383
  this.systemFMaxHz = res['fMaxHz'];
384
+ this.systemConvolutionNoBandpass = res['convolutionNoBandpass'];
378
385
 
379
386
  // attenuate the system convolution if the amplitude is greater than this.calibrateSoundLimit
380
387
  // find max of absolute value of system convolution
@@ -454,6 +461,7 @@ class Combination extends AudioCalibrator {
454
461
  this.componentIROrigin['Freq'] = res['frequencies'];
455
462
  this.componentIROrigin['Gain'] = res['irOrigin'];
456
463
  this.componentConvolution = res['convolution'];
464
+ this.componentConvolutionNoBandpass = res['convolutionNoBandpass'];
457
465
  this.componentInvertedImpulseResponseNoBandpass = res['iirNoBandpass'];
458
466
  this.componentIRInTimeDomain = res['irTime'];
459
467
  this.componentAttenuatorGainDB = res['attenuatorGain_dB'];
@@ -1087,6 +1095,23 @@ class Combination extends AudioCalibrator {
1087
1095
  console.error(err);
1088
1096
  });
1089
1097
 
1098
+ let system_no_bandpass_filtered_mls_psd = await this.pyServerAPI
1099
+ .getMLSPSDWithRetry({
1100
+ mls: this.systemConvolution,
1101
+ sampleRate: this.sourceSamplingRate || 96000,
1102
+ })
1103
+ .then(res => {
1104
+ this.incrementStatusBar();
1105
+ this.status =
1106
+ `All Hz Calibration: done computing the PSD graphs...`.toString() +
1107
+ this.generateTemplate().toString();
1108
+ this.emit('update', {message: this.status});
1109
+ return res;
1110
+ })
1111
+ .catch(err => {
1112
+ console.error(err);
1113
+ });
1114
+
1090
1115
  this.addTimeStamp('Get PSD of filered mls (component)');
1091
1116
  if (this.isCalibrating) return null;
1092
1117
  let component_filtered_mls_psd = await this.pyServerAPI
@@ -1106,6 +1131,23 @@ class Combination extends AudioCalibrator {
1106
1131
  console.error(err);
1107
1132
  });
1108
1133
 
1134
+ let component_no_bandpass_filtered_mls_psd = await this.pyServerAPI
1135
+ .getMLSPSDWithRetry({
1136
+ mls: this.componentConvolutionNoBandpass,
1137
+ sampleRate: this.sourceSamplingRate || 96000,
1138
+ })
1139
+ .then(res => {
1140
+ this.incrementStatusBar();
1141
+ this.status =
1142
+ `All Hz Calibration: done computing the PSD graphs...`.toString() +
1143
+ this.generateTemplate().toString();
1144
+ this.emit('update', {message: this.status});
1145
+ return res;
1146
+ })
1147
+ .catch(err => {
1148
+ console.error(err);
1149
+ });
1150
+
1109
1151
  let gainValue = this.getGainDBSPL();
1110
1152
 
1111
1153
  iir_ir_and_plots = {
@@ -1128,7 +1170,12 @@ class Combination extends AudioCalibrator {
1128
1170
  x: system_filtered_mls_psd['x_mls'],
1129
1171
  y: system_filtered_mls_psd['y_mls'],
1130
1172
  },
1173
+ filtered_no_bandpass_mls_psd: {
1174
+ x: system_no_bandpass_filtered_mls_psd['x_mls'],
1175
+ y: system_no_bandpass_filtered_mls_psd['y_mls'],
1176
+ },
1131
1177
  convolution: this.systemConvolution,
1178
+ convolutionNoBandpass: this.systemConvolutionNoBandpass,
1132
1179
  psd: {
1133
1180
  unconv: {
1134
1181
  x: system_recs_psd['x_unconv'],
@@ -1156,7 +1203,12 @@ class Combination extends AudioCalibrator {
1156
1203
  x: component_filtered_mls_psd['x_mls'],
1157
1204
  y: component_filtered_mls_psd['y_mls'],
1158
1205
  },
1206
+ filtered_no_bandpass_mls_psd: {
1207
+ x: component_no_bandpass_filtered_mls_psd['x_mls'],
1208
+ y: component_no_bandpass_filtered_mls_psd['y_mls'],
1209
+ },
1159
1210
  convolution: this.componentConvolution,
1211
+ convolutionNoBandpass: this.componentConvolutionNoBandpass,
1160
1212
  psd: {
1161
1213
  unconv: {
1162
1214
  x: component_unconv_rec_psd['x'],
@@ -1394,6 +1446,23 @@ class Combination extends AudioCalibrator {
1394
1446
  console.error(err);
1395
1447
  });
1396
1448
 
1449
+ let filtered_no_bandpass_mls_psd = await this.pyServerAPI
1450
+ .getMLSPSDWithRetry({
1451
+ mls: this.componentConvolutionNoBandpass,
1452
+ sampleRate: this.sourceSamplingRate || 96000,
1453
+ })
1454
+ .then(res => {
1455
+ this.incrementStatusBar();
1456
+ this.status =
1457
+ `All Hz Calibration: done computing the PSD graphs...`.toString() +
1458
+ this.generateTemplate().toString();
1459
+ this.emit('update', {message: this.status});
1460
+ return res;
1461
+ })
1462
+ .catch(err => {
1463
+ console.error(err);
1464
+ });
1465
+
1397
1466
  let gainValue = this.getGainDBSPL();
1398
1467
  iir_ir_and_plots = {
1399
1468
  unfiltered_recording: return_unconv_rec,
@@ -1410,7 +1479,9 @@ class Combination extends AudioCalibrator {
1410
1479
  },
1411
1480
  filtered_recording: [],
1412
1481
  filtered_mls_psd: {},
1482
+ filtered_no_bandpass_mls_psd: {},
1413
1483
  convolution: this.systemConvolution,
1484
+ convolutionNoBandpass: this.systemConvolutionNoBandpass,
1414
1485
  psd: {
1415
1486
  unconv: {
1416
1487
  x: [],
@@ -1438,7 +1509,12 @@ class Combination extends AudioCalibrator {
1438
1509
  x: filtered_mls_psd['x_mls'],
1439
1510
  y: filtered_mls_psd['y_mls'],
1440
1511
  },
1512
+ filtered_no_bandpass_mls_psd: {
1513
+ x: filtered_no_bandpass_mls_psd['x_mls'],
1514
+ y: filtered_no_bandpass_mls_psd['y_mls'],
1515
+ },
1441
1516
  convolution: this.componentConvolution,
1517
+ convolutionNoBandpass: this.componentConvolutionNoBandpass,
1442
1518
  psd: {
1443
1519
  unconv: {
1444
1520
  x: unconv_results['x'],
@@ -1578,6 +1654,23 @@ class Combination extends AudioCalibrator {
1578
1654
  console.error(err);
1579
1655
  });
1580
1656
 
1657
+ let filtered_no_bandpass_mls_psd = await this.pyServerAPI
1658
+ .getMLSPSDWithRetry({
1659
+ mls: this.systemConvolutionNoBandpass,
1660
+ sampleRate: this.sourceSamplingRate || 96000,
1661
+ })
1662
+ .then(res => {
1663
+ this.incrementStatusBar();
1664
+ this.status =
1665
+ `All Hz Calibration: done computing the PSD graphs...`.toString() +
1666
+ this.generateTemplate().toString();
1667
+ this.emit('update', {message: this.status});
1668
+ return res;
1669
+ })
1670
+ .catch(err => {
1671
+ console.error(err);
1672
+ });
1673
+
1581
1674
  let gainValue = this.getGainDBSPL();
1582
1675
  iir_ir_and_plots = {
1583
1676
  unfiltered_recording: return_unconv_rec,
@@ -1597,7 +1690,12 @@ class Combination extends AudioCalibrator {
1597
1690
  x: filtered_mls_psd['x_mls'],
1598
1691
  y: filtered_mls_psd['y_mls'],
1599
1692
  },
1693
+ filtered_no_bandpass_mls_psd: {
1694
+ x: filtered_no_bandpass_mls_psd['x_mls'],
1695
+ y: filtered_no_bandpass_mls_psd['y_mls'],
1696
+ },
1600
1697
  convolution: this.systemConvolution,
1698
+ convolutionNoBandpass: this.systemConvolutionNoBandpass,
1601
1699
  psd: {
1602
1700
  unconv: {
1603
1701
  x: results['x_unconv'],
@@ -1622,7 +1720,9 @@ class Combination extends AudioCalibrator {
1622
1720
  x_no_bandpass: component_iir_psd['x_unconv'],
1623
1721
  },
1624
1722
  filtered_mls_psd: {},
1723
+ filtered_no_bandpass_mls_psd: {},
1625
1724
  convolution: this.componentConvolution,
1725
+ convolutionNoBandpass: this.componentConvolutionNoBandpass,
1626
1726
  psd: {
1627
1727
  unconv: {
1628
1728
  x: [],
@@ -1835,6 +1935,7 @@ class Combination extends AudioCalibrator {
1835
1935
  },
1836
1936
  filtered_recording: [],
1837
1937
  convolution: this.systemConvolution,
1938
+ convolutionNoBandpass: this.systemConvolutionNoBandpass,
1838
1939
  psd: {
1839
1940
  unconv: {
1840
1941
  x: [],
@@ -1858,6 +1959,7 @@ class Combination extends AudioCalibrator {
1858
1959
  x_no_bandpass: component_iir_psd['x_unconv'],
1859
1960
  },
1860
1961
  convolution: this.componentConvolution,
1962
+ convolutionNoBandpass: this.componentConvolutionNoBandpass,
1861
1963
  psd: {
1862
1964
  unconv: {
1863
1965
  x: [],
@@ -2470,6 +2572,7 @@ class Combination extends AudioCalibrator {
2470
2572
  _calibrateSoundBurstDb = -18,
2471
2573
  _calibrateSoundBurstFilteredExtraDb = 6,
2472
2574
  _calibrateSoundBurstLevelReTBool = false,
2575
+ _calibrateSoundBurstUses1000HzGainBool = false,
2473
2576
  _calibrateSoundBurstRepeats = 3,
2474
2577
  _calibrateSoundBurstSec = 1,
2475
2578
  _calibrateSoundBurstsWarmup = 1,
@@ -2517,6 +2620,7 @@ class Combination extends AudioCalibrator {
2517
2620
  this._calibrateSoundBackgroundSecs = _calibrateSoundBackgroundSecs;
2518
2621
  this._calibrateSoundSmoothOctaves = _calibrateSoundSmoothOctaves;
2519
2622
  this._calibrateSoundPowerBinDesiredSec = _calibrateSoundPowerBinDesiredSec;
2623
+ this._calibrateSoundBurstUses1000HzGainBool = _calibrateSoundBurstUses1000HzGainBool;
2520
2624
  this._calibrateSoundPowerDbSDToleratedDb = _calibrateSoundPowerDbSDToleratedDb;
2521
2625
  this.webAudioDeviceNames = webAudioDeviceNames;
2522
2626
  if (isSmartPhone) this.webAudioDeviceNames.microphone = this.deviceInfo.microphoneFromAPI;