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.
@@ -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 full scale. Whisper performs far
290
- better near normal levels; quiet capture chains (distant speakers, low
291
- source gain, beamformed arrays) otherwise force users to shout into the
292
- mic. Gain capped at 40x (~32dB), output clipped to [-1, 1]."""
293
- peak = float(np.max(np.abs(samples))) if len(samples) else 0.0
294
- if 0 < peak < 0.5:
295
- samples = np.clip(samples * min(40.0, 0.9 / max(peak, 1e-4)), -1.0, 1.0)
296
- return samples
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="base", help="Whisper model size (tiny/base/small/medium/large)")
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)
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.424",
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.424",
9
+ "version": "1.0.425",
10
10
  "bundleDependencies": [
11
11
  "image-to-ascii"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.424",
3
+ "version": "1.0.425",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",