speaker-calibration 2.2.211 → 2.2.213
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/listener.html +2 -2
- package/dist/listener.js +3459 -0
- package/dist/main.js +3436 -1223
- package/package.json +9 -4
- package/{dist/example → src/listener-app}/listener.js +6 -5
- package/src/peer-connection/listener.js +16 -14
- package/src/peer-connection/speaker.js +5 -4
- package/src/tasks/combination/combination.js +269 -140
- package/webpack.config.js +27 -0
|
@@ -12,10 +12,7 @@ import {
|
|
|
12
12
|
interpolate,
|
|
13
13
|
} from '../../utils';
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
volumePowerCheck,
|
|
17
|
-
getPower
|
|
18
|
-
} from '../../powerCheck';
|
|
15
|
+
import {volumePowerCheck, getPower} from '../../powerCheck';
|
|
19
16
|
|
|
20
17
|
import database from '../../config/firebase';
|
|
21
18
|
import {ref, set, get, child} from 'firebase/database';
|
|
@@ -247,7 +244,7 @@ class Combination extends AudioCalibrator {
|
|
|
247
244
|
unfiltered: [],
|
|
248
245
|
system: [],
|
|
249
246
|
component: [],
|
|
250
|
-
warnings:[]
|
|
247
|
+
warnings: [],
|
|
251
248
|
};
|
|
252
249
|
|
|
253
250
|
inDB;
|
|
@@ -300,7 +297,7 @@ class Combination extends AudioCalibrator {
|
|
|
300
297
|
icapture = 0;
|
|
301
298
|
|
|
302
299
|
/**generate string template that gets reevaluated as variable increases */
|
|
303
|
-
generateTemplate =
|
|
300
|
+
generateTemplate = status => {
|
|
304
301
|
if (this.isCalibrating) {
|
|
305
302
|
return '';
|
|
306
303
|
}
|
|
@@ -312,13 +309,15 @@ class Combination extends AudioCalibrator {
|
|
|
312
309
|
let systemSD = '';
|
|
313
310
|
let flags = '';
|
|
314
311
|
const soundSubtitle = document.getElementById(this.soundSubtitleId);
|
|
315
|
-
if(soundSubtitle)
|
|
316
|
-
{
|
|
312
|
+
if (soundSubtitle) {
|
|
317
313
|
const reportWebAudioNames = `${this.webAudioDeviceNames.loudspeakerText}<br/> ${this.webAudioDeviceNames.microphoneText}`;
|
|
318
314
|
soundSubtitle.innerHTML = reportWebAudioNames;
|
|
319
315
|
}
|
|
320
|
-
|
|
321
|
-
const samplingParamText = this.phrases.RC_SamplingHzBits[this.language]
|
|
316
|
+
|
|
317
|
+
const samplingParamText = this.phrases.RC_SamplingHzBits[this.language]
|
|
318
|
+
.replace('111', this.sourceSamplingRate)
|
|
319
|
+
.replace('222', this.sinkSamplingRate)
|
|
320
|
+
.replace('333', this.calibrateSoundSamplingDesiredBits);
|
|
322
321
|
const reportParameters = `${samplingParamText}`;
|
|
323
322
|
if (this.flags) {
|
|
324
323
|
flags = `<br> autoGainControl: ${this.flags.autoGainControl};
|
|
@@ -342,7 +341,7 @@ class Combination extends AudioCalibrator {
|
|
|
342
341
|
${componentSD}
|
|
343
342
|
${flags}
|
|
344
343
|
<br>${status}
|
|
345
|
-
${template
|
|
344
|
+
${template}`;
|
|
346
345
|
};
|
|
347
346
|
|
|
348
347
|
/** increment numerator and percent for status bar */
|
|
@@ -384,7 +383,9 @@ class Combination extends AudioCalibrator {
|
|
|
384
383
|
const iirLength = this.iirLength;
|
|
385
384
|
this.stepNum += 1;
|
|
386
385
|
console.log('send impulse responses to server: ' + this.stepNum);
|
|
387
|
-
this.status = this.generateTemplate(
|
|
386
|
+
this.status = this.generateTemplate(
|
|
387
|
+
`All Hz Calibration: computing the IIR...`.toString()
|
|
388
|
+
).toString();
|
|
388
389
|
this.emit('update', {message: this.status});
|
|
389
390
|
return await this.pyServerAPI
|
|
390
391
|
.getSystemInverseImpulseResponseWithRetry({
|
|
@@ -402,7 +403,9 @@ class Combination extends AudioCalibrator {
|
|
|
402
403
|
this.stepNum += 1;
|
|
403
404
|
console.log('got impulse response ' + this.stepNum);
|
|
404
405
|
this.incrementStatusBar();
|
|
405
|
-
this.status = this.generateTemplate(
|
|
406
|
+
this.status = this.generateTemplate(
|
|
407
|
+
`All Hz Calibration: done computing the IIR...`.toString()
|
|
408
|
+
).toString();
|
|
406
409
|
this.emit('update', {message: this.status});
|
|
407
410
|
this.systemInvertedImpulseResponse = res['iir'];
|
|
408
411
|
this.systemIR = res['ir'];
|
|
@@ -470,9 +473,11 @@ class Combination extends AudioCalibrator {
|
|
|
470
473
|
const highHz = this.#highHz;
|
|
471
474
|
this.stepNum += 1;
|
|
472
475
|
console.log('send impulse responses to server: ' + this.stepNum);
|
|
473
|
-
this.status = this.generateTemplate(
|
|
476
|
+
this.status = this.generateTemplate(
|
|
477
|
+
`All Hz Calibration: computing the IIR...`.toString()
|
|
478
|
+
).toString();
|
|
474
479
|
this.emit('update', {message: this.status});
|
|
475
|
-
console.log()
|
|
480
|
+
console.log();
|
|
476
481
|
return this.pyServerAPI
|
|
477
482
|
.getComponentInverseImpulseResponseWithRetry({
|
|
478
483
|
payload: filteredComputedIRs.slice(0, this.numCaptures),
|
|
@@ -494,7 +499,9 @@ class Combination extends AudioCalibrator {
|
|
|
494
499
|
this.stepNum += 1;
|
|
495
500
|
console.log('got impulse response ' + this.stepNum);
|
|
496
501
|
this.incrementStatusBar();
|
|
497
|
-
this.status = this.generateTemplate(
|
|
502
|
+
this.status = this.generateTemplate(
|
|
503
|
+
`All Hz Calibration: done computing the IIR...`.toString()
|
|
504
|
+
).toString();
|
|
498
505
|
this.emit('update', {message: this.status});
|
|
499
506
|
this.componentInvertedImpulseResponse = res['iir'];
|
|
500
507
|
this.componentInvertedImpulseResponseNoBandpass = res['iirNoBandpass'];
|
|
@@ -591,7 +598,9 @@ class Combination extends AudioCalibrator {
|
|
|
591
598
|
console.log('sending rec');
|
|
592
599
|
this.stepNum += 1;
|
|
593
600
|
console.log('send rec ' + this.stepNum);
|
|
594
|
-
this.status = this.generateTemplate(
|
|
601
|
+
this.status = this.generateTemplate(
|
|
602
|
+
`All Hz Calibration Step: computing the IR of the last recording...`.toString()
|
|
603
|
+
).toString();
|
|
595
604
|
this.emit('update', {message: this.status});
|
|
596
605
|
if (this.isCalibrating) return null;
|
|
597
606
|
await this.pyServerAPI
|
|
@@ -601,23 +610,41 @@ class Combination extends AudioCalibrator {
|
|
|
601
610
|
binDesiredSec: this._calibrateSoundPowerBinDesiredSec,
|
|
602
611
|
burstSec: this.desired_time_per_mls,
|
|
603
612
|
repeats: this.numMLSPerCapture - this.num_mls_to_skip,
|
|
604
|
-
warmUp: this.num_mls_to_skip
|
|
613
|
+
warmUp: this.num_mls_to_skip,
|
|
605
614
|
})
|
|
606
615
|
.then(async result => {
|
|
607
616
|
if (result) {
|
|
608
|
-
if (result['sd'] > this._calibrateSoundBurstMaxSD_dB &&
|
|
609
|
-
|
|
610
|
-
|
|
617
|
+
if (result['sd'] > this._calibrateSoundBurstMaxSD_dB && this.numSuccessfulCaptured == 0) {
|
|
618
|
+
console.log(
|
|
619
|
+
'SD: ' +
|
|
620
|
+
result['sd'] +
|
|
621
|
+
', greater than _calibrateSoundBurstMaxSD_dB: ' +
|
|
622
|
+
this._calibrateSoundBurstMaxSD_dB
|
|
623
|
+
);
|
|
611
624
|
this.recordingChecks['unfiltered'].push(result);
|
|
612
625
|
this.clearLastUnfilteredRecordedSignals();
|
|
613
|
-
this.numSuccessfulCaptured +=1;
|
|
626
|
+
this.numSuccessfulCaptured += 1;
|
|
614
627
|
} else {
|
|
615
628
|
if (result['sd'] <= this._calibrateSoundBurstMaxSD_dB) {
|
|
616
|
-
console.log(
|
|
629
|
+
console.log(
|
|
630
|
+
'SD: ' +
|
|
631
|
+
result['sd'] +
|
|
632
|
+
', less than _calibrateSoundBurstMaxSD_dB: ' +
|
|
633
|
+
this._calibrateSoundBurstMaxSD_dB
|
|
634
|
+
);
|
|
617
635
|
} else {
|
|
618
|
-
console.log(
|
|
619
|
-
|
|
620
|
-
|
|
636
|
+
console.log(
|
|
637
|
+
'SD: ' +
|
|
638
|
+
result['sd'] +
|
|
639
|
+
', greater than _calibrateSoundBurstMaxSD_dB: ' +
|
|
640
|
+
this._calibrateSoundBurstMaxSD_dB
|
|
641
|
+
);
|
|
642
|
+
this.recordingChecks['warnings'].push(
|
|
643
|
+
`All Hz. Re-recorded ${this.inDB} dB because SD ${result['sd']} > ${this._calibrateSoundBurstMaxSD_dB} dB`
|
|
644
|
+
);
|
|
645
|
+
this.status = this.generateTemplate(
|
|
646
|
+
`All Hz: Re-recording at ${this.inDB} dB because SD ${result['sd']} > ${this._calibrateSoundBurstMaxSD_dB} dB`.toString()
|
|
647
|
+
).toString();
|
|
621
648
|
this.emit('update', {
|
|
622
649
|
message: this.status,
|
|
623
650
|
});
|
|
@@ -640,11 +667,11 @@ class Combination extends AudioCalibrator {
|
|
|
640
667
|
// let end = new Date().getTime() / 1000;
|
|
641
668
|
// console.log("Time taken:", end - start, "seconds");
|
|
642
669
|
console.log('start calculate impulse response');
|
|
643
|
-
const usedPeriodStart = this.num_mls_to_skip
|
|
670
|
+
const usedPeriodStart = this.num_mls_to_skip * this.sourceSamplingRate;
|
|
644
671
|
const payload_skipped_warmUp = payload.slice(usedPeriodStart);
|
|
645
672
|
await this.pyServerAPI
|
|
646
673
|
.getAutocorrelation({
|
|
647
|
-
mls:mls,
|
|
674
|
+
mls: mls,
|
|
648
675
|
payload: payload_skipped_warmUp,
|
|
649
676
|
sampleRate: this.sourceSamplingRate || 96000,
|
|
650
677
|
numPeriods: this.numMLSPerCapture - this.num_mls_to_skip,
|
|
@@ -666,15 +693,17 @@ class Combination extends AudioCalibrator {
|
|
|
666
693
|
dL_n: this.dL_n,
|
|
667
694
|
})
|
|
668
695
|
.then(res => {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
this.
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
696
|
+
this.numSuccessfulCaptured += 2;
|
|
697
|
+
this.stepNum += 1;
|
|
698
|
+
console.log('got impulse response ' + this.stepNum);
|
|
699
|
+
this.incrementStatusBar();
|
|
700
|
+
this.status = this.generateTemplate(
|
|
701
|
+
`All Hz Calibration: ${this.numSuccessfulCaptured}/${this.numCaptures} IRs computed...`.toString()
|
|
702
|
+
).toString();
|
|
703
|
+
this.emit('update', {
|
|
704
|
+
message: this.status,
|
|
705
|
+
});
|
|
706
|
+
return res['ir'];
|
|
678
707
|
})
|
|
679
708
|
.catch(err => {
|
|
680
709
|
console.error(err);
|
|
@@ -682,7 +711,9 @@ class Combination extends AudioCalibrator {
|
|
|
682
711
|
);
|
|
683
712
|
});
|
|
684
713
|
}
|
|
685
|
-
console.log(
|
|
714
|
+
console.log(
|
|
715
|
+
'number of unfiltered recording checks:' + this.recordingChecks['unfiltered'].length
|
|
716
|
+
);
|
|
686
717
|
}
|
|
687
718
|
})
|
|
688
719
|
.catch(err => {
|
|
@@ -701,8 +732,10 @@ class Combination extends AudioCalibrator {
|
|
|
701
732
|
// await N * P / SR
|
|
702
733
|
this.stepNum += 1;
|
|
703
734
|
console.log('await desired length ' + this.stepNum);
|
|
704
|
-
this.status = this.generateTemplate(
|
|
705
|
-
|
|
735
|
+
this.status = this.generateTemplate(
|
|
736
|
+
`All Hz Calibration: sampling the calibration signal...`.toString() +
|
|
737
|
+
`\niteration ${this.stepNum}`
|
|
738
|
+
);
|
|
706
739
|
this.emit('update', {
|
|
707
740
|
message: this.status,
|
|
708
741
|
});
|
|
@@ -737,7 +770,7 @@ class Combination extends AudioCalibrator {
|
|
|
737
770
|
'Waiting ' + this._calibrateSoundBackgroundSecs + ' second(s) to record background noise'
|
|
738
771
|
);
|
|
739
772
|
let time_to_wait = this._calibrateSoundBackgroundSecs + 0.5;
|
|
740
|
-
this.addTimeStamp(`Record ${time_to_wait.toFixed(1)} s of background.`)
|
|
773
|
+
this.addTimeStamp(`Record ${time_to_wait.toFixed(1)} s of background.`);
|
|
741
774
|
await sleep(time_to_wait);
|
|
742
775
|
};
|
|
743
776
|
|
|
@@ -751,7 +784,9 @@ class Combination extends AudioCalibrator {
|
|
|
751
784
|
#awaitSignalOnset = async () => {
|
|
752
785
|
this.stepNum += 1;
|
|
753
786
|
console.log('await signal onset ' + this.stepNum);
|
|
754
|
-
this.status = this.generateTemplate(
|
|
787
|
+
this.status = this.generateTemplate(
|
|
788
|
+
`All Hz Calibration: waiting for the signal to stabilize...`.toString()
|
|
789
|
+
);
|
|
755
790
|
this.emit('update', {
|
|
756
791
|
message: this.status,
|
|
757
792
|
});
|
|
@@ -897,19 +932,25 @@ class Combination extends AudioCalibrator {
|
|
|
897
932
|
if (this.mode === 'unfiltered') {
|
|
898
933
|
console.log('play calibration audio ' + this.stepNum);
|
|
899
934
|
|
|
900
|
-
const pre = this._calibrateSoundBurstPreSec;
|
|
901
|
-
const repeats = this._calibrateSoundBurstRepeats;
|
|
902
|
-
const burst = this._calibrateSoundBurstSec;
|
|
903
|
-
const post = this._calibrateSoundBurstPostSec;
|
|
935
|
+
const pre = this._calibrateSoundBurstPreSec;
|
|
936
|
+
const repeats = this._calibrateSoundBurstRepeats;
|
|
937
|
+
const burst = this._calibrateSoundBurstSec;
|
|
938
|
+
const post = this._calibrateSoundBurstPostSec;
|
|
904
939
|
const total_dur = pre + repeats * burst + post;
|
|
905
940
|
this.addTimeStamp(
|
|
906
941
|
`Record ${total_dur.toFixed(1)} s ` +
|
|
907
|
-
|
|
942
|
+
`(${pre.toFixed(1)} + ${repeats}×${burst.toFixed(1)} + ${post.toFixed(
|
|
943
|
+
1
|
|
944
|
+
)} s) of MLS ver. ${this.icapture}`
|
|
908
945
|
);
|
|
909
|
-
this.status = this.generateTemplate(
|
|
946
|
+
this.status = this.generateTemplate(
|
|
947
|
+
`All Hz Calibration: playing the calibration tone...`.toString()
|
|
948
|
+
).toString();
|
|
910
949
|
} else if (this.mode === 'filtered') {
|
|
911
950
|
console.log('play convolved audio ' + this.stepNum);
|
|
912
|
-
this.status = this.generateTemplate().toString(
|
|
951
|
+
this.status = this.generateTemplate().toString(
|
|
952
|
+
`All Hz Calibration: playing the convolved calibration tone...`.toString()
|
|
953
|
+
);
|
|
913
954
|
} else {
|
|
914
955
|
throw new Error('Mode is incorrect');
|
|
915
956
|
}
|
|
@@ -939,7 +980,9 @@ class Combination extends AudioCalibrator {
|
|
|
939
980
|
if (this.sourceNode) this.sourceNode.disconnect();
|
|
940
981
|
this.stepNum += 1;
|
|
941
982
|
console.log('stop calibration audio ' + this.stepNum);
|
|
942
|
-
this.status = this.generateTemplate(
|
|
983
|
+
this.status = this.generateTemplate(
|
|
984
|
+
`All Hz Calibration: stopping the calibration tone...`.toString()
|
|
985
|
+
).toString();
|
|
943
986
|
this.emit('update', {message: this.status});
|
|
944
987
|
};
|
|
945
988
|
|
|
@@ -967,14 +1010,14 @@ class Combination extends AudioCalibrator {
|
|
|
967
1010
|
this.#currentConvolution = this.componentConvolution;
|
|
968
1011
|
this.filteredMLSRange.component.Min = findMinValue(this.#currentConvolution);
|
|
969
1012
|
this.filteredMLSRange.component.Max = findMaxValue(this.#currentConvolution);
|
|
970
|
-
const pre = this._calibrateSoundBurstPreSec;
|
|
971
|
-
const repeats = this._calibrateSoundBurstRepeats;
|
|
972
|
-
const burst = this._calibrateSoundBurstSec;
|
|
973
|
-
const post = this._calibrateSoundBurstPostSec;
|
|
1013
|
+
const pre = this._calibrateSoundBurstPreSec;
|
|
1014
|
+
const repeats = this._calibrateSoundBurstRepeats;
|
|
1015
|
+
const burst = this._calibrateSoundBurstSec;
|
|
1016
|
+
const post = this._calibrateSoundBurstPostSec;
|
|
974
1017
|
const total_dur = pre + repeats * burst + post;
|
|
975
1018
|
this.soundCheck = 'component';
|
|
976
|
-
this.addTimeStamp(`Record ${total_dur} s of MLS with ${this.soundCheck} IIR.”`)
|
|
977
|
-
|
|
1019
|
+
this.addTimeStamp(`Record ${total_dur} s of MLS with ${this.soundCheck} IIR.”`);
|
|
1020
|
+
|
|
978
1021
|
if (this.isCalibrating) return null;
|
|
979
1022
|
await this.playMLSwithIIR(stream, this.#currentConvolution);
|
|
980
1023
|
this.stopCalibrationAudio();
|
|
@@ -996,8 +1039,7 @@ class Combination extends AudioCalibrator {
|
|
|
996
1039
|
this.filteredMLSRange.system.Max = findMaxValue(this.#currentConvolution);
|
|
997
1040
|
this.soundCheck = 'system';
|
|
998
1041
|
|
|
999
|
-
this.addTimeStamp(`Record ${total_dur} s of MLS with ${this.soundCheck} IIR.”`)
|
|
1000
|
-
|
|
1042
|
+
this.addTimeStamp(`Record ${total_dur} s of MLS with ${this.soundCheck} IIR.”`);
|
|
1001
1043
|
|
|
1002
1044
|
if (this.isCalibrating) return null;
|
|
1003
1045
|
await this.playMLSwithIIR(stream, this.#currentConvolution);
|
|
@@ -1040,7 +1082,9 @@ class Combination extends AudioCalibrator {
|
|
|
1040
1082
|
.getSubtractedPSDWithRetry(unconv_rec, knownGain, knownFreq, sampleRate)
|
|
1041
1083
|
.then(res => {
|
|
1042
1084
|
this.incrementStatusBar();
|
|
1043
|
-
this.status = this.generateTemplate(
|
|
1085
|
+
this.status = this.generateTemplate(
|
|
1086
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1087
|
+
).toString();
|
|
1044
1088
|
this.emit('update', {message: this.status});
|
|
1045
1089
|
return res;
|
|
1046
1090
|
})
|
|
@@ -1074,7 +1118,9 @@ class Combination extends AudioCalibrator {
|
|
|
1074
1118
|
|
|
1075
1119
|
this.SDofFilteredRange['component'] = standardDeviation(filtered_psd);
|
|
1076
1120
|
this.incrementStatusBar();
|
|
1077
|
-
this.status =this.generateTemplate(
|
|
1121
|
+
this.status = this.generateTemplate(
|
|
1122
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1123
|
+
).toString();
|
|
1078
1124
|
this.emit('update', {message: this.status});
|
|
1079
1125
|
return res;
|
|
1080
1126
|
})
|
|
@@ -1110,7 +1156,9 @@ class Combination extends AudioCalibrator {
|
|
|
1110
1156
|
console.log('mls_psd', this.SDofFilteredRange['mls']);
|
|
1111
1157
|
this.SDofFilteredRange['system'] = standardDeviation(filtered_psd);
|
|
1112
1158
|
this.incrementStatusBar();
|
|
1113
|
-
this.status = this.generateTemplate(
|
|
1159
|
+
this.status = this.generateTemplate(
|
|
1160
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1161
|
+
).toString();
|
|
1114
1162
|
this.emit('update', {message: this.status});
|
|
1115
1163
|
return res;
|
|
1116
1164
|
})
|
|
@@ -1131,7 +1179,9 @@ class Combination extends AudioCalibrator {
|
|
|
1131
1179
|
})
|
|
1132
1180
|
.then(res => {
|
|
1133
1181
|
this.incrementStatusBar();
|
|
1134
|
-
this.status = this.generateTemplate(
|
|
1182
|
+
this.status = this.generateTemplate(
|
|
1183
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1184
|
+
).toString();
|
|
1135
1185
|
this.emit('update', {message: this.status});
|
|
1136
1186
|
return res;
|
|
1137
1187
|
})
|
|
@@ -1150,7 +1200,9 @@ class Combination extends AudioCalibrator {
|
|
|
1150
1200
|
})
|
|
1151
1201
|
.then(res => {
|
|
1152
1202
|
this.incrementStatusBar();
|
|
1153
|
-
this.status = this.generateTemplate(
|
|
1203
|
+
this.status = this.generateTemplate(
|
|
1204
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1205
|
+
).toString();
|
|
1154
1206
|
this.emit('update', {message: this.status});
|
|
1155
1207
|
return res;
|
|
1156
1208
|
})
|
|
@@ -1167,7 +1219,9 @@ class Combination extends AudioCalibrator {
|
|
|
1167
1219
|
})
|
|
1168
1220
|
.then(res => {
|
|
1169
1221
|
this.incrementStatusBar();
|
|
1170
|
-
this.status = this.generateTemplate(
|
|
1222
|
+
this.status = this.generateTemplate(
|
|
1223
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1224
|
+
).toString();
|
|
1171
1225
|
this.emit('update', {message: this.status});
|
|
1172
1226
|
return res;
|
|
1173
1227
|
})
|
|
@@ -1184,7 +1238,9 @@ class Combination extends AudioCalibrator {
|
|
|
1184
1238
|
})
|
|
1185
1239
|
.then(res => {
|
|
1186
1240
|
this.incrementStatusBar();
|
|
1187
|
-
this.status = this.generateTemplate(
|
|
1241
|
+
this.status = this.generateTemplate(
|
|
1242
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1243
|
+
).toString();
|
|
1188
1244
|
this.emit('update', {message: this.status});
|
|
1189
1245
|
return res;
|
|
1190
1246
|
})
|
|
@@ -1199,7 +1255,9 @@ class Combination extends AudioCalibrator {
|
|
|
1199
1255
|
})
|
|
1200
1256
|
.then(res => {
|
|
1201
1257
|
this.incrementStatusBar();
|
|
1202
|
-
this.status =this.generateTemplate(
|
|
1258
|
+
this.status = this.generateTemplate(
|
|
1259
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1260
|
+
).toString();
|
|
1203
1261
|
this.emit('update', {message: this.status});
|
|
1204
1262
|
return res;
|
|
1205
1263
|
})
|
|
@@ -1216,7 +1274,9 @@ class Combination extends AudioCalibrator {
|
|
|
1216
1274
|
})
|
|
1217
1275
|
.then(res => {
|
|
1218
1276
|
this.incrementStatusBar();
|
|
1219
|
-
this.status = this.generateTemplate(
|
|
1277
|
+
this.status = this.generateTemplate(
|
|
1278
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1279
|
+
).toString();
|
|
1220
1280
|
this.emit('update', {message: this.status});
|
|
1221
1281
|
return res;
|
|
1222
1282
|
})
|
|
@@ -1231,7 +1291,9 @@ class Combination extends AudioCalibrator {
|
|
|
1231
1291
|
})
|
|
1232
1292
|
.then(res => {
|
|
1233
1293
|
this.incrementStatusBar();
|
|
1234
|
-
this.status = this.generateTemplate(
|
|
1294
|
+
this.status = this.generateTemplate(
|
|
1295
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1296
|
+
).toString();
|
|
1235
1297
|
this.emit('update', {message: this.status});
|
|
1236
1298
|
return res;
|
|
1237
1299
|
})
|
|
@@ -1326,17 +1388,17 @@ class Combination extends AudioCalibrator {
|
|
|
1326
1388
|
|
|
1327
1389
|
singleSoundCheck = async stream => {
|
|
1328
1390
|
let iir_ir_and_plots;
|
|
1329
|
-
const pre = this._calibrateSoundBurstPreSec;
|
|
1330
|
-
const repeats = this._calibrateSoundBurstRepeats;
|
|
1331
|
-
const burst = this._calibrateSoundBurstSec;
|
|
1332
|
-
const post = this._calibrateSoundBurstPostSec;
|
|
1391
|
+
const pre = this._calibrateSoundBurstPreSec;
|
|
1392
|
+
const repeats = this._calibrateSoundBurstRepeats;
|
|
1393
|
+
const burst = this._calibrateSoundBurstSec;
|
|
1394
|
+
const post = this._calibrateSoundBurstPostSec;
|
|
1333
1395
|
const total_dur = pre + repeats * burst + post;
|
|
1334
1396
|
if (this._calibrateSoundCheck != 'system') {
|
|
1335
1397
|
this.#currentConvolution = this.componentConvolution;
|
|
1336
1398
|
this.filteredMLSRange.component.Min = findMinValue(this.#currentConvolution);
|
|
1337
1399
|
this.filteredMLSRange.component.Max = findMaxValue(this.#currentConvolution);
|
|
1338
1400
|
this.soundCheck = 'component';
|
|
1339
|
-
this.addTimeStamp(`Record ${total_dur} s of MLS with ${this.soundCheck} IIR.`)
|
|
1401
|
+
this.addTimeStamp(`Record ${total_dur} s of MLS with ${this.soundCheck} IIR.`);
|
|
1340
1402
|
//this.addTimeStamp(`Record ${total_dur} s of MLS with speaker or microphone IIR.`);
|
|
1341
1403
|
if (this.isCalibrating) return null;
|
|
1342
1404
|
await this.playMLSwithIIR(stream, this.#currentConvolution);
|
|
@@ -1346,7 +1408,7 @@ class Combination extends AudioCalibrator {
|
|
|
1346
1408
|
this.filteredMLSRange.system.Min = findMinValue(this.#currentConvolution);
|
|
1347
1409
|
this.filteredMLSRange.system.Max = findMaxValue(this.#currentConvolution);
|
|
1348
1410
|
this.soundCheck = 'system';
|
|
1349
|
-
this.addTimeStamp(`Record ${total_dur} s of MLS with ${this.soundCheck} IIR.`)
|
|
1411
|
+
this.addTimeStamp(`Record ${total_dur} s of MLS with ${this.soundCheck} IIR.`);
|
|
1350
1412
|
//this.addTimeStamp(`Record ${total_dur} s of MLS with speaker or microphone IIR.`);
|
|
1351
1413
|
if (this.isCalibrating) return null;
|
|
1352
1414
|
await this.playMLSwithIIR(stream, this.#currentConvolution);
|
|
@@ -1419,7 +1481,9 @@ class Combination extends AudioCalibrator {
|
|
|
1419
1481
|
this.SDofFilteredRange['mls'] = standardDeviation(mls_psd);
|
|
1420
1482
|
console.log('mls sd', this.SDofFilteredRange['mls']);
|
|
1421
1483
|
this.incrementStatusBar();
|
|
1422
|
-
this.status = this.generateTemplate(
|
|
1484
|
+
this.status = this.generateTemplate(
|
|
1485
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1486
|
+
).toString();
|
|
1423
1487
|
this.emit('update', {message: this.status});
|
|
1424
1488
|
return res;
|
|
1425
1489
|
})
|
|
@@ -1458,7 +1522,9 @@ class Combination extends AudioCalibrator {
|
|
|
1458
1522
|
|
|
1459
1523
|
this.SDofFilteredRange['component'] = standardDeviation(filtered_psd);
|
|
1460
1524
|
this.incrementStatusBar();
|
|
1461
|
-
this.status = this.generateTemplate(
|
|
1525
|
+
this.status = this.generateTemplate(
|
|
1526
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1527
|
+
).toString();
|
|
1462
1528
|
this.emit('update', {message: this.status});
|
|
1463
1529
|
return res;
|
|
1464
1530
|
})
|
|
@@ -1478,7 +1544,9 @@ class Combination extends AudioCalibrator {
|
|
|
1478
1544
|
})
|
|
1479
1545
|
.then(res => {
|
|
1480
1546
|
this.incrementStatusBar();
|
|
1481
|
-
this.status = this.generateTemplate(
|
|
1547
|
+
this.status = this.generateTemplate(
|
|
1548
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1549
|
+
).toString();
|
|
1482
1550
|
this.emit('update', {message: this.status});
|
|
1483
1551
|
return res;
|
|
1484
1552
|
})
|
|
@@ -1497,7 +1565,9 @@ class Combination extends AudioCalibrator {
|
|
|
1497
1565
|
})
|
|
1498
1566
|
.then(res => {
|
|
1499
1567
|
this.incrementStatusBar();
|
|
1500
|
-
this.status = this.generateTemplate(
|
|
1568
|
+
this.status = this.generateTemplate(
|
|
1569
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1570
|
+
).toString();
|
|
1501
1571
|
this.emit('update', {message: this.status});
|
|
1502
1572
|
return res;
|
|
1503
1573
|
})
|
|
@@ -1514,7 +1584,9 @@ class Combination extends AudioCalibrator {
|
|
|
1514
1584
|
})
|
|
1515
1585
|
.then(res => {
|
|
1516
1586
|
this.incrementStatusBar();
|
|
1517
|
-
this.status = this.generateTemplate(
|
|
1587
|
+
this.status = this.generateTemplate(
|
|
1588
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1589
|
+
).toString();
|
|
1518
1590
|
this.emit('update', {message: this.status});
|
|
1519
1591
|
return res;
|
|
1520
1592
|
})
|
|
@@ -1531,7 +1603,9 @@ class Combination extends AudioCalibrator {
|
|
|
1531
1603
|
})
|
|
1532
1604
|
.then(res => {
|
|
1533
1605
|
this.incrementStatusBar();
|
|
1534
|
-
this.status = this.generateTemplate(
|
|
1606
|
+
this.status = this.generateTemplate(
|
|
1607
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1608
|
+
).toString();
|
|
1535
1609
|
this.emit('update', {message: this.status});
|
|
1536
1610
|
return res;
|
|
1537
1611
|
})
|
|
@@ -1546,7 +1620,9 @@ class Combination extends AudioCalibrator {
|
|
|
1546
1620
|
})
|
|
1547
1621
|
.then(res => {
|
|
1548
1622
|
this.incrementStatusBar();
|
|
1549
|
-
this.status = this.generateTemplate(
|
|
1623
|
+
this.status = this.generateTemplate(
|
|
1624
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1625
|
+
).toString();
|
|
1550
1626
|
this.emit('update', {message: this.status});
|
|
1551
1627
|
return res;
|
|
1552
1628
|
})
|
|
@@ -1652,7 +1728,9 @@ class Combination extends AudioCalibrator {
|
|
|
1652
1728
|
this.SDofFilteredRange['mls'] = standardDeviation(mls_psd);
|
|
1653
1729
|
this.SDofFilteredRange['system'] = standardDeviation(filtered_psd);
|
|
1654
1730
|
this.incrementStatusBar();
|
|
1655
|
-
this.status = this.generateTemplate(
|
|
1731
|
+
this.status = this.generateTemplate(
|
|
1732
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1733
|
+
).toString();
|
|
1656
1734
|
this.emit('update', {message: this.status});
|
|
1657
1735
|
return res;
|
|
1658
1736
|
})
|
|
@@ -1673,7 +1751,9 @@ class Combination extends AudioCalibrator {
|
|
|
1673
1751
|
})
|
|
1674
1752
|
.then(res => {
|
|
1675
1753
|
this.incrementStatusBar();
|
|
1676
|
-
this.status = this.generateTemplate(
|
|
1754
|
+
this.status = this.generateTemplate(
|
|
1755
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1756
|
+
).toString();
|
|
1677
1757
|
this.emit('update', {message: this.status});
|
|
1678
1758
|
return res;
|
|
1679
1759
|
})
|
|
@@ -1692,7 +1772,9 @@ class Combination extends AudioCalibrator {
|
|
|
1692
1772
|
})
|
|
1693
1773
|
.then(res => {
|
|
1694
1774
|
this.incrementStatusBar();
|
|
1695
|
-
this.status = this.generateTemplate(
|
|
1775
|
+
this.status = this.generateTemplate(
|
|
1776
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1777
|
+
).toString();
|
|
1696
1778
|
this.emit('update', {message: this.status});
|
|
1697
1779
|
return res;
|
|
1698
1780
|
})
|
|
@@ -1709,7 +1791,9 @@ class Combination extends AudioCalibrator {
|
|
|
1709
1791
|
})
|
|
1710
1792
|
.then(res => {
|
|
1711
1793
|
this.incrementStatusBar();
|
|
1712
|
-
this.status = this.generateTemplate(
|
|
1794
|
+
this.status = this.generateTemplate(
|
|
1795
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1796
|
+
).toString();
|
|
1713
1797
|
this.emit('update', {message: this.status});
|
|
1714
1798
|
return res;
|
|
1715
1799
|
})
|
|
@@ -1726,7 +1810,9 @@ class Combination extends AudioCalibrator {
|
|
|
1726
1810
|
})
|
|
1727
1811
|
.then(res => {
|
|
1728
1812
|
this.incrementStatusBar();
|
|
1729
|
-
this.status = this.generateTemplate(
|
|
1813
|
+
this.status = this.generateTemplate(
|
|
1814
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1815
|
+
).toString();
|
|
1730
1816
|
this.emit('update', {message: this.status});
|
|
1731
1817
|
return res;
|
|
1732
1818
|
})
|
|
@@ -1741,7 +1827,9 @@ class Combination extends AudioCalibrator {
|
|
|
1741
1827
|
})
|
|
1742
1828
|
.then(res => {
|
|
1743
1829
|
this.incrementStatusBar();
|
|
1744
|
-
this.status = this.generateTemplate(
|
|
1830
|
+
this.status = this.generateTemplate(
|
|
1831
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
1832
|
+
).toString();
|
|
1745
1833
|
this.emit('update', {message: this.status});
|
|
1746
1834
|
return res;
|
|
1747
1835
|
})
|
|
@@ -1904,7 +1992,9 @@ class Combination extends AudioCalibrator {
|
|
|
1904
1992
|
this.numSuccessfulBackgroundCaptured = 0;
|
|
1905
1993
|
if (this._calibrateSoundBackgroundSecs > 0) {
|
|
1906
1994
|
this.mode = 'background';
|
|
1907
|
-
this.status = this.generateTemplate(
|
|
1995
|
+
this.status = this.generateTemplate(
|
|
1996
|
+
`All Hz Calibration: sampling the background noise...`.toString()
|
|
1997
|
+
).toString();
|
|
1908
1998
|
this.emit('update', {message: this.status});
|
|
1909
1999
|
if (this.isCalibrating) return null;
|
|
1910
2000
|
await this.recordBackground(
|
|
@@ -1974,7 +2064,9 @@ class Combination extends AudioCalibrator {
|
|
|
1974
2064
|
})
|
|
1975
2065
|
.then(res => {
|
|
1976
2066
|
this.incrementStatusBar();
|
|
1977
|
-
this.status = this.generateTemplate(
|
|
2067
|
+
this.status = this.generateTemplate(
|
|
2068
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
2069
|
+
).toString();
|
|
1978
2070
|
this.emit('update', {message: this.status});
|
|
1979
2071
|
return res;
|
|
1980
2072
|
})
|
|
@@ -1992,7 +2084,9 @@ class Combination extends AudioCalibrator {
|
|
|
1992
2084
|
})
|
|
1993
2085
|
.then(res => {
|
|
1994
2086
|
this.incrementStatusBar();
|
|
1995
|
-
this.status = this.generateTemplate(
|
|
2087
|
+
this.status = this.generateTemplate(
|
|
2088
|
+
`All Hz Calibration: done computing the PSD graphs...`.toString()
|
|
2089
|
+
).toString();
|
|
1996
2090
|
this.emit('update', {message: this.status});
|
|
1997
2091
|
return res;
|
|
1998
2092
|
})
|
|
@@ -2086,7 +2180,7 @@ class Combination extends AudioCalibrator {
|
|
|
2086
2180
|
}
|
|
2087
2181
|
if (this.isCalibrating) return null;
|
|
2088
2182
|
this.percent_complete = 100;
|
|
2089
|
-
this.status =
|
|
2183
|
+
this.status = this.generateTemplate(`All Hz Calibration: Finished`.toString()).toString();
|
|
2090
2184
|
this.addTimeStamp('Done');
|
|
2091
2185
|
this.emit('update', {message: this.status});
|
|
2092
2186
|
|
|
@@ -2223,9 +2317,13 @@ class Combination extends AudioCalibrator {
|
|
|
2223
2317
|
};
|
|
2224
2318
|
|
|
2225
2319
|
#playCalibrationAudioVolume = async () => {
|
|
2226
|
-
if (this.numCalibratingRoundsCompleted==1) {
|
|
2227
|
-
this.recordingChecks['warnings'].push(
|
|
2228
|
-
|
|
2320
|
+
if (this.numCalibratingRoundsCompleted == 1) {
|
|
2321
|
+
this.recordingChecks['warnings'].push(
|
|
2322
|
+
`1000Hz. Re-recorded ${this.inDB} dB because SD ${
|
|
2323
|
+
this.recordingChecks['volume'][this.inDB]['sd']
|
|
2324
|
+
} > ${this.calibrateSound1000HzMaxSD_dB} dB`
|
|
2325
|
+
);
|
|
2326
|
+
const currentStatus = `1000 Hz: Re-recording at ${this.inDB} dB because SD
|
|
2229
2327
|
${this.recordingChecks['volume'][this.inDB]['sd']} >
|
|
2230
2328
|
${this.calibrateSound1000HzMaxSD_dB} dB`.toString();
|
|
2231
2329
|
this.status = this.generateTemplate(currentStatus).toString();
|
|
@@ -2250,7 +2348,7 @@ class Combination extends AudioCalibrator {
|
|
|
2250
2348
|
|
|
2251
2349
|
#sendToServerForProcessing = async lCalib => {
|
|
2252
2350
|
console.log('Sending data to server');
|
|
2253
|
-
|
|
2351
|
+
|
|
2254
2352
|
let left = this.calibrateSound1000HzPreSec;
|
|
2255
2353
|
let right = this.calibrateSound1000HzPreSec + this.calibrateSound1000HzSec;
|
|
2256
2354
|
if (this.isCalibrating) return null;
|
|
@@ -2271,43 +2369,59 @@ class Combination extends AudioCalibrator {
|
|
|
2271
2369
|
.catch(err => {
|
|
2272
2370
|
console.warn(err);
|
|
2273
2371
|
});
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2372
|
+
const rec = this.getLastVolumeRecordedSignal();
|
|
2373
|
+
console.log(
|
|
2374
|
+
'pre period power: ',
|
|
2375
|
+
getPower(rec.slice(0, this.calibrateSound1000HzPreSec * this.sourceSamplingRate)).toFixed(1)
|
|
2376
|
+
);
|
|
2377
|
+
console.log(
|
|
2378
|
+
'pre period power: ',
|
|
2379
|
+
getPower(
|
|
2380
|
+
rec.slice(
|
|
2278
2381
|
this.calibrateSound1000HzPreSec * this.sourceSamplingRate,
|
|
2279
|
-
(this.calibrateSound1000HzPreSec + this.calibrateSound1000HzSec)* this.sourceSamplingRate
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2382
|
+
(this.calibrateSound1000HzPreSec + this.calibrateSound1000HzSec) * this.sourceSamplingRate
|
|
2383
|
+
)
|
|
2384
|
+
).toFixed(1)
|
|
2385
|
+
);
|
|
2386
|
+
console.log(
|
|
2387
|
+
'pre period power: ',
|
|
2388
|
+
getPower(
|
|
2389
|
+
rec.slice(
|
|
2390
|
+
(this.calibrateSound1000HzPreSec + this.calibrateSound1000HzSec) * this.sourceSamplingRate
|
|
2391
|
+
)
|
|
2392
|
+
).toFixed(1)
|
|
2393
|
+
);
|
|
2394
|
+
const res = volumePowerCheck(
|
|
2283
2395
|
rec,
|
|
2284
2396
|
this.sourceSamplingRate || 96000,
|
|
2285
2397
|
this.calibrateSound1000HzPreSec,
|
|
2286
|
-
this.calibrateSound1000HzSec,
|
|
2287
|
-
this._calibrateSoundPowerBinDesiredSec
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2398
|
+
this.calibrateSound1000HzSec,
|
|
2399
|
+
this._calibrateSoundPowerBinDesiredSec
|
|
2400
|
+
);
|
|
2401
|
+
console.log(res);
|
|
2402
|
+
this.recordingChecks['volume'][this.inDB] = res;
|
|
2403
|
+
console.log('Recording checks in sendToServer', this.recordingChecks['volume']);
|
|
2404
|
+
const getSD = () => this.recordingChecks['volume'][this.inDB]['sd'];
|
|
2292
2405
|
const getSDMessage = () => {
|
|
2293
2406
|
//SOUND 6.7 s. 2.5+2.5+0.5 s. 1000 Hz at -60 dB. SD = 1.3 dB
|
|
2294
2407
|
// And reporting each rejected recording as
|
|
2295
2408
|
// SOUND 6.7 s. 2.5+2.5+0.5 s. 1000 Hz at -60 dB, SD = 19.7 > 4 dB.
|
|
2296
2409
|
|
|
2297
|
-
if(this.numCalibratingRoundsCompleted==1)
|
|
2410
|
+
if (this.numCalibratingRoundsCompleted == 1)
|
|
2298
2411
|
return `, SD = ${getSD()} > ${this.calibrateSound1000HzMaxSD_dB} dB.`;
|
|
2299
|
-
return `. SD = ${getSD()} dB
|
|
2300
|
-
}
|
|
2301
|
-
const total_dur =
|
|
2302
|
-
|
|
2412
|
+
return `. SD = ${getSD()} dB`;
|
|
2413
|
+
};
|
|
2414
|
+
const total_dur =
|
|
2415
|
+
this.calibrateSound1000HzPreSec +
|
|
2416
|
+
this.calibrateSound1000HzSec +
|
|
2417
|
+
this.calibrateSound1000HzPostSec;
|
|
2418
|
+
|
|
2303
2419
|
this.addTimeStamp(
|
|
2304
|
-
`${this.calibrateSound1000HzPreSec.toFixed(1)}` +
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2420
|
+
`${this.calibrateSound1000HzPreSec.toFixed(1)}` +
|
|
2421
|
+
`+ ${this.calibrateSound1000HzSec.toFixed(1)}` +
|
|
2422
|
+
`+ ${this.calibrateSound1000HzPostSec.toFixed(1)} s.` +
|
|
2423
|
+
`1000 Hz at ${this.inDB} dB${getSDMessage()}`
|
|
2308
2424
|
);
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
2425
|
};
|
|
2312
2426
|
|
|
2313
2427
|
startCalibrationVolume = async (stream, gainValues, lCalib, componentGainDBSPL) => {
|
|
@@ -2324,7 +2438,9 @@ class Combination extends AudioCalibrator {
|
|
|
2324
2438
|
const soundLevelToDiscard = -60;
|
|
2325
2439
|
const gainToDiscard = Math.pow(10, soundLevelToDiscard / 20);
|
|
2326
2440
|
this.inDB = soundLevelToDiscard;
|
|
2327
|
-
this.status = this.generateTemplate(
|
|
2441
|
+
this.status = this.generateTemplate(
|
|
2442
|
+
`1000 Hz Calibration: Sound Level ${soundLevelToDiscard} dB`.toString()
|
|
2443
|
+
).toString();
|
|
2328
2444
|
//this.emit('update', {message: `1000 Hz Calibration: Sound Level ${soundLevelToDiscard} dB`});
|
|
2329
2445
|
this.emit('update', {message: this.status});
|
|
2330
2446
|
this.startTime = new Date().getTime();
|
|
@@ -2344,7 +2460,9 @@ class Combination extends AudioCalibrator {
|
|
|
2344
2460
|
gainToDiscard,
|
|
2345
2461
|
lCalib, //todo make this a class parameter
|
|
2346
2462
|
checkRec,
|
|
2347
|
-
() => {
|
|
2463
|
+
() => {
|
|
2464
|
+
return this.recordingChecks['volume'][this.inDB]['sd'];
|
|
2465
|
+
},
|
|
2348
2466
|
this.calibrateSound1000HzMaxSD_dB
|
|
2349
2467
|
);
|
|
2350
2468
|
} while (this.outDBSPL === null);
|
|
@@ -2368,7 +2486,9 @@ class Combination extends AudioCalibrator {
|
|
|
2368
2486
|
this.inDB = inDB;
|
|
2369
2487
|
inDBValues.push(inDB);
|
|
2370
2488
|
console.log('next update');
|
|
2371
|
-
this.status = this.generateTemplate(
|
|
2489
|
+
this.status = this.generateTemplate(
|
|
2490
|
+
`1000 Hz Calibration: Sound Level ${inDB} dB`.toString()
|
|
2491
|
+
).toString();
|
|
2372
2492
|
this.emit('update', {message: this.status});
|
|
2373
2493
|
do {
|
|
2374
2494
|
if (this.isCalibrating) {
|
|
@@ -2384,7 +2504,9 @@ class Combination extends AudioCalibrator {
|
|
|
2384
2504
|
gainValues[i],
|
|
2385
2505
|
lCalib, //todo make this a class parameter
|
|
2386
2506
|
checkRec,
|
|
2387
|
-
() => {
|
|
2507
|
+
() => {
|
|
2508
|
+
return this.recordingChecks?.['volume']?.[this.inDB]?.['sd'] || 0;
|
|
2509
|
+
},
|
|
2388
2510
|
this.calibrateSound1000HzMaxSD_dB
|
|
2389
2511
|
);
|
|
2390
2512
|
} while (this.outDBSPL === null);
|
|
@@ -2648,15 +2770,19 @@ class Combination extends AudioCalibrator {
|
|
|
2648
2770
|
sampleRate: this.sourceSamplingRate || 96000,
|
|
2649
2771
|
binDesiredSec: this._calibrateSoundPowerBinDesiredSec,
|
|
2650
2772
|
burstSec: this.desired_time_per_mls,
|
|
2651
|
-
repeats: this.numMLSPerCapture - this.num_mls_to_skip
|
|
2652
|
-
warmUp: this.num_mls_to_skip
|
|
2773
|
+
repeats: this.numMLSPerCapture - this.num_mls_to_skip,
|
|
2774
|
+
warmUp: this.num_mls_to_skip,
|
|
2653
2775
|
})
|
|
2654
2776
|
.then(result => {
|
|
2655
2777
|
if (result) {
|
|
2656
2778
|
if (result['sd'] > this._calibrateSoundBurstMaxSD_dB && this.numSuccessfulCaptured == 0) {
|
|
2657
2779
|
console.log('filtered recording sd too high');
|
|
2658
|
-
this.recordingChecks['warnings'].push(
|
|
2659
|
-
|
|
2780
|
+
this.recordingChecks['warnings'].push(
|
|
2781
|
+
`All Hz. Re-recorded ${this.inDB} because SD ${result['sd']} > ${this._calibrateSoundBurstMaxSD_dB} dB`
|
|
2782
|
+
);
|
|
2783
|
+
this.status = this.generateTemplate(
|
|
2784
|
+
`All Hz: Re-recording at ${this.inDB} dB because SD ${result['sd']} > ${this._calibrateSoundBurstMaxSD_dB} dB`.toString()
|
|
2785
|
+
).toString();
|
|
2660
2786
|
this.emit('update', {
|
|
2661
2787
|
message: this.status,
|
|
2662
2788
|
});
|
|
@@ -2675,7 +2801,9 @@ class Combination extends AudioCalibrator {
|
|
|
2675
2801
|
console.log(
|
|
2676
2802
|
'after mls w iir record for some reason add numSucc capt ' + this.stepNum
|
|
2677
2803
|
);
|
|
2678
|
-
this.status = this.generateTemplate(
|
|
2804
|
+
this.status = this.generateTemplate(
|
|
2805
|
+
`All Hz Calibration: ${this.numSuccessfulCaptured} recording of convolved MLS captured`.toString()
|
|
2806
|
+
).toString();
|
|
2679
2807
|
this.emit('update', {
|
|
2680
2808
|
message: this.status,
|
|
2681
2809
|
});
|
|
@@ -2754,10 +2882,9 @@ class Combination extends AudioCalibrator {
|
|
|
2754
2882
|
_calibrateSoundBurstMaxSD_dB = 4,
|
|
2755
2883
|
calibrateSoundSamplingDesiredBits = 24,
|
|
2756
2884
|
language,
|
|
2757
|
-
loudspeakerModelName='',
|
|
2885
|
+
loudspeakerModelName = '',
|
|
2758
2886
|
phrases,
|
|
2759
|
-
soundSubtitleId
|
|
2760
|
-
|
|
2887
|
+
soundSubtitleId
|
|
2761
2888
|
) => {
|
|
2762
2889
|
this._calibrateSoundBurstPreSec = _calibrateSoundBurstPreSec;
|
|
2763
2890
|
this._calibrateSoundBurstRepeats = _calibrateSoundBurstRepeats;
|
|
@@ -2797,14 +2924,14 @@ class Combination extends AudioCalibrator {
|
|
|
2797
2924
|
this.phrases = phrases;
|
|
2798
2925
|
this.soundSubtitleId = soundSubtitleId;
|
|
2799
2926
|
if (isSmartPhone) {
|
|
2800
|
-
const leftQuote =
|
|
2801
|
-
|
|
2927
|
+
const leftQuote = '\u201C'; // “
|
|
2928
|
+
const rightQuote = '\u201D'; // ”
|
|
2802
2929
|
this.webAudioDeviceNames.microphone = this.deviceInfo.microphoneFromAPI;
|
|
2803
2930
|
const quotedWebAudioMic = leftQuote + this.webAudioDeviceNames.microphone + rightQuote;
|
|
2804
|
-
const combinedMicText = this.micModelName +
|
|
2931
|
+
const combinedMicText = this.micModelName + ' ' + quotedWebAudioMic;
|
|
2805
2932
|
webAudioDeviceNames.microphoneText = this.phrases.RC_nameMicrophone[this.language]
|
|
2806
|
-
|
|
2807
|
-
|
|
2933
|
+
.replace('“xxx”', combinedMicText)
|
|
2934
|
+
.replace('“XXX”', combinedMicText);
|
|
2808
2935
|
}
|
|
2809
2936
|
// this.webAudioDeviceNames.microphoneText = this.webAudioDeviceNames.microphoneText
|
|
2810
2937
|
// .replace('xxx', this.webAudioDeviceNames.microphone)
|
|
@@ -2822,7 +2949,9 @@ class Combination extends AudioCalibrator {
|
|
|
2822
2949
|
const OEM = isSmartPhone
|
|
2823
2950
|
? micModelName === 'UMIK-1' || micModelName === 'UMIK-2'
|
|
2824
2951
|
? 'minidsp'
|
|
2825
|
-
: this.deviceInfo.OEM
|
|
2952
|
+
: this.deviceInfo.OEM
|
|
2953
|
+
? this.deviceInfo.OEM.toLowerCase().split(' ').join('')
|
|
2954
|
+
: micManufacturer.toLowerCase().split(' ').join('')
|
|
2826
2955
|
: micManufacturer.toLowerCase().split(' ').join('');
|
|
2827
2956
|
// const ID = "712-5669";
|
|
2828
2957
|
// const OEM = "minidsp";
|
|
@@ -2851,7 +2980,7 @@ class Combination extends AudioCalibrator {
|
|
|
2851
2980
|
microphone: this.webAudioDeviceNames.microphone,
|
|
2852
2981
|
},
|
|
2853
2982
|
userIDs: userIDs,
|
|
2854
|
-
lowercaseOEM: OEM.toLowerCase().split(' ').join(''),
|
|
2983
|
+
lowercaseOEM: OEM ? OEM.toLowerCase().split(' ').join('') : '',
|
|
2855
2984
|
};
|
|
2856
2985
|
if (calibrateMicrophonesBool) {
|
|
2857
2986
|
micInfo['authorEmails'] = authorEmails;
|
|
@@ -3028,4 +3157,4 @@ class Combination extends AudioCalibrator {
|
|
|
3028
3157
|
};
|
|
3029
3158
|
}
|
|
3030
3159
|
|
|
3031
|
-
export default Combination;
|
|
3160
|
+
export default Combination;
|