omnius 1.0.424 → 1.0.425
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.js +1384 -1360
- package/dist/scripts/live-whisper.py +30 -9
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -286,14 +286,35 @@ def _segment_filtered_text(result) -> str:
|
|
|
286
286
|
|
|
287
287
|
|
|
288
288
|
def amplify(samples):
|
|
289
|
-
"""Bring quiet-but-real speech toward
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
289
|
+
"""Bring quiet-but-real speech toward a healthy level for whisper.
|
|
290
|
+
|
|
291
|
+
Gain targets the SPEECH RMS (median of the loudest half of 0.2s blocks),
|
|
292
|
+
not the raw peak — a single click/pop no longer suppresses amplification
|
|
293
|
+
of otherwise-quiet speech. Gain is capped at 40x (~32dB) and bounded so
|
|
294
|
+
the peak never clips."""
|
|
295
|
+
if len(samples) == 0:
|
|
296
|
+
return samples
|
|
297
|
+
peak = float(np.max(np.abs(samples)))
|
|
298
|
+
if peak <= 0:
|
|
299
|
+
return samples
|
|
300
|
+
block = max(1, SAMPLE_RATE // 5)
|
|
301
|
+
energies = sorted(
|
|
302
|
+
float(np.sqrt(np.mean(samples[i:i + block] ** 2)))
|
|
303
|
+
for i in range(0, max(1, len(samples) - block + 1), block)
|
|
304
|
+
)
|
|
305
|
+
loud_half = energies[len(energies) // 2:] or energies
|
|
306
|
+
speech_rms = loud_half[len(loud_half) // 2] # median of the loud half
|
|
307
|
+
target_rms = 0.08 # ≈ -22dBFS — comfortable whisper input level
|
|
308
|
+
if speech_rms >= target_rms:
|
|
309
|
+
return samples
|
|
310
|
+
# No-clip bound uses the 99th-percentile amplitude, not the absolute
|
|
311
|
+
# peak — an isolated click/pop may clip (harmless to ASR) instead of
|
|
312
|
+
# suppressing amplification of the actual speech.
|
|
313
|
+
p99 = float(np.percentile(np.abs(samples), 99.0))
|
|
314
|
+
gain = min(40.0, target_rms / max(speech_rms, 1e-5), 0.98 / max(p99, 1e-4))
|
|
315
|
+
if gain <= 1.05:
|
|
316
|
+
return samples
|
|
317
|
+
return np.clip(samples * gain, -1.0, 1.0)
|
|
297
318
|
|
|
298
319
|
# ---------------------------------------------------------------------------
|
|
299
320
|
# Main transcription loop — utterance FSM
|
|
@@ -302,7 +323,7 @@ def amplify(samples):
|
|
|
302
323
|
def main():
|
|
303
324
|
import argparse
|
|
304
325
|
parser = argparse.ArgumentParser(description="Live Whisper transcription worker")
|
|
305
|
-
parser.add_argument("--model", default="
|
|
326
|
+
parser.add_argument("--model", default="medium", help="Whisper model size (tiny/base/small/medium/large)")
|
|
306
327
|
# Accepted for backward compatibility with older launchers (sliding-window era).
|
|
307
328
|
parser.add_argument("--chunk-seconds", type=float, default=3, help=argparse.SUPPRESS)
|
|
308
329
|
parser.add_argument("--window-seconds", type=float, default=10, help=argparse.SUPPRESS)
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.425",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.425",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED