@entros/pulse-sdk 1.5.1 → 1.5.3
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/index.d.mts +27 -30
- package/dist/index.d.ts +27 -30
- package/dist/index.js +34 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
package/dist/index.mjs
CHANGED
|
@@ -59,9 +59,30 @@ async function captureAudio(options = {}) {
|
|
|
59
59
|
audio: {
|
|
60
60
|
sampleRate: TARGET_SAMPLE_RATE,
|
|
61
61
|
channelCount: 1,
|
|
62
|
+
// Capture without browser-side audio processing — preserves the
|
|
63
|
+
// raw microphone signal for the SDK's downstream feature extraction
|
|
64
|
+
// and for server-side validation. Audio cleanup intended for the
|
|
65
|
+
// transcription path runs server-side, on a parallel path that
|
|
66
|
+
// never feeds back to feature extraction. Matches the mobile SDK's
|
|
67
|
+
// choice of Android's `MIC` source over `VOICE_RECOGNITION` —
|
|
68
|
+
// same architectural decision, two platforms.
|
|
62
69
|
echoCancellation: false,
|
|
63
70
|
noiseSuppression: false,
|
|
64
|
-
autoGainControl: false
|
|
71
|
+
autoGainControl: false,
|
|
72
|
+
// OS-level voice isolation request (W3C Media Capture Extensions,
|
|
73
|
+
// 2024). Activates the platform DSP on Chrome 124+ / ChromeOS and
|
|
74
|
+
// surfaces Apple Voice Isolation Mic Mode on Safari macOS Sonoma+
|
|
75
|
+
// / iOS 17+ when the user has it enabled in Control Center.
|
|
76
|
+
// Silently ignored on browsers/OSes without support, so the
|
|
77
|
+
// constraint costs nothing where it doesn't help. Distinct
|
|
78
|
+
// mechanism from `noiseSuppression` above — that flag controls
|
|
79
|
+
// WebRTC's hand-tuned AudioProcessingModule, this requests the
|
|
80
|
+
// OS-native neural effect.
|
|
81
|
+
// @ts-expect-error -- W3C Media Capture Extensions property; not
|
|
82
|
+
// yet in lib.dom.d.ts as of TypeScript 6.0. Removing this directive
|
|
83
|
+
// becomes a compile error once lib.dom catches up, signaling that
|
|
84
|
+
// it can be deleted.
|
|
85
|
+
voiceIsolation: true
|
|
65
86
|
}
|
|
66
87
|
});
|
|
67
88
|
let ctx;
|
|
@@ -561,6 +582,7 @@ async function getMeyda() {
|
|
|
561
582
|
}
|
|
562
583
|
return meydaModule.default ?? meydaModule;
|
|
563
584
|
}
|
|
585
|
+
var F0_YIELD_EVERY_N_FRAMES = 16;
|
|
564
586
|
async function detectF0Contour(samples, sampleRate) {
|
|
565
587
|
const detect = await getPitchDetector(sampleRate);
|
|
566
588
|
const frameSize = getFrameSize(sampleRate);
|
|
@@ -587,6 +609,9 @@ async function detectF0Contour(samples, sampleRate) {
|
|
|
587
609
|
sum += (frame[j] ?? 0) * (frame[j] ?? 0);
|
|
588
610
|
}
|
|
589
611
|
amplitudes.push(Math.sqrt(sum / frame.length));
|
|
612
|
+
if (i > 0 && i < numFrames - 1 && i % F0_YIELD_EVERY_N_FRAMES === 0) {
|
|
613
|
+
await yieldToMainThread();
|
|
614
|
+
}
|
|
590
615
|
}
|
|
591
616
|
return { f0, amplitudes, periods };
|
|
592
617
|
}
|
|
@@ -4653,9 +4678,16 @@ var PulseSession = class {
|
|
|
4653
4678
|
audio: {
|
|
4654
4679
|
sampleRate: 16e3,
|
|
4655
4680
|
channelCount: 1,
|
|
4681
|
+
// Capture constraints kept in lock-step with `sensor/audio.ts` —
|
|
4682
|
+
// the two entry points (standalone capture vs session-based
|
|
4683
|
+
// capture) must agree or the verify flow and direct-API
|
|
4684
|
+
// consumers diverge.
|
|
4656
4685
|
echoCancellation: false,
|
|
4657
4686
|
noiseSuppression: false,
|
|
4658
|
-
autoGainControl: false
|
|
4687
|
+
autoGainControl: false,
|
|
4688
|
+
// @ts-expect-error -- W3C Media Capture Extensions property; not
|
|
4689
|
+
// yet in lib.dom.d.ts as of TypeScript 6.0.
|
|
4690
|
+
voiceIsolation: true
|
|
4659
4691
|
}
|
|
4660
4692
|
});
|
|
4661
4693
|
this.audioStageState = "capturing";
|