speaker-calibration 2.2.166 → 2.2.167
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 +2303 -2131
- package/dist/main.js +2 -2
- package/package.json +1 -1
- package/src/tasks/combination/combination.js +33 -1
package/package.json
CHANGED
|
@@ -231,6 +231,10 @@ class Combination extends AudioCalibrator {
|
|
|
231
231
|
|
|
232
232
|
webAudioDeviceNames = {loudspeaker: '', microphone: '', loudspeakerText: '', microphoneText: ''};
|
|
233
233
|
|
|
234
|
+
waveforms = {
|
|
235
|
+
volume: {}
|
|
236
|
+
};
|
|
237
|
+
|
|
234
238
|
recordingChecks = {
|
|
235
239
|
volume: {},
|
|
236
240
|
unfiltered: [],
|
|
@@ -2143,6 +2147,7 @@ class Combination extends AudioCalibrator {
|
|
|
2143
2147
|
const audioContext = this.makeNewSourceAudioContext();
|
|
2144
2148
|
const oscilator = audioContext.createOscillator();
|
|
2145
2149
|
const gainNode = audioContext.createGain();
|
|
2150
|
+
console.log(gainValue);
|
|
2146
2151
|
const taperGainNode = audioContext.createGain();
|
|
2147
2152
|
const offsetGainNode = audioContext.createGain();
|
|
2148
2153
|
const totalDuration = this.CALIBRATION_TONE_DURATION * 1.2;
|
|
@@ -2164,6 +2169,32 @@ class Combination extends AudioCalibrator {
|
|
|
2164
2169
|
);
|
|
2165
2170
|
offsetGainNode.connect(audioContext.destination);
|
|
2166
2171
|
|
|
2172
|
+
const gainValuesOverTime = [];
|
|
2173
|
+
const sampleRate = this.#CALIBRATION_TONE_FREQUENCY; // Number of samples per second
|
|
2174
|
+
const interval = 1 / sampleRate; // Time between samples
|
|
2175
|
+
|
|
2176
|
+
for (let t = 0; t <= totalDuration; t += interval) {
|
|
2177
|
+
|
|
2178
|
+
let gainValueAtTime = gainValue;
|
|
2179
|
+
|
|
2180
|
+
// Apply the onset curve
|
|
2181
|
+
if (t < this.TAPER_SECS) {
|
|
2182
|
+
const onsetIndex = Math.floor((t / this.TAPER_SECS) * onsetCurve.length);
|
|
2183
|
+
gainValueAtTime *= onsetCurve[onsetIndex];
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
// Apply the offset curve
|
|
2187
|
+
if (t > totalDuration - this.TAPER_SECS) {
|
|
2188
|
+
const offsetTime = t - (totalDuration - this.TAPER_SECS);
|
|
2189
|
+
const offsetIndex = Math.floor((offsetTime / this.TAPER_SECS) * offsetCurve.length);
|
|
2190
|
+
gainValueAtTime *= offsetCurve[offsetIndex];
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
gainValuesOverTime.push(gainValueAtTime);
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2196
|
+
this.waveforms['volume'][this.inDB] = gainValuesOverTime;
|
|
2197
|
+
|
|
2167
2198
|
this.addCalibrationNode(oscilator);
|
|
2168
2199
|
};
|
|
2169
2200
|
|
|
@@ -2244,7 +2275,7 @@ class Combination extends AudioCalibrator {
|
|
|
2244
2275
|
};
|
|
2245
2276
|
|
|
2246
2277
|
startCalibrationVolume = async (stream, gainValues, lCalib, componentGainDBSPL) => {
|
|
2247
|
-
|
|
2278
|
+
|
|
2248
2279
|
if (this.isCalibrating) return null;
|
|
2249
2280
|
const trialIterations = gainValues.length;
|
|
2250
2281
|
this.status_denominator += trialIterations;
|
|
@@ -2876,6 +2907,7 @@ class Combination extends AudioCalibrator {
|
|
|
2876
2907
|
const timeStampresult = [...this.timeStamp].join('\n');
|
|
2877
2908
|
total_results['timeStamps'] = timeStampresult;
|
|
2878
2909
|
total_results['recordingChecks'] = this.recordingChecks;
|
|
2910
|
+
total_results['waveforms'] = this.waveforms;
|
|
2879
2911
|
total_results['component']['phase'] = this.componentIRPhase;
|
|
2880
2912
|
total_results['system']['phase'] = this.systemIRPhase;
|
|
2881
2913
|
total_results['qualityMetrics'] = this.SDofFilteredRange;
|