speaker-calibration 2.2.163 → 2.2.165

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.163",
3
+ "version": "2.2.165",
4
4
  "description": "Speaker calibration library for auditory testing",
5
5
  "main": "dist/main.js",
6
6
  "directories": {
@@ -90,7 +90,6 @@ class Speaker extends AudioPeer {
90
90
  }
91
91
 
92
92
  // resolve when we have a result
93
- console.log(params.calibrateSoundIRSec);
94
93
  console.log(params);
95
94
  speaker.result = await speaker.ac.startCalibration(
96
95
  stream,
@@ -753,17 +753,20 @@ class Combination extends AudioCalibrator {
753
753
  * .
754
754
  * Created an S Curver Buffer to taper the signal onset
755
755
  *
756
- * @param {*} length
757
- * @param {*} phase
756
+ * @param {*} onSetBool
758
757
  * @returns
759
758
  * @example
760
759
  */
761
- static createSCurveBuffer = (length, phase) => {
762
- const curve = new Float32Array(length);
763
- let i;
764
- for (i = 0; i < length; i += 1) {
765
- // scale the curve to be between 0-1
766
- curve[i] = Math.sin((Math.PI * i) / length - phase) / 2 + 0.5;
760
+ createSCurveBuffer = (onSetBool = true) => {
761
+ const curve = new Float32Array(this.TAPER_SECS * this.sourceSamplingRate + 1);
762
+ const frequency = 1 / (4 * this.TAPER_SECS);
763
+ let j = 0;
764
+ for (let i = 0; i < this.TAPER_SECS * this.sourceSamplingRate + 1; i += 1) {
765
+ const phase = 2 * Math.PI * frequency * j;
766
+ const onsetTaper = Math.pow(Math.sin(phase), 2);
767
+ const offsetTaper = Math.pow(Math.cos(phase), 2);
768
+ curve[i] = onSetBool ? onsetTaper : offsetTaper;
769
+ j += 1 / this.sourceSamplingRate;
767
770
  }
768
771
  return curve;
769
772
  };
@@ -2095,19 +2098,7 @@ class Combination extends AudioCalibrator {
2095
2098
  }
2096
2099
  };
2097
2100
 
2098
- createSCurveBuffer = (onSetBool = true) => {
2099
- const curve = new Float32Array(this.TAPER_SECS * this.sourceSamplingRate + 1);
2100
- const frequency = 1 / (4 * this.TAPER_SECS);
2101
- let j = 0;
2102
- for (let i = 0; i < this.TAPER_SECS * this.sourceSamplingRate + 1; i += 1) {
2103
- const phase = 2 * Math.PI * frequency * j;
2104
- const onsetTaper = Math.pow(Math.sin(phase), 2);
2105
- const offsetTaper = Math.pow(Math.cos(phase), 2);
2106
- curve[i] = onSetBool ? onsetTaper : offsetTaper;
2107
- j += 1 / this.sourceSamplingRate;
2108
- }
2109
- return curve;
2110
- };
2101
+
2111
2102
 
2112
2103
  #getTruncatedSignal = (left = 3.5, right = 4.5) => {
2113
2104
  const start = Math.floor(left * this.sourceSamplingRate);