longpipe 0.0.10 → 0.0.12
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/README.md +45 -9
- package/dist/index.cjs +1205 -253
- package/dist/index.d.cts +53 -4
- package/dist/index.d.ts +53 -4
- package/dist/index.js +1205 -253
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -108,6 +108,45 @@ new EffectsPipeline(stream, {
|
|
|
108
108
|
})
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
+
## Audio denoise
|
|
112
|
+
|
|
113
|
+
Real-time speech denoising runs as a **separate AudioWorklet pipeline** on the audio render thread — independent of the video/GPU pipeline, in parallel. Pass `audio: 'denoise'` and the input stream's mic is cleaned in place; `pipeline.stream` carries the denoised audio track.
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
const stream = await navigator.mediaDevices.getUserMedia({ video: true, audio: true })
|
|
117
|
+
new EffectsPipeline(stream, { audio: 'denoise' }) // auto-picks a model for the device
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Three models back three tiers. `auto` (the default) runs a tiny **weight-free probe** at init — it times the real network on this device *without* downloading the multi-MB weights — and picks the best fit:
|
|
121
|
+
|
|
122
|
+
| `model` | tier | what it is |
|
|
123
|
+
|-----------|------|------------|
|
|
124
|
+
| `dfn` | high | DeepFilterNet3, full f32 — best quality |
|
|
125
|
+
| `dfnint8` | mid | DeepFilterNet3 with int8 GRUs — smaller download, faster on weak hardware |
|
|
126
|
+
| `rnnoise` | low | classic RNNoise — tiny, and the fallback where wasm SIMD is unavailable |
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
// force a specific model or tier instead of probing
|
|
130
|
+
new EffectsPipeline(stream, { audio: { denoise: { model: 'dfn' } } })
|
|
131
|
+
|
|
132
|
+
interface DenoiseOptions {
|
|
133
|
+
model?: 'auto' | 'high' | 'mid' | 'low' | 'rnnoise' | 'dfn' | 'dfnint8' // default 'auto'
|
|
134
|
+
postFilterBeta?: number // DFN post-filter, suppresses residual noise (default 0.03)
|
|
135
|
+
gruLeak?: number // DFN recurrent-drift bound (default 0.995)
|
|
136
|
+
enabled?: boolean // start denoising vs. passthrough (default true)
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Toggle, reconfigure, and inspect at runtime:
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
pipeline.setDenoise(false) // passthrough (cheap to re-enable)
|
|
144
|
+
pipeline.setDenoise({ postFilterBeta: 0.05 }) // tweak DFN params live
|
|
145
|
+
pipeline.getAudioStats() // { model, p50Ms, p95Ms, latencyMs, sampleRate, active }
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
The denoiser handles sample-rate conversion internally (it runs at 48 kHz and resamples when the device can't). `pipeline.ready` resolves on the video first frame and does **not** wait on audio — denoising joins asynchronously, with the mic passing through until it's live.
|
|
149
|
+
|
|
111
150
|
## Other options
|
|
112
151
|
|
|
113
152
|
```ts
|
|
@@ -115,7 +154,7 @@ new EffectsPipeline(stream, {
|
|
|
115
154
|
background: 'blur',
|
|
116
155
|
preset: 'auto',
|
|
117
156
|
adaptive: true, // default; only applies when preset is 'auto'
|
|
118
|
-
audio: '
|
|
157
|
+
audio: 'denoise', // 'passthrough' | 'drop' | 'denoise' | { denoise: {...} }
|
|
119
158
|
outputResolution: { w: 1280, h: 720 }, // default: matches the input video track
|
|
120
159
|
weightsBaseUrl: 'https://your-cdn/longpipe/', // default: cdn.longpipe.dev
|
|
121
160
|
enabled: true, // false = pass input through unchanged
|
|
@@ -138,7 +177,7 @@ pipeline.destroy()
|
|
|
138
177
|
|
|
139
178
|
## Self-hosting weights
|
|
140
179
|
|
|
141
|
-
By default Longpipe fetches model weights from `https://cdn.longpipe.dev/models/v/0.0.
|
|
180
|
+
By default Longpipe fetches model weights from `https://cdn.longpipe.dev/models/v/0.0.4/`. You can browse the available files, sizes, and SHA-256 hashes at [cdn.longpipe.dev/models/v/0.0.4/index.html](https://cdn.longpipe.dev/models/v/0.0.4/index.html) (machine-readable list at [manifest.json](https://cdn.longpipe.dev/models/v/0.0.4/manifest.json)).
|
|
142
181
|
|
|
143
182
|
To serve them yourself, mirror the files under any base URL with the same `model_${name}.bin` naming convention and pass it via `weightsBaseUrl`:
|
|
144
183
|
|
|
@@ -181,13 +220,10 @@ Training scripts, fixture generation, and the weight export pipeline are not yet
|
|
|
181
220
|
## Roadmap
|
|
182
221
|
|
|
183
222
|
- [x] Background segmentation / virtual backgrounds
|
|
184
|
-
- [x]
|
|
185
|
-
- [
|
|
186
|
-
- [x] Autotuned + adaptive preset selection
|
|
187
|
-
- [ ] Face landmark detection
|
|
223
|
+
- [x] Background noise removal (audio, separate pipeline)
|
|
224
|
+
- [ ] Face Landmarks / Touchup / AR Effects
|
|
188
225
|
- [ ] Lighting correction
|
|
189
|
-
|
|
190
|
-
- [ ] Mobile SDKs
|
|
226
|
+
|
|
191
227
|
|
|
192
228
|
## License
|
|
193
229
|
|
|
@@ -209,4 +245,4 @@ Longpipe's pre-trained weights are released under MIT (see [WEIGHTS_LICENSE](WEI
|
|
|
209
245
|
|
|
210
246
|
The encoder is initialized from a pre-trained [EfficientNet-Lite](https://github.com/RangiLyu/EfficientNet-Lite) backbone — Apache 2.0.
|
|
211
247
|
|
|
212
|
-
As is standard for trained models, the released weights are not a redistribution of any training image or video — they are published under MIT.
|
|
248
|
+
As is standard for trained models, the released weights are not a redistribution of any training image or video — they are published under MIT.
|