speaker-calibration 2.2.227 → 2.2.229

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speaker-calibration",
3
- "version": "2.2.227",
3
+ "version": "2.2.229",
4
4
  "description": "Speaker calibration library for auditory testing",
5
5
  "main": "dist/main.js",
6
6
  "directories": {
@@ -55,7 +55,6 @@ class Listener extends AudioPeer {
55
55
  };
56
56
 
57
57
  sendSamplingRate = sampleRate => {
58
- this.displayUpdate('Listener - sendSamplingRate');
59
58
  this.connectionManager.send({
60
59
  name: 'SoundCalibration',
61
60
  payload: {
@@ -66,7 +65,6 @@ class Listener extends AudioPeer {
66
65
  };
67
66
 
68
67
  sendSampleSize = sampleSize => {
69
- this.displayUpdate('Listener - sendSampleSize');
70
68
  this.connectionManager.send({
71
69
  name: 'SoundCalibration',
72
70
  payload: {
@@ -77,7 +75,6 @@ class Listener extends AudioPeer {
77
75
  };
78
76
 
79
77
  sendFlags = flags => {
80
- this.displayUpdate('Listener - sendFlags');
81
78
  this.connectionManager.send({
82
79
  name: 'SoundCalibration',
83
80
  payload: {
@@ -142,10 +139,6 @@ class Listener extends AudioPeer {
142
139
  console.log(track);
143
140
  const capabilities = track.getCapabilities();
144
141
 
145
- this.displayUpdate(
146
- `Listener Track Capabilities - ${JSON.stringify(capabilities, undefined, 2)}`
147
- );
148
-
149
142
  const constraints = track.getConstraints();
150
143
 
151
144
  if (capabilities.echoCancellation) {
@@ -164,8 +157,6 @@ class Listener extends AudioPeer {
164
157
  constraints.channelCount = 1;
165
158
  }
166
159
 
167
- this.displayUpdate(`Listener Track Constraints - ${JSON.stringify(constraints, undefined, 2)}`);
168
-
169
160
  // await the promise
170
161
  try {
171
162
  await track.applyConstraints(constraints);
@@ -261,13 +252,6 @@ class Listener extends AudioPeer {
261
252
  //audio: {echoCancellation: false, noiseSuppression: false, autoGainControl: false, deviceId: {exact: await this.getDeviceIdByLabel(this.microphoneDeviceId) }},
262
253
  })
263
254
  .then(stream => {
264
- this.displayUpdate(
265
- `Listener Track settings before applied constraints - ${JSON.stringify(
266
- stream.getAudioTracks()[0].getSettings(),
267
- undefined,
268
- 2
269
- )}`
270
- );
271
255
  this.applyHQTrackConstraints(stream)
272
256
  .then(settings => {
273
257
  console.log(settings);
@@ -163,6 +163,7 @@ class Speaker extends AudioPeer {
163
163
 
164
164
  await speaker.connectionManager.waitForPeerConnection();
165
165
  await speaker.connectionManager.resolveWhenHandshakeReceived();
166
+ speaker.connectionManager.sendPageTitle('EasyEyes Microphone');
166
167
 
167
168
  // Send connection parameters to the listener
168
169
  speaker.connectionManager.send(speaker.prepareConnectionParams());
@@ -439,14 +439,8 @@ class Combination extends AudioCalibrator {
439
439
  })
440
440
  .then(result => {
441
441
  console.log(result);
442
- this.systemConvolution = this.upsampleSignal(
443
- result['convolution'],
444
- this._calibrateSoundBurstDownsample
445
- );
446
- this.systemConvolutionNoBandpass = this.upsampleSignal(
447
- result['convolution_no_bandpass'],
448
- this._calibrateSoundBurstDownsample
449
- );
442
+ this.systemConvolution = result['convolution'];
443
+ this.systemConvolutionNoBandpass = result['convolution_no_bandpass'];
450
444
  });
451
445
 
452
446
  // attenuate the system convolution if the amplitude is greater than this.calibrateSoundLimit
@@ -679,7 +673,10 @@ class Combination extends AudioCalibrator {
679
673
  'Obtaining last all hz unfiltered recording from #allHzUnfilteredRecordings to send to server for processing'
680
674
  );
681
675
  const numSignals = allSignals.length;
682
- const mls = this.#mlsBufferView[this.icapture];
676
+ const mls = this.downsampleSignal(
677
+ this.#mlsBufferView[this.icapture],
678
+ this._calibrateSoundBurstDownsample
679
+ );
683
680
  const payload =
684
681
  signalCsv && signalCsv.length > 0 ? csvToArray(signalCsv) : allSignals[numSignals - 1];
685
682
  console.log('sending rec');
@@ -691,9 +688,10 @@ class Combination extends AudioCalibrator {
691
688
  this.emit('update', {message: this.status});
692
689
  if (this.isCalibrating) return null;
693
690
  const fMLS = this.sourceSamplingRate / this._calibrateSoundBurstDownsample;
691
+ const payload_downsampled = this.downsampleSignal(payload, this._calibrateSoundBurstDownsample);
694
692
  await this.pyServerAPI
695
693
  .allHzPowerCheck({
696
- payload,
694
+ payload: payload_downsampled,
697
695
  sampleRate: fMLS,
698
696
  binDesiredSec: this._calibrateSoundPowerBinDesiredSec,
699
697
  burstSec: this.desired_time_per_mls,
@@ -1103,6 +1101,10 @@ class Combination extends AudioCalibrator {
1103
1101
  bothSoundCheck = async stream => {
1104
1102
  let iir_ir_and_plots;
1105
1103
  this.#currentConvolution = this.componentConvolution;
1104
+ this.#currentConvolution = this.upsampleSignal(
1105
+ this.#currentConvolution,
1106
+ this._calibrateSoundBurstDownsample
1107
+ );
1106
1108
  this.filteredMLSRange.component.Min = findMinValue(this.#currentConvolution);
1107
1109
  this.filteredMLSRange.component.Max = findMaxValue(this.#currentConvolution);
1108
1110
  const pre = this._calibrateSoundBurstPreSec;
@@ -1130,6 +1132,10 @@ class Combination extends AudioCalibrator {
1130
1132
 
1131
1133
  this.numSuccessfulCaptured = 0;
1132
1134
  this.#currentConvolution = this.systemConvolution;
1135
+ this.#currentConvolution = this.upsampleSignal(
1136
+ this.#currentConvolution,
1137
+ this._calibrateSoundBurstDownsample
1138
+ );
1133
1139
  this.filteredMLSRange.system.Min = findMinValue(this.#currentConvolution);
1134
1140
  this.filteredMLSRange.system.Max = findMaxValue(this.#currentConvolution);
1135
1141
  this.soundCheck = 'system';
@@ -1516,6 +1522,10 @@ class Combination extends AudioCalibrator {
1516
1522
  const total_dur = pre + repeats * burst + post;
1517
1523
  if (this._calibrateSoundCheck != 'system') {
1518
1524
  this.#currentConvolution = this.componentConvolution;
1525
+ this.#currentConvolution = this.upsampleSignal(
1526
+ this.#currentConvolution,
1527
+ this._calibrateSoundBurstDownsample
1528
+ );
1519
1529
  this.filteredMLSRange.component.Min = findMinValue(this.#currentConvolution);
1520
1530
  this.filteredMLSRange.component.Max = findMaxValue(this.#currentConvolution);
1521
1531
  this.soundCheck = 'component';
@@ -1526,6 +1536,10 @@ class Combination extends AudioCalibrator {
1526
1536
  this.stopCalibrationAudio();
1527
1537
  } else {
1528
1538
  this.#currentConvolution = this.systemConvolution;
1539
+ this.#currentConvolution = this.upsampleSignal(
1540
+ this.#currentConvolution,
1541
+ this._calibrateSoundBurstDownsample
1542
+ );
1529
1543
  this.filteredMLSRange.system.Min = findMinValue(this.#currentConvolution);
1530
1544
  this.filteredMLSRange.system.Max = findMaxValue(this.#currentConvolution);
1531
1545
  this.soundCheck = 'system';