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.
- package/.eslintignore +71 -71
- package/.eslintrc.json +40 -40
- package/.gitignore +81 -0
- package/.prettierignore +69 -69
- package/.prettierrc +14 -14
- package/LICENSE +20 -20
- package/README.md +133 -133
- package/__mocks__/fileMock.js +1 -1
- package/__mocks__/styleMock.js +1 -1
- package/babel.config.js +3 -3
- package/coverage/clover.xml +71 -71
- package/coverage/coverage-final.json +224 -224
- package/coverage/lcov-report/PythonServerInterface.js.html +265 -265
- package/coverage/lcov-report/base.css +354 -354
- package/coverage/lcov-report/block-navigation.js +82 -82
- package/coverage/lcov-report/index.html +123 -123
- package/coverage/lcov-report/prettify.css +101 -101
- package/coverage/lcov-report/prettify.js +937 -937
- package/coverage/lcov-report/sorter.js +189 -189
- package/coverage/lcov-report/src/index.html +121 -121
- package/coverage/lcov-report/src/server/PythonServerInterface.js.html +268 -268
- package/coverage/lcov-report/src/server/index.html +123 -123
- package/coverage/lcov-report/src/tasks/audioCalibrator.js.html +499 -499
- package/coverage/lcov-report/src/tasks/audioRecorder.js.html +412 -412
- package/coverage/lcov-report/src/tasks/index.html +143 -143
- package/coverage/lcov-report/src/tasks/volume/index.html +123 -123
- package/coverage/lcov-report/src/tasks/volume/volume.js.html +409 -409
- package/coverage/lcov-report/src/utils.js.html +172 -172
- package/coverage/lcov.info +91 -91
- package/dist/example/NoSleep.min.js +1 -1
- package/dist/example/fetch-languages-sheets.js +77 -77
- package/dist/example/i18n.js +29654 -30000
- package/dist/example/index.html +47 -47
- package/dist/example/listener.html +81 -81
- package/dist/example/server.js +51 -51
- package/dist/example/speaker.html +145 -145
- package/dist/example/speakerUI.js +273 -273
- package/dist/example/styles.css +152 -152
- package/dist/main.js +1 -1
- package/dist/mlsGen.js +6814 -6814
- package/dist/mlsGen.wasm +0 -0
- package/dist/package-lock.json +1018 -1018
- package/dist/package.json +18 -18
- package/doc/AudioCalibrator.html +417 -417
- package/doc/AudioPeer.html +251 -251
- package/doc/AudioRecorder.html +195 -195
- package/doc/ImpulseResponse.html +215 -215
- package/doc/Listener.html +308 -308
- package/doc/MlsGenInterface.html +226 -226
- package/doc/MyEventEmitter.html +274 -274
- package/doc/PythonServerAPI.html +109 -109
- package/doc/Speaker.html +276 -276
- package/doc/Takes%20a%20target%20element%20where%20html%20elements%20will%20be%20appended..html +128 -128
- package/doc/Takes%20the%20url%20of%20the%20current%20site%0Aand%20a%20target%20element%20where%20html%20elements%20will%20be%20appended..html +138 -138
- package/doc/Takes%20the%20url%20of%20the%20current%20site%20and%20a%20target%20element%20where%20html%20elements%20will%20be%20appended..html +137 -137
- package/doc/Volume.html +88 -88
- package/doc/audioCalibrator.js.html +179 -179
- package/doc/audioPeer.js.html +175 -175
- package/doc/audioRecorder.js.html +163 -163
- package/doc/creates%20a%20new%20AudioRecorder%20instance.%20%0ASets%20up%20the%20audio%20context%20and%20file%20reader..html +114 -114
- package/doc/fonts/OpenSans-Bold-webfont.svg +1829 -1829
- package/doc/fonts/OpenSans-BoldItalic-webfont.svg +1829 -1829
- package/doc/fonts/OpenSans-Italic-webfont.svg +1829 -1829
- package/doc/fonts/OpenSans-Light-webfont.svg +1830 -1830
- package/doc/fonts/OpenSans-LightItalic-webfont.svg +1834 -1834
- package/doc/fonts/OpenSans-Regular-webfont.svg +1830 -1830
- package/doc/global.html +308 -308
- package/doc/index.html +58 -58
- package/doc/listener.js.html +170 -170
- package/doc/mlsGen_mlsGenInterface.js.html +117 -117
- package/doc/myEventEmitter.js.html +124 -124
- package/doc/peer-connection_audioPeer.js.html +188 -188
- package/doc/peer-connection_listener.js.html +311 -311
- package/doc/peer-connection_speaker.js.html +381 -381
- package/doc/scripts/linenumber.js +25 -25
- package/doc/scripts/prettify/Apache-License-2.0.txt +202 -202
- package/doc/scripts/prettify/lang-css.js +24 -24
- package/doc/scripts/prettify/prettify.js +640 -640
- package/doc/server_PythonServerAPI.js.html +160 -160
- package/doc/speaker.js.html +248 -248
- package/doc/styles/jsdoc-default.css +371 -371
- package/doc/styles/prettify-jsdoc.css +111 -111
- package/doc/styles/prettify-tomorrow.css +163 -163
- package/doc/tasks_audioCalibrator.js.html +207 -207
- package/doc/tasks_audioRecorder.js.html +190 -190
- package/doc/tasks_impulse-response_impulseResponse.js.html +442 -442
- package/doc/tasks_impulse-response_mlsGen_mlsGenInterface.js.html +175 -175
- package/doc/tasks_volume_volume.js.html +185 -185
- package/doc/utils.js.html +105 -105
- package/jest.config.js +173 -173
- package/netlify.toml +26 -26
- package/package.json +78 -78
- package/src/config/firebase.js +26 -26
- package/src/index.html +21 -21
- package/src/listener-app/PhonePeer.js +474 -474
- package/src/listener-app/listener.js +377 -377
- package/src/main.js +22 -22
- package/src/myEventEmitter.js +83 -83
- package/src/peer-connection/audioPeer.js +100 -100
- package/src/peer-connection/listener.js +299 -299
- package/src/peer-connection/peerErrors.js +25 -25
- package/src/peer-connection/speaker.js +963 -963
- package/src/powerCheck.js +110 -110
- package/src/server/PythonServerAPI.js +959 -959
- package/src/tasks/combination/combination.js +44 -29
- package/src/tasks/combination/mlsGen/mlsGen.cpp +98 -98
- package/src/tasks/combination/mlsGen/mlsGen.hpp +303 -303
- package/src/tasks/combination/mlsGen/mlsGenInterface.js +131 -131
- package/src/tasks/combination/mlsGen/mlsGenTest.cpp +180 -180
- package/src/tasks/impulse-response/impulseResponse.js +610 -610
- package/src/tasks/impulse-response/mlsGen/mlsGen.cpp +98 -98
- package/src/tasks/impulse-response/mlsGen/mlsGen.hpp +303 -303
- package/src/tasks/impulse-response/mlsGen/mlsGenInterface.js +131 -131
- package/src/tasks/impulse-response/mlsGen/mlsGenTest.cpp +180 -180
- package/src/tasks/volume/volume.cpp +2 -2
- package/src/tasks/volume/volume.hpp +22 -22
- package/src/tasks/volume/volume.js +279 -279
- package/src/utils.js +205 -205
- package/webpack.config.js +65 -65
- package/.github/workflows/update-phrases.yml +0 -37
- 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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
1739
|
-
console.log('Obtaining filtered recording from #allHzFilteredRecordings to calculate
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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/
|