speaker-calibration 2.2.247 → 2.2.249

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.
Files changed (121) hide show
  1. package/.eslintignore +71 -71
  2. package/.eslintrc.json +40 -40
  3. package/.gitignore +81 -0
  4. package/.prettierignore +69 -69
  5. package/.prettierrc +14 -14
  6. package/LICENSE +20 -20
  7. package/README.md +133 -133
  8. package/__mocks__/fileMock.js +1 -1
  9. package/__mocks__/styleMock.js +1 -1
  10. package/babel.config.js +3 -3
  11. package/coverage/clover.xml +71 -71
  12. package/coverage/coverage-final.json +224 -224
  13. package/coverage/lcov-report/PythonServerInterface.js.html +265 -265
  14. package/coverage/lcov-report/base.css +354 -354
  15. package/coverage/lcov-report/block-navigation.js +82 -82
  16. package/coverage/lcov-report/index.html +123 -123
  17. package/coverage/lcov-report/prettify.css +101 -101
  18. package/coverage/lcov-report/prettify.js +937 -937
  19. package/coverage/lcov-report/sorter.js +189 -189
  20. package/coverage/lcov-report/src/index.html +121 -121
  21. package/coverage/lcov-report/src/server/PythonServerInterface.js.html +268 -268
  22. package/coverage/lcov-report/src/server/index.html +123 -123
  23. package/coverage/lcov-report/src/tasks/audioCalibrator.js.html +499 -499
  24. package/coverage/lcov-report/src/tasks/audioRecorder.js.html +412 -412
  25. package/coverage/lcov-report/src/tasks/index.html +143 -143
  26. package/coverage/lcov-report/src/tasks/volume/index.html +123 -123
  27. package/coverage/lcov-report/src/tasks/volume/volume.js.html +409 -409
  28. package/coverage/lcov-report/src/utils.js.html +172 -172
  29. package/coverage/lcov.info +91 -91
  30. package/dist/example/NoSleep.min.js +1 -1
  31. package/dist/example/fetch-languages-sheets.js +77 -77
  32. package/dist/example/i18n.js +29654 -30000
  33. package/dist/example/index.html +47 -47
  34. package/dist/example/listener.html +81 -81
  35. package/dist/example/server.js +51 -51
  36. package/dist/example/speaker.html +145 -145
  37. package/dist/example/speakerUI.js +273 -273
  38. package/dist/example/styles.css +152 -152
  39. package/dist/main.js +1 -1
  40. package/dist/mlsGen.js +6814 -6814
  41. package/dist/mlsGen.wasm +0 -0
  42. package/dist/package-lock.json +1018 -1018
  43. package/dist/package.json +18 -18
  44. package/doc/AudioCalibrator.html +417 -417
  45. package/doc/AudioPeer.html +251 -251
  46. package/doc/AudioRecorder.html +195 -195
  47. package/doc/ImpulseResponse.html +215 -215
  48. package/doc/Listener.html +308 -308
  49. package/doc/MlsGenInterface.html +226 -226
  50. package/doc/MyEventEmitter.html +274 -274
  51. package/doc/PythonServerAPI.html +109 -109
  52. package/doc/Speaker.html +276 -276
  53. package/doc/Takes%20a%20target%20element%20where%20html%20elements%20will%20be%20appended..html +128 -128
  54. package/doc/Takes%20the%20url%20of%20the%20current%20site%0Aand%20a%20target%20element%20where%20html%20elements%20will%20be%20appended..html +138 -138
  55. package/doc/Takes%20the%20url%20of%20the%20current%20site%20and%20a%20target%20element%20where%20html%20elements%20will%20be%20appended..html +137 -137
  56. package/doc/Volume.html +88 -88
  57. package/doc/audioCalibrator.js.html +179 -179
  58. package/doc/audioPeer.js.html +175 -175
  59. package/doc/audioRecorder.js.html +163 -163
  60. package/doc/creates%20a%20new%20AudioRecorder%20instance.%20%0ASets%20up%20the%20audio%20context%20and%20file%20reader..html +114 -114
  61. package/doc/fonts/OpenSans-Bold-webfont.svg +1829 -1829
  62. package/doc/fonts/OpenSans-BoldItalic-webfont.svg +1829 -1829
  63. package/doc/fonts/OpenSans-Italic-webfont.svg +1829 -1829
  64. package/doc/fonts/OpenSans-Light-webfont.svg +1830 -1830
  65. package/doc/fonts/OpenSans-LightItalic-webfont.svg +1834 -1834
  66. package/doc/fonts/OpenSans-Regular-webfont.svg +1830 -1830
  67. package/doc/global.html +308 -308
  68. package/doc/index.html +58 -58
  69. package/doc/listener.js.html +170 -170
  70. package/doc/mlsGen_mlsGenInterface.js.html +117 -117
  71. package/doc/myEventEmitter.js.html +124 -124
  72. package/doc/peer-connection_audioPeer.js.html +188 -188
  73. package/doc/peer-connection_listener.js.html +311 -311
  74. package/doc/peer-connection_speaker.js.html +381 -381
  75. package/doc/scripts/linenumber.js +25 -25
  76. package/doc/scripts/prettify/Apache-License-2.0.txt +202 -202
  77. package/doc/scripts/prettify/lang-css.js +24 -24
  78. package/doc/scripts/prettify/prettify.js +640 -640
  79. package/doc/server_PythonServerAPI.js.html +160 -160
  80. package/doc/speaker.js.html +248 -248
  81. package/doc/styles/jsdoc-default.css +371 -371
  82. package/doc/styles/prettify-jsdoc.css +111 -111
  83. package/doc/styles/prettify-tomorrow.css +163 -163
  84. package/doc/tasks_audioCalibrator.js.html +207 -207
  85. package/doc/tasks_audioRecorder.js.html +190 -190
  86. package/doc/tasks_impulse-response_impulseResponse.js.html +442 -442
  87. package/doc/tasks_impulse-response_mlsGen_mlsGenInterface.js.html +175 -175
  88. package/doc/tasks_volume_volume.js.html +185 -185
  89. package/doc/utils.js.html +105 -105
  90. package/jest.config.js +173 -173
  91. package/netlify.toml +26 -26
  92. package/package.json +78 -78
  93. package/src/config/firebase.js +26 -26
  94. package/src/index.html +21 -21
  95. package/src/listener-app/PhonePeer.js +474 -474
  96. package/src/listener-app/listener.js +377 -377
  97. package/src/main.js +22 -22
  98. package/src/myEventEmitter.js +83 -83
  99. package/src/peer-connection/audioPeer.js +100 -100
  100. package/src/peer-connection/listener.js +299 -299
  101. package/src/peer-connection/peerErrors.js +25 -25
  102. package/src/peer-connection/speaker.js +963 -963
  103. package/src/powerCheck.js +110 -110
  104. package/src/server/PythonServerAPI.js +959 -959
  105. package/src/tasks/combination/combination.js +44 -29
  106. package/src/tasks/combination/mlsGen/mlsGen.cpp +98 -98
  107. package/src/tasks/combination/mlsGen/mlsGen.hpp +303 -303
  108. package/src/tasks/combination/mlsGen/mlsGenInterface.js +131 -131
  109. package/src/tasks/combination/mlsGen/mlsGenTest.cpp +180 -180
  110. package/src/tasks/impulse-response/impulseResponse.js +610 -610
  111. package/src/tasks/impulse-response/mlsGen/mlsGen.cpp +98 -98
  112. package/src/tasks/impulse-response/mlsGen/mlsGen.hpp +303 -303
  113. package/src/tasks/impulse-response/mlsGen/mlsGenInterface.js +131 -131
  114. package/src/tasks/impulse-response/mlsGen/mlsGenTest.cpp +180 -180
  115. package/src/tasks/volume/volume.cpp +2 -2
  116. package/src/tasks/volume/volume.hpp +22 -22
  117. package/src/tasks/volume/volume.js +279 -279
  118. package/src/utils.js +205 -205
  119. package/webpack.config.js +65 -65
  120. package/.github/workflows/update-phrases.yml +0 -37
  121. package/makefile +0 -74
@@ -704,7 +704,7 @@ class Combination extends AudioCalibrator {
704
704
  this.background_noise['y_background'] = res['y_background'];
705
705
  this.background_noise['recording'] = background_rec;
706
706
  }
707
- this.addTimeStamp('Compute PSD of background');
707
+ this.addTimeStamp('Compute spectrum of background');
708
708
  })
709
709
  .catch(err => {
710
710
  console.error(err);
@@ -1313,7 +1313,7 @@ class Combination extends AudioCalibrator {
1313
1313
  let knownGain = this.oldComponentIR.Gain;
1314
1314
  let knownFreq = this.oldComponentIR.Freq;
1315
1315
  let sampleRate = this.sourceSamplingRate || 96000;
1316
- this.addTimeStamp('Compute PSD of MLS recording');
1316
+ this.addTimeStamp('Compute spectrum of MLS recording');
1317
1317
  if (this.isCalibrating) return null;
1318
1318
  let component_unconv_rec_psd = await this.pyServerAPI
1319
1319
  .getSubtractedPSDWithRetry(
@@ -1335,7 +1335,7 @@ class Combination extends AudioCalibrator {
1335
1335
  console.error(err);
1336
1336
  });
1337
1337
 
1338
- this.addTimeStamp('Compute PSD of filtered recording (component)');
1338
+ this.addTimeStamp('Compute spectrum of filtered recording (component)');
1339
1339
  if (this.isCalibrating) return null;
1340
1340
  let component_conv_rec_psd = await this.pyServerAPI
1341
1341
  .getSubtractedPSDWithRetry(
@@ -1379,7 +1379,7 @@ class Combination extends AudioCalibrator {
1379
1379
 
1380
1380
  conv_rec = system_conv_recs[system_conv_recs.length - 1];
1381
1381
  //psd of system
1382
- this.addTimeStamp('Compute PSD of filtered recording (system) and unfiltered recording');
1382
+ this.addTimeStamp('Compute spectrum of filtered recording (system) and unfiltered recording');
1383
1383
  if (this.isCalibrating) return null;
1384
1384
  let system_recs_psd = await this.pyServerAPI
1385
1385
  .getPSDWithRetry({
@@ -1419,7 +1419,7 @@ class Combination extends AudioCalibrator {
1419
1419
  //iir w/ and without bandpass psd. done
1420
1420
  unconv_rec = this.componentInvertedImpulseResponseNoBandpass;
1421
1421
  conv_rec = this.componentInvertedImpulseResponse;
1422
- this.addTimeStamp('Compute PSD of component IIR and component IIR no band pass');
1422
+ this.addTimeStamp('Compute spectrum of component IIR and component IIR no band pass');
1423
1423
  if (this.isCalibrating) return null;
1424
1424
  let component_iir_psd = await this.pyServerAPI
1425
1425
  .getPSDWithRetry({
@@ -1441,7 +1441,7 @@ class Combination extends AudioCalibrator {
1441
1441
  });
1442
1442
  unconv_rec = this.systemInvertedImpulseResponseNoBandpass;
1443
1443
  conv_rec = this.systemInvertedImpulseResponse;
1444
- this.addTimeStamp('Compute PSD of system IIR and system IIR no band pass');
1444
+ this.addTimeStamp('Compute spectrum of system IIR and system IIR no band pass');
1445
1445
  if (this.isCalibrating) return null;
1446
1446
  let system_iir_psd = await this.pyServerAPI
1447
1447
  .getPSDWithRetry({
@@ -1453,7 +1453,7 @@ class Combination extends AudioCalibrator {
1453
1453
  .then(res => {
1454
1454
  this.incrementStatusBar();
1455
1455
  this.status = this.generateTemplate(
1456
- `All Hz Calibration: done computing the PSD graphs...`.toString()
1456
+ `All Hz Calibration: done computing the spectrum graphs...`.toString()
1457
1457
  ).toString();
1458
1458
  this.emit('update', {message: this.status});
1459
1459
  return res;
@@ -1462,7 +1462,7 @@ class Combination extends AudioCalibrator {
1462
1462
  console.error(err);
1463
1463
  });
1464
1464
 
1465
- this.addTimeStamp('Compute PSD of MLS sequence');
1465
+ this.addTimeStamp('Compute spectrum of MLS sequence');
1466
1466
  if (this.isCalibrating) return null;
1467
1467
  let mls_psd = await this.pyServerAPI
1468
1468
  .getMLSPSDWithRetry({
@@ -1473,7 +1473,7 @@ class Combination extends AudioCalibrator {
1473
1473
  .then(res => {
1474
1474
  this.incrementStatusBar();
1475
1475
  this.status = this.generateTemplate(
1476
- `All Hz Calibration: done computing the PSD graphs...`.toString()
1476
+ `All Hz Calibration: done computing the spectrum graphs...`.toString()
1477
1477
  ).toString();
1478
1478
  this.emit('update', {message: this.status});
1479
1479
  return res;
@@ -1482,7 +1482,7 @@ class Combination extends AudioCalibrator {
1482
1482
  console.error(err);
1483
1483
  });
1484
1484
 
1485
- this.addTimeStamp('Compute PSD of filtered MLS (system)');
1485
+ this.addTimeStamp('Compute spectrum of filtered MLS (system)');
1486
1486
  if (this.isCalibrating) return null;
1487
1487
  let system_filtered_mls_psd = await this.pyServerAPI
1488
1488
  .getMLSPSDWithRetry({
@@ -1493,7 +1493,7 @@ class Combination extends AudioCalibrator {
1493
1493
  .then(res => {
1494
1494
  this.incrementStatusBar();
1495
1495
  this.status = this.generateTemplate(
1496
- `All Hz Calibration: done computing the PSD graphs...`.toString()
1496
+ `All Hz Calibration: done computing the spectrum graphs...`.toString()
1497
1497
  ).toString();
1498
1498
  this.emit('update', {message: this.status});
1499
1499
  return res;
@@ -1511,7 +1511,7 @@ class Combination extends AudioCalibrator {
1511
1511
  .then(res => {
1512
1512
  this.incrementStatusBar();
1513
1513
  this.status = this.generateTemplate(
1514
- `All Hz Calibration: done computing the PSD graphs...`.toString()
1514
+ `All Hz Calibration: done computing the spectrum graphs...`.toString()
1515
1515
  ).toString();
1516
1516
  this.emit('update', {message: this.status});
1517
1517
  return res;
@@ -1520,7 +1520,7 @@ class Combination extends AudioCalibrator {
1520
1520
  console.error(err);
1521
1521
  });
1522
1522
 
1523
- this.addTimeStamp('Compute PSD of filtered MLS (component)');
1523
+ this.addTimeStamp('Compute spectrum of filtered MLS (component)');
1524
1524
  if (this.isCalibrating) return null;
1525
1525
  let component_filtered_mls_psd = await this.pyServerAPI
1526
1526
  .getMLSPSDWithRetry({
@@ -1531,7 +1531,7 @@ class Combination extends AudioCalibrator {
1531
1531
  .then(res => {
1532
1532
  this.incrementStatusBar();
1533
1533
  this.status = this.generateTemplate(
1534
- `All Hz Calibration: done computing the PSD graphs...`.toString()
1534
+ `All Hz Calibration: done computing the spectrum graphs...`.toString()
1535
1535
  ).toString();
1536
1536
  this.emit('update', {message: this.status});
1537
1537
  return res;
@@ -1549,7 +1549,7 @@ class Combination extends AudioCalibrator {
1549
1549
  .then(res => {
1550
1550
  this.incrementStatusBar();
1551
1551
  this.status = this.generateTemplate(
1552
- `All Hz Calibration: done computing the PSD graphs...`.toString()
1552
+ `All Hz Calibration: done computing the spectrum graphs...`.toString()
1553
1553
  ).toString();
1554
1554
  this.emit('update', {message: this.status});
1555
1555
  return res;
@@ -1735,8 +1735,8 @@ class Combination extends AudioCalibrator {
1735
1735
  }
1736
1736
  }
1737
1737
  this.clearAllFilteredRecordedSignals();
1738
- console.log('Obtaining unfiltered recording from #allHzUnfilteredRecordings to calculate PSD');
1739
- console.log('Obtaining filtered recording from #allHzFilteredRecordings to calculate PSD');
1738
+ console.log('Obtaining unfiltered recording from #allHzUnfilteredRecordings to calculate spectrum');
1739
+ console.log('Obtaining filtered recording from #allHzFilteredRecordings to calculate spectrum');
1740
1740
  let unconv_rec = recs[0];
1741
1741
  let return_unconv_rec = unconv_rec;
1742
1742
  let conv_rec = conv_recs[conv_recs.length - 1];
@@ -1752,7 +1752,7 @@ class Combination extends AudioCalibrator {
1752
1752
  let knownGain = this.oldComponentIR.Gain;
1753
1753
  let knownFreq = this.oldComponentIR.Freq;
1754
1754
  let sampleRate = this.sourceSamplingRate || 96000;
1755
- this.addTimeStamp('Compute PSD of MLS recording');
1755
+ this.addTimeStamp('Compute spectrum of MLS recording');
1756
1756
  if (this.isCalibrating) return null;
1757
1757
  const fMLS = this.sourceSamplingRate / this._calibrateSoundBurstDownsample;
1758
1758
 
@@ -1775,7 +1775,7 @@ class Combination extends AudioCalibrator {
1775
1775
  console.log('mls sd', this.SDofFilteredRange['mls']);
1776
1776
  this.incrementStatusBar();
1777
1777
  this.status = this.generateTemplate(
1778
- `All Hz Calibration: done computing the PSD graphs...`.toString()
1778
+ `All Hz Calibration: done computing the spectrum graphs...`.toString()
1779
1779
  ).toString();
1780
1780
  this.emit('update', {message: this.status});
1781
1781
  return res;
@@ -1784,7 +1784,7 @@ class Combination extends AudioCalibrator {
1784
1784
  console.error(err);
1785
1785
  });
1786
1786
 
1787
- this.addTimeStamp('Compute PSD recording of speaker+ mic IIR-filtered MLS recording');
1787
+ this.addTimeStamp('Compute spectrum recording of speaker+ mic IIR-filtered MLS recording');
1788
1788
  if (this.isCalibrating) return null;
1789
1789
 
1790
1790
  let conv_results = await this.pyServerAPI
@@ -1834,7 +1834,7 @@ class Combination extends AudioCalibrator {
1834
1834
 
1835
1835
  unconv_rec = this.componentInvertedImpulseResponseNoBandpass;
1836
1836
  conv_rec = this.componentInvertedImpulseResponse;
1837
- this.addTimeStamp('Compute PSD of speaker or mic IIR, with and without bandpass');
1837
+ this.addTimeStamp('Compute spectrum of speaker or mic IIR, with and without bandpass');
1838
1838
  if (this.isCalibrating) return null;
1839
1839
 
1840
1840
  let component_iir_psd = await this.pyServerAPI
@@ -1857,7 +1857,7 @@ class Combination extends AudioCalibrator {
1857
1857
  });
1858
1858
  unconv_rec = this.systemInvertedImpulseResponseNoBandpass;
1859
1859
  conv_rec = this.systemInvertedImpulseResponse;
1860
- this.addTimeStamp('Compute PSD of speaker +mic IIR, with and without bandpass');
1860
+ this.addTimeStamp('Compute spectrum of speaker +mic IIR, with and without bandpass');
1861
1861
  if (this.isCalibrating) return null;
1862
1862
  let system_iir_psd = await this.pyServerAPI
1863
1863
  .getPSDWithRetry({
@@ -1878,7 +1878,7 @@ class Combination extends AudioCalibrator {
1878
1878
  console.error(err);
1879
1879
  });
1880
1880
 
1881
- this.addTimeStamp('Compute PSD of MLS');
1881
+ this.addTimeStamp('Compute spectrum of MLS');
1882
1882
  if (this.isCalibrating) return null;
1883
1883
  let mls_psd = await this.pyServerAPI
1884
1884
  .getMLSPSDWithRetry({
@@ -1901,7 +1901,7 @@ class Combination extends AudioCalibrator {
1901
1901
  console.error(err);
1902
1902
  });
1903
1903
 
1904
- this.addTimeStamp('Compute PSD of speaker or mic');
1904
+ this.addTimeStamp('Compute spectrum of speaker or mic');
1905
1905
  if (this.isCalibrating) return null;
1906
1906
  let filtered_mls_psd = await this.pyServerAPI
1907
1907
  .getMLSPSDWithRetry({
@@ -2012,7 +2012,7 @@ class Combination extends AudioCalibrator {
2012
2012
  impulseResponses: [],
2013
2013
  };
2014
2014
  } else {
2015
- this.addTimeStamp('Compute PSD of filtered recording (system) and unfiltered recording');
2015
+ this.addTimeStamp('Compute spectrum of filtered recording (system) and unfiltered recording');
2016
2016
  if (this.isCalibrating) return null;
2017
2017
  const fMLS = this.sourceSamplingRate / this._calibrateSoundBurstDownsample;
2018
2018
  let results = await this.pyServerAPI
@@ -2052,7 +2052,7 @@ class Combination extends AudioCalibrator {
2052
2052
  //iir w/ and without bandpass psd
2053
2053
  unconv_rec = this.componentInvertedImpulseResponseNoBandpass;
2054
2054
  conv_rec = this.componentInvertedImpulseResponse;
2055
- this.addTimeStamp('Compute PSD of component IIR and component IIR no band pass');
2055
+ this.addTimeStamp('Compute spectrum of component IIR and component IIR no band pass');
2056
2056
  if (this.isCalibrating) return null;
2057
2057
  let component_iir_psd = await this.pyServerAPI
2058
2058
  .getPSDWithRetry({
@@ -2074,7 +2074,7 @@ class Combination extends AudioCalibrator {
2074
2074
  });
2075
2075
  unconv_rec = this.systemInvertedImpulseResponseNoBandpass;
2076
2076
  conv_rec = this.systemInvertedImpulseResponse;
2077
- this.addTimeStamp('Compute PSD of system IIR and system IIR no band pass');
2077
+ this.addTimeStamp('Compute spectrum of system IIR and system IIR no band pass');
2078
2078
  if (this.isCalibrating) return null;
2079
2079
  let system_iir_psd = await this.pyServerAPI
2080
2080
  .getPSDWithRetry({
@@ -2095,7 +2095,7 @@ class Combination extends AudioCalibrator {
2095
2095
  console.error(err);
2096
2096
  });
2097
2097
 
2098
- this.addTimeStamp('Compute PSD of MLS sequence');
2098
+ this.addTimeStamp('Compute spectrum of MLS sequence');
2099
2099
  if (this.isCalibrating) return null;
2100
2100
  let mls_psd = await this.pyServerAPI
2101
2101
  .getMLSPSDWithRetry({
@@ -2118,7 +2118,7 @@ class Combination extends AudioCalibrator {
2118
2118
  console.error(err);
2119
2119
  });
2120
2120
 
2121
- this.addTimeStamp('Compute PSD of filtered MLS (system)');
2121
+ this.addTimeStamp('Compute spectrum of filtered MLS (system)');
2122
2122
  if (this.isCalibrating) return null;
2123
2123
  let filtered_mls_psd = await this.pyServerAPI
2124
2124
  .getMLSPSDWithRetry({
@@ -3393,6 +3393,8 @@ class Combination extends AudioCalibrator {
3393
3393
  this.calibrateSound1000HzMaxSD_dB = calibrateSound1000HzMaxSD_dB;
3394
3394
  this.calibrateSound1000HzMaxTries = calibrateSound1000HzMaxTries;
3395
3395
  this._calibrateSoundBurstMaxSD_dB = _calibrateSoundBurstMaxSD_dB;
3396
+ this.simulatedMicrophoneIR = null;
3397
+ this.simulatedLoudspeakerIR = null;
3396
3398
  //check if a componentIR was given to the system, if it isn't check for the microphone. using dummy data here bc we need to
3397
3399
  //check the db based on the microphone currently connected
3398
3400
 
@@ -3499,6 +3501,16 @@ class Combination extends AudioCalibrator {
3499
3501
  frequencyResponse.impulse_response_1000hz_microphone;
3500
3502
  this.calibrateSoundSimulateLoudspeaker1000Hz =
3501
3503
  frequencyResponse.impulse_response_1000hz_loudspeaker;
3504
+ this.simulatedLoudspeakerIR = {
3505
+ Freq: frequencyResponse.frequencies_loudspeaker,
3506
+ Gain: frequencyResponse.gains_loudspeaker,
3507
+ };
3508
+ this.simulatedMicrophoneIR = {
3509
+ Freq: frequencyResponse.frequencies_microphone,
3510
+ Gain: frequencyResponse.gains_microphone,
3511
+ };
3512
+ console.log('simulatedMicrophoneIR', this.simulatedMicrophoneIR);
3513
+ console.log('simulatedLoudspeakerIR', this.simulatedLoudspeakerIR);
3502
3514
 
3503
3515
  if (isLoudspeakerCalibration) {
3504
3516
  //define this.componentIR, this.componentGainDBSPL
@@ -3506,6 +3518,7 @@ class Combination extends AudioCalibrator {
3506
3518
  Freq: frequencyResponse.frequencies_microphone,
3507
3519
  Gain: frequencyResponse.gains_microphone,
3508
3520
  };
3521
+ console.log('this.componentIR', this.componentIR);
3509
3522
  this.componentGainDBSPL = frequencyResponse.gain_at_1000hz_microphone;
3510
3523
  lCalib = this.componentGainDBSPL;
3511
3524
  } else {
@@ -3647,6 +3660,8 @@ class Combination extends AudioCalibrator {
3647
3660
  total_results['qualityMetrics'] = this.SDofFilteredRange;
3648
3661
  total_results['flags'] = this.flags;
3649
3662
  total_results['permissionStatus'] = this.permissionStatus;
3663
+ total_results['simulatedMicrophoneIR'] = this.simulatedMicrophoneIR;
3664
+ total_results['simulatedLoudspeakerIR'] = this.simulatedLoudspeakerIR;
3650
3665
  console.log('total results');
3651
3666
  console.log(total_results);
3652
3667
  console.log('Time Stamps');
@@ -1,99 +1,99 @@
1
- #include "mlsGen.hpp"
2
- #include <sanitizer/lsan_interface.h>
3
-
4
- #ifdef __cplusplus
5
- extern "C" {
6
- #endif
7
-
8
- MLSGen::MLSGen(long N, long srcSR, long sinkSR) {
9
- MLSGen::N = N;
10
- MLSGen::srcSR = srcSR;
11
- MLSGen::sinkSR = sinkSR;
12
- P = (1 << N) - 1;
13
- mls = new bool[P];
14
- tagL = new long[P];
15
- tagS = new long[P];
16
- generatedSignal = new float[P];
17
- recordedSignal = new float[P];
18
- perm = new float[P + 1];
19
- resp = new float[P + 1];
20
- }
21
-
22
- #ifndef __EMSCRIPTEN__
23
- MLSGen::~MLSGen() {
24
- delete[] mls;
25
- delete[] tagL;
26
- delete[] tagS;
27
- delete[] generatedSignal;
28
- delete[] recordedSignal;
29
- delete[] perm;
30
- delete[] resp;
31
- }
32
- #endif
33
-
34
- #ifdef __EMSCRIPTEN__
35
-
36
- using namespace emscripten;
37
-
38
- void MLSGen::Destruct() {
39
- delete[] mls;
40
- delete[] tagL;
41
- delete[] tagS;
42
- delete[] generatedSignal;
43
- delete[] recordedSignal;
44
- delete[] perm;
45
- delete[] resp;
46
- }
47
-
48
- emscripten::val MLSGen::getMLS() {
49
- // if mls is not generated, generate it
50
- if (*(&mls + 1) - mls != P) {
51
- generateMls();
52
- }
53
- for (int i = 0; i < P; i++) {
54
- generatedSignal[i] = -2 * mls[i] + 1;
55
- }
56
- return emscripten::val(typed_memory_view(P, generatedSignal));
57
- }
58
-
59
- emscripten::val MLSGen::setRecordedSignalsMemoryView(long sizeRecordedSignals) {
60
- C = sizeRecordedSignals;
61
- recordedSignals = new float[C];
62
- return emscripten::val(typed_memory_view(C, recordedSignals));
63
- }
64
-
65
- emscripten::val MLSGen::getRecordedSignalsMemoryView() {
66
- return emscripten::val(typed_memory_view(C, recordedSignals));
67
- }
68
-
69
- emscripten::val MLSGen::getImpulseResponse() {
70
- generateTagL(); // Generate tagL for the L matrix
71
- generateTagS(); // Generate tagS for the S matrix
72
- GenerateSignal(); // Generate the signal TEST PURPOSES
73
- permuteSignal(); // Permute the signal according to tagS
74
- fastHadamard(); // Do a Hadamard transform in place
75
- permuteResponse(); // Permute the impulseresponse according to tagL
76
- return emscripten::val(typed_memory_view(P + 1, resp));
77
- }
78
-
79
- // Binding code
80
- EMSCRIPTEN_BINDINGS(mls_gen_module) {
81
- class_<MLSGen>("MLSGen")
82
- .constructor<long, long, long>()
83
- .function("Destruct", &MLSGen::Destruct)
84
- .function("getMLS", &MLSGen::getMLS)
85
- .function("getRecordedSignalsMemoryView",
86
- &MLSGen::getRecordedSignalsMemoryView)
87
- .function("setRecordedSignalsMemoryView",
88
- &MLSGen::setRecordedSignalsMemoryView)
89
- .function("getImpulseResponse", &MLSGen::getImpulseResponse);
90
- function("doLeakCheck", &__lsan_do_recoverable_leak_check);
91
- };
92
- #endif
93
-
94
- #ifdef __cplusplus
95
- }
96
- #endif
97
-
98
- // https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html
1
+ #include "mlsGen.hpp"
2
+ #include <sanitizer/lsan_interface.h>
3
+
4
+ #ifdef __cplusplus
5
+ extern "C" {
6
+ #endif
7
+
8
+ MLSGen::MLSGen(long N, long srcSR, long sinkSR) {
9
+ MLSGen::N = N;
10
+ MLSGen::srcSR = srcSR;
11
+ MLSGen::sinkSR = sinkSR;
12
+ P = (1 << N) - 1;
13
+ mls = new bool[P];
14
+ tagL = new long[P];
15
+ tagS = new long[P];
16
+ generatedSignal = new float[P];
17
+ recordedSignal = new float[P];
18
+ perm = new float[P + 1];
19
+ resp = new float[P + 1];
20
+ }
21
+
22
+ #ifndef __EMSCRIPTEN__
23
+ MLSGen::~MLSGen() {
24
+ delete[] mls;
25
+ delete[] tagL;
26
+ delete[] tagS;
27
+ delete[] generatedSignal;
28
+ delete[] recordedSignal;
29
+ delete[] perm;
30
+ delete[] resp;
31
+ }
32
+ #endif
33
+
34
+ #ifdef __EMSCRIPTEN__
35
+
36
+ using namespace emscripten;
37
+
38
+ void MLSGen::Destruct() {
39
+ delete[] mls;
40
+ delete[] tagL;
41
+ delete[] tagS;
42
+ delete[] generatedSignal;
43
+ delete[] recordedSignal;
44
+ delete[] perm;
45
+ delete[] resp;
46
+ }
47
+
48
+ emscripten::val MLSGen::getMLS() {
49
+ // if mls is not generated, generate it
50
+ if (*(&mls + 1) - mls != P) {
51
+ generateMls();
52
+ }
53
+ for (int i = 0; i < P; i++) {
54
+ generatedSignal[i] = -2 * mls[i] + 1;
55
+ }
56
+ return emscripten::val(typed_memory_view(P, generatedSignal));
57
+ }
58
+
59
+ emscripten::val MLSGen::setRecordedSignalsMemoryView(long sizeRecordedSignals) {
60
+ C = sizeRecordedSignals;
61
+ recordedSignals = new float[C];
62
+ return emscripten::val(typed_memory_view(C, recordedSignals));
63
+ }
64
+
65
+ emscripten::val MLSGen::getRecordedSignalsMemoryView() {
66
+ return emscripten::val(typed_memory_view(C, recordedSignals));
67
+ }
68
+
69
+ emscripten::val MLSGen::getImpulseResponse() {
70
+ generateTagL(); // Generate tagL for the L matrix
71
+ generateTagS(); // Generate tagS for the S matrix
72
+ GenerateSignal(); // Generate the signal TEST PURPOSES
73
+ permuteSignal(); // Permute the signal according to tagS
74
+ fastHadamard(); // Do a Hadamard transform in place
75
+ permuteResponse(); // Permute the impulseresponse according to tagL
76
+ return emscripten::val(typed_memory_view(P + 1, resp));
77
+ }
78
+
79
+ // Binding code
80
+ EMSCRIPTEN_BINDINGS(mls_gen_module) {
81
+ class_<MLSGen>("MLSGen")
82
+ .constructor<long, long, long>()
83
+ .function("Destruct", &MLSGen::Destruct)
84
+ .function("getMLS", &MLSGen::getMLS)
85
+ .function("getRecordedSignalsMemoryView",
86
+ &MLSGen::getRecordedSignalsMemoryView)
87
+ .function("setRecordedSignalsMemoryView",
88
+ &MLSGen::setRecordedSignalsMemoryView)
89
+ .function("getImpulseResponse", &MLSGen::getImpulseResponse);
90
+ function("doLeakCheck", &__lsan_do_recoverable_leak_check);
91
+ };
92
+ #endif
93
+
94
+ #ifdef __cplusplus
95
+ }
96
+ #endif
97
+
98
+ // https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html
99
99
  // https://web.dev/webassembly-memory-debugging/