speaker-calibration 2.2.244 → 2.2.246
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/dist/example/i18n.js +2359 -2184
- package/dist/listener.js +1 -1
- package/dist/main.js +3 -3
- package/dist/phonePeer.js +1 -1
- package/package.json +1 -1
- package/src/peer-connection/speaker.js +1 -3
- package/src/server/PythonServerAPI.js +6 -1
- package/src/tasks/combination/combination.js +12 -9
package/package.json
CHANGED
|
@@ -172,9 +172,7 @@ class Speaker extends AudioPeer {
|
|
|
172
172
|
speaker.connectionManager.send({
|
|
173
173
|
name: 'SoundCalibration',
|
|
174
174
|
message: 'phrases',
|
|
175
|
-
payload:
|
|
176
|
-
phrases: speaker.phrases,
|
|
177
|
-
},
|
|
175
|
+
payload: speaker.phrases,
|
|
178
176
|
});
|
|
179
177
|
|
|
180
178
|
// Send connection parameters to the listener
|
|
@@ -843,7 +843,12 @@ class PythonServerAPI {
|
|
|
843
843
|
})
|
|
844
844
|
.then(response => {
|
|
845
845
|
res = response;
|
|
846
|
-
|
|
846
|
+
if (typeof res.data === 'string') {
|
|
847
|
+
//if there is NaN in the string, replace it with 0
|
|
848
|
+
res.data = res.data.replace('NaN', '0');
|
|
849
|
+
res.data = JSON.parse(res.data);
|
|
850
|
+
}
|
|
851
|
+
console.log('res', res);
|
|
847
852
|
})
|
|
848
853
|
.catch(error => {
|
|
849
854
|
throw error;
|
|
@@ -746,6 +746,9 @@ class Combination extends AudioCalibrator {
|
|
|
746
746
|
const burst = this._calibrateSoundBurstSec;
|
|
747
747
|
const post = this._calibrateSoundBurstPostSec;
|
|
748
748
|
const total_dur = pre + repeats * burst + post;
|
|
749
|
+
const simulationEnabled =
|
|
750
|
+
this.calibrateSoundSimulateMicrophone !== null &&
|
|
751
|
+
this.calibrateSoundSimulateLoudspeaker !== null;
|
|
749
752
|
await this.pyServerAPI
|
|
750
753
|
.allHzPowerCheck({
|
|
751
754
|
payload: payload_downsampled,
|
|
@@ -758,7 +761,11 @@ class Combination extends AudioCalibrator {
|
|
|
758
761
|
})
|
|
759
762
|
.then(async result => {
|
|
760
763
|
if (result) {
|
|
761
|
-
if (
|
|
764
|
+
if (
|
|
765
|
+
result['sd'] > this._calibrateSoundBurstMaxSD_dB &&
|
|
766
|
+
this.numSuccessfulCaptured == 0 &&
|
|
767
|
+
!simulationEnabled
|
|
768
|
+
) {
|
|
762
769
|
console.log(
|
|
763
770
|
'SD: ' +
|
|
764
771
|
result['sd'] +
|
|
@@ -827,14 +834,13 @@ class Combination extends AudioCalibrator {
|
|
|
827
834
|
payload_skipped_warmUp,
|
|
828
835
|
this._calibrateSoundBurstDownsample
|
|
829
836
|
);
|
|
837
|
+
const factor = simulationEnabled ? this._calibrateSoundBurstDownsample : 1;
|
|
830
838
|
await this.pyServerAPI
|
|
831
839
|
.getAutocorrelation({
|
|
832
840
|
mls: mls,
|
|
833
841
|
payload: payload_skipped_warmUp_downsampled,
|
|
834
842
|
sampleRate: fMLS,
|
|
835
|
-
numPeriods:
|
|
836
|
-
(this.numMLSPerCapture - this.num_mls_to_skip) /
|
|
837
|
-
this._calibrateSoundBurstDownsample,
|
|
843
|
+
numPeriods: (this.numMLSPerCapture - this.num_mls_to_skip) / factor,
|
|
838
844
|
downsample: this._calibrateSoundBurstDownsample,
|
|
839
845
|
})
|
|
840
846
|
.then(async res => {
|
|
@@ -847,9 +853,7 @@ class Combination extends AudioCalibrator {
|
|
|
847
853
|
.getImpulseResponse({
|
|
848
854
|
mls,
|
|
849
855
|
sampleRate: fMLS,
|
|
850
|
-
numPeriods:
|
|
851
|
-
(this.numMLSPerCapture - this.num_mls_to_skip) /
|
|
852
|
-
this._calibrateSoundBurstDownsample,
|
|
856
|
+
numPeriods: (this.numMLSPerCapture - this.num_mls_to_skip) / factor,
|
|
853
857
|
sig: payload_skipped_warmUp_downsampled,
|
|
854
858
|
fs2: this.fs2,
|
|
855
859
|
L_new_n: this.L_new_n,
|
|
@@ -1188,12 +1192,11 @@ class Combination extends AudioCalibrator {
|
|
|
1188
1192
|
|
|
1189
1193
|
// Save the simulated recording
|
|
1190
1194
|
await this.saveFilteredRecording(simulatedRecording);
|
|
1195
|
+
this.numSuccessfulCaptured = 2; // Mark as successfully captured to avoid retries
|
|
1191
1196
|
|
|
1192
1197
|
// Process the recording
|
|
1193
1198
|
await this.checkPowerVariation();
|
|
1194
1199
|
|
|
1195
|
-
this.numSuccessfulCaptured = 2; // Mark as successfully captured to avoid retries
|
|
1196
|
-
|
|
1197
1200
|
this.stepNum += 1;
|
|
1198
1201
|
this.incrementStatusBar();
|
|
1199
1202
|
this.status = this.generateTemplate(
|