speaker-calibration 2.2.166 → 2.2.168
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 +3116 -2291
- package/dist/main.js +3 -3
- package/package.json +1 -1
- package/src/peer-connection/speaker.js +0 -1
- package/src/tasks/combination/combination.js +34 -2
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: [],
|
|
@@ -739,6 +743,7 @@ class Combination extends AudioCalibrator {
|
|
|
739
743
|
*/
|
|
740
744
|
#afterMLSRecord = async () => {
|
|
741
745
|
console.log('after record');
|
|
746
|
+
this.addTimeStamp(`After record unfiltered mls version ${this.icapture}`);
|
|
742
747
|
await this.sendRecordingToServerForProcessing();
|
|
743
748
|
};
|
|
744
749
|
|
|
@@ -850,11 +855,11 @@ class Combination extends AudioCalibrator {
|
|
|
850
855
|
* @example
|
|
851
856
|
*/
|
|
852
857
|
#playCalibrationAudio = () => {
|
|
853
|
-
this.addTimeStamp('Play unfiltered mls');
|
|
854
858
|
this.calibrationNodes[0].start(0);
|
|
855
859
|
this.status = ``;
|
|
856
860
|
if (this.mode === 'unfiltered') {
|
|
857
861
|
console.log('play calibration audio ' + this.stepNum);
|
|
862
|
+
this.addTimeStamp(`Start recording MLS version ${this.icapture}`);
|
|
858
863
|
this.status =
|
|
859
864
|
`All Hz Calibration: playing the calibration tone...`.toString() +
|
|
860
865
|
this.generateTemplate().toString();
|
|
@@ -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;
|