speaker-calibration 2.2.265 → 2.2.267
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 +6550 -5924
- package/dist/listener.js +1 -1
- package/dist/main.js +1 -1
- package/dist/phonePeer.js +1 -1
- package/package.json +1 -1
- package/src/tasks/combination/combination.js +5 -4
package/package.json
CHANGED
|
@@ -2339,7 +2339,7 @@ class Combination extends AudioCalibrator {
|
|
|
2339
2339
|
this.power_dB = this._calibrateSoundBurstDb + (this.T - this.gainDBSPL);
|
|
2340
2340
|
}
|
|
2341
2341
|
|
|
2342
|
-
const amplitude = Math.pow(10, this.power_dB / 20);
|
|
2342
|
+
const amplitude = Math.pow(10, this.power_dB / 20) / Math.SQRT2;
|
|
2343
2343
|
|
|
2344
2344
|
if (this.isCalibrating) return null;
|
|
2345
2345
|
await this.pyServerAPI
|
|
@@ -2810,7 +2810,8 @@ class Combination extends AudioCalibrator {
|
|
|
2810
2810
|
|
|
2811
2811
|
oscilator.frequency.value = this.#CALIBRATION_TONE_FREQUENCY;
|
|
2812
2812
|
oscilator.type = this.#CALIBRATION_TONE_TYPE;
|
|
2813
|
-
|
|
2813
|
+
// Multiply by sqrt(2) so that requested dB (based on RMS) maps to oscillator peak
|
|
2814
|
+
gainNode.gain.value = gainValue * Math.SQRT2;
|
|
2814
2815
|
|
|
2815
2816
|
oscilator.connect(gainNode);
|
|
2816
2817
|
gainNode.connect(taperGainNode);
|
|
@@ -3964,8 +3965,8 @@ class Combination extends AudioCalibrator {
|
|
|
3964
3965
|
for (let i = 0; i < numSamples; i++) {
|
|
3965
3966
|
const t = i / sampleRate;
|
|
3966
3967
|
|
|
3967
|
-
// Base sine wave at specified frequency
|
|
3968
|
-
let value = Math.sin(2 * Math.PI * frequency * t) * gainValue;
|
|
3968
|
+
// Base sine wave at specified frequency; scale by sqrt(2) so RMS matches requested dB
|
|
3969
|
+
let value = Math.sin(2 * Math.PI * frequency * t) * gainValue * Math.SQRT2;
|
|
3969
3970
|
|
|
3970
3971
|
// Apply taper at beginning and end
|
|
3971
3972
|
if (t < this.TAPER_SECS) {
|