speaker-calibration 2.2.216 → 2.2.218
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 +291 -291
- package/dist/listener.js +4 -4
- package/dist/main.js +3 -3
- package/package.json +1 -1
- package/src/peer-connection/speaker.js +4 -2
- package/src/tasks/audioCalibrator.js +22 -13
- package/src/tasks/combination/combination.js +20 -20
package/package.json
CHANGED
|
@@ -317,7 +317,7 @@ class Speaker extends AudioPeer {
|
|
|
317
317
|
this.qrImage = qrImage;
|
|
318
318
|
|
|
319
319
|
// Get shortened URL
|
|
320
|
-
let shortURL =
|
|
320
|
+
let shortURL = this.uri;
|
|
321
321
|
try {
|
|
322
322
|
const response = await fetch('https://api.short.io/links/public', {
|
|
323
323
|
method: 'POST',
|
|
@@ -370,13 +370,15 @@ class Speaker extends AudioPeer {
|
|
|
370
370
|
this.phrases.RC_checkInternetConnection[this.language]
|
|
371
371
|
);
|
|
372
372
|
|
|
373
|
+
const language = this.language;
|
|
374
|
+
const phrases = this.phrases;
|
|
373
375
|
const checkConnection = document.createElement('a');
|
|
374
376
|
checkConnection.id = 'check-connection';
|
|
375
377
|
checkConnection.href = '#';
|
|
376
378
|
checkConnection.innerHTML = "check the phone's internet connection";
|
|
377
379
|
checkConnection.addEventListener('click', function (event) {
|
|
378
380
|
event.preventDefault();
|
|
379
|
-
createAndShowPopup(
|
|
381
|
+
createAndShowPopup(language, phrases);
|
|
380
382
|
});
|
|
381
383
|
explanation.querySelector('a#check-connection').replaceWith(checkConnection);
|
|
382
384
|
textColumn.appendChild(explanation);
|
|
@@ -70,23 +70,22 @@ class AudioCalibrator extends AudioRecorder {
|
|
|
70
70
|
targetElement.appendChild(this.localAudio);
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
addTimeStamp = taskName => {
|
|
74
|
-
const currentTime = new Date().getTime(); // Current time in
|
|
75
|
-
const elapsedTime = (currentTime - this.startTime) / 1000; //
|
|
76
|
-
const stepDuration = elapsedTime - this.currentTime;
|
|
73
|
+
addTimeStamp = (taskName) => {
|
|
74
|
+
const currentTime = new Date().getTime(); // Current time in ms
|
|
75
|
+
const elapsedTime = (currentTime - this.startTime) / 1000; // Convert to seconds
|
|
76
|
+
const stepDuration = elapsedTime - this.currentTime;
|
|
77
77
|
|
|
78
|
-
this.currentTime = elapsedTime; // Update for
|
|
78
|
+
this.currentTime = elapsedTime; // Update for next step
|
|
79
79
|
|
|
80
|
-
//
|
|
81
|
-
|
|
82
|
-
;
|
|
80
|
+
// Format numbers to 1 decimal place without padding
|
|
81
|
+
const elapsedStr = elapsedTime.toFixed(1);
|
|
82
|
+
const stepStr = stepDuration.toFixed(1);
|
|
83
83
|
|
|
84
|
-
//
|
|
85
|
-
this.timeStamp.push(
|
|
86
|
-
`SOUND Total: ${elapsedTime.toFixed(1)} s Step: ${stepDuration.toFixed(1)} s ${taskName}`
|
|
87
|
-
);
|
|
84
|
+
// Push timestamp string (without padding)
|
|
85
|
+
this.timeStamp.push(`${elapsedStr} s. ∆ ${stepStr} s. ${taskName}`);
|
|
88
86
|
};
|
|
89
87
|
|
|
88
|
+
|
|
90
89
|
|
|
91
90
|
recordBackground = async (
|
|
92
91
|
stream,
|
|
@@ -229,16 +228,26 @@ class AudioCalibrator extends AudioRecorder {
|
|
|
229
228
|
// after recording
|
|
230
229
|
await afterRecord(lCalib);
|
|
231
230
|
const sd = await checkSD();
|
|
231
|
+
let sdMessage;
|
|
232
232
|
if (sd <= maxSD) {
|
|
233
233
|
console.log(`SD =${sd}, less than calibrateSound1000HzMaxSD_dB=${maxSD}`);
|
|
234
234
|
this.numCalibratingRoundsCompleted += 2;
|
|
235
|
+
sdMessage = `. SD = ${sd} dB`;
|
|
236
|
+
|
|
235
237
|
} else {
|
|
236
238
|
// if exist the maxSD do it one more time and only one more time
|
|
237
239
|
console.log(`SD =${sd}, greater than calibrateSound1000HzMaxSD_dB=${maxSD}`);
|
|
238
240
|
this.numCalibratingRoundsCompleted += 1;
|
|
241
|
+
sdMessage = `. SD = ${sd} > ${this.calibrateSound1000HzMaxSD_dB} dB.`;
|
|
239
242
|
}
|
|
243
|
+
this.addTimeStamp(
|
|
244
|
+
`${this.calibrateSound1000HzPreSec.toFixed(1)}` +
|
|
245
|
+
`+${this.calibrateSound1000HzSec.toFixed(1)}` +
|
|
246
|
+
`+${this.calibrateSound1000HzPostSec.toFixed(1)} s. ` +
|
|
247
|
+
`1000 Hz at ${this.inDB} dB${sdMessage}`
|
|
248
|
+
);
|
|
240
249
|
this.calibrationNodes = [];
|
|
241
|
-
|
|
250
|
+
|
|
242
251
|
// eslint-disable-next-line no-await-in-loop
|
|
243
252
|
await sleep(2);
|
|
244
253
|
}
|
|
@@ -2402,26 +2402,26 @@ class Combination extends AudioCalibrator {
|
|
|
2402
2402
|
this.recordingChecks['volume'][this.inDB] = res;
|
|
2403
2403
|
console.log('Recording checks in sendToServer', this.recordingChecks['volume']);
|
|
2404
2404
|
const getSD = () => this.recordingChecks['volume'][this.inDB]['sd'];
|
|
2405
|
-
const getSDMessage = () => {
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
};
|
|
2414
|
-
const total_dur =
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
this.addTimeStamp(
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
);
|
|
2405
|
+
// const getSDMessage = () => {
|
|
2406
|
+
// //SOUND 6.7 s. 2.5+2.5+0.5 s. 1000 Hz at -60 dB. SD = 1.3 dB
|
|
2407
|
+
// // And reporting each rejected recording as
|
|
2408
|
+
// // SOUND 6.7 s. 2.5+2.5+0.5 s. 1000 Hz at -60 dB, SD = 19.7 > 4 dB.
|
|
2409
|
+
|
|
2410
|
+
// if (this.numCalibratingRoundsCompleted == 1)
|
|
2411
|
+
// return `. SD = ${getSD()} > ${this.calibrateSound1000HzMaxSD_dB} dB.`;
|
|
2412
|
+
// return `. SD = ${getSD()} dB`;
|
|
2413
|
+
// };
|
|
2414
|
+
// const total_dur =
|
|
2415
|
+
// this.calibrateSound1000HzPreSec +
|
|
2416
|
+
// this.calibrateSound1000HzSec +
|
|
2417
|
+
// this.calibrateSound1000HzPostSec;
|
|
2418
|
+
|
|
2419
|
+
// this.addTimeStamp(
|
|
2420
|
+
// `${this.calibrateSound1000HzPreSec.toFixed(1)}` +
|
|
2421
|
+
// `+${this.calibrateSound1000HzSec.toFixed(1)}` +
|
|
2422
|
+
// `+${this.calibrateSound1000HzPostSec.toFixed(1)} s.` +
|
|
2423
|
+
// `1000 Hz at ${this.inDB} dB${getSDMessage()}`
|
|
2424
|
+
// );
|
|
2425
2425
|
};
|
|
2426
2426
|
|
|
2427
2427
|
startCalibrationVolume = async (stream, gainValues, lCalib, componentGainDBSPL) => {
|