Repository navigation
Description
Hex version
0.0.0-dev-249, official Linux x86_64 RPM, release commit a07f994e928219037651cc01c059d1dab174c550.
The installed executable passes rpm -V hex. Its SHA-256 matches the official dev manifest: 60642d492f39c71fafb9f7269e06973967365d87760dd272b7bdc1b7a4e7140b.
Platform
Linux Wayland
System details
- Fedora Linux 44 Workstation, kernel
7.2.13-200.fc44.x86_64 - GNOME Shell 50.6, Wayland
- PipeWire 1.6.10
- Vulkan, AMD Radeon 860M Graphics, RADV KRACKAN1
- Parakeet Unified English,
parakeet-unified-en-0.6b-Q8_0.gguf, English - Release microphone while idle enabled; no rewriting, transformations, or experiments in the test
What happened?
Dictating for roughly ten seconds sometimes returns only the first two or three seconds. The logs show that capture continues, but the streaming pause cap drops everything after its initial 2.5-second head as non-speech.
I reproduced this using generated speech and a temporary virtual microphone, without the physical microphone, real dictation history, or clipboard insertion. The same noisy fixture is transcribed through its final sentence when streaming is disabled. Clean speech and a quieter-noise control also work with streaming enabled.
Expected: intelligible speech should not be silently removed by pause trimming. At minimum, an uncertain detector should preserve the audio or fall back to the full clip rather than accept a nonempty but severely truncated result.
Controlled reproduction results
The WAV is 17.4645 seconds, including two seconds of leading baseline and half a second of trailing baseline. Captured clips are approximately 17.1 seconds because playback begins shortly before capture opens. Speech is generated with eSpeak NG and capped to at most -28 dBFS RMS per 20 ms frame. Deterministic uniform noise is added at either -35 or -50 dBFS RMS. This deliberately exercises speech whose level is within the detector's 12 dB background margin; the full-clip recognizer can still understand it.
| Input and mode | Captured ms | Dropped as pauses, ms | Audio reaching stream, ms | Final phrase preserved? |
|---|---|---|---|---|
| Clean, streaming forced on | 17074 | 0 | 17074 | Yes |
| -35 dBFS noise, streaming forced on | 17128 | 14628 | 2500 | No |
Same -35 dBFS noise, HEX_STREAMING=0 |
17127 | Not applicable | Full-clip inference | Yes |
| Same -35 dBFS noise, default streaming, repeat 1 | 17085 | 14585 | 2500 | No |
| Same -35 dBFS noise, default streaming, repeat 2 | 17128 | 14628 | 2500 | No |
| -50 dBFS noise, default streaming | 17128 | 0 | 17128 | Yes |
The two default-streaming failures have HEX_STREAMING unset, so this is not dependent on forcing an unsupported streaming device. All three noisy streaming attempts failed; the quieter-noise streaming control passed. These are actual captures through hex service, finished using hex dictation stop --print, not just a simulation of the detector or a batch transcription comparison.
Generated text:
This is a test of the complete recording. The first sentence comes at the beginning. Now we continue speaking for several more seconds. The final sentence should also be included. The last words are purple elephant.
Default streaming returned only:
This in a test on the
Full-clip mode returned:
This is a test on the complete recording. The first sentence comes at the beginning. Now we continue speaking for several more seconds. The final sentence should also be included. The last words are purple elephant.
Diagnostic excerpts
Only synthetic-test metrics are included; no private dictation or full logs.
# Default streaming, repeat 1
finished live stream audio_ms=17085 stream_ms=16871 feeds=99 feed_ms=76 partials=0 pauses_dropped_ms=14585 finish_ms=102
transcribed Linux dictation source="stream" finish_ms=102 audio_ms=17085
# Default streaming, repeat 2
finished live stream audio_ms=17128 stream_ms=16916 feeds=99 feed_ms=76 partials=0 pauses_dropped_ms=14628 finish_ms=104
transcribed Linux dictation source="stream" finish_ms=104 audio_ms=17128
# Same noisy fixture, streaming disabled
transcribed Linux dictation source="offline" finish_ms=449 audio_ms=17127
# Quieter-noise control, default streaming
finished live stream audio_ms=17128 stream_ms=16962 feeds=99 feed_ms=1930 partials=0 pauses_dropped_ms=0 finish_ms=150
transcribed Linux dictation source="stream" finish_ms=150 audio_ms=17128
Likely cause and limits of verification
The behavior matches PauseCap in transcription_engine.rs, added in #367 following #338. It uses SpeechFrames, which requires a frame to exceed an adaptive noise floor by 12 dB. Here the whole recording is classified as one pause, so the stream hears only its first 2.5 seconds. That produces a small nonempty transcript, which is accepted as source="stream" rather than triggering the full-clip fallback.
I understand #338 documents the 12 dB limitation. The concern is the resulting silent loss of nearly the entire dictation even when full-clip inference recognizes the same audio successfully. A more conservative detector, fail-open handling, or a supported user-facing way to disable pause removal could help.
The reproduction removes physical microphone and clipboard dependencies, and shows a signal-dependent failure in the shared pause-cap path. It was tested on one Linux/RADV machine only, not on another GPU, Windows, or macOS. The suspected introducing change has not been bisected.
Workaround
Starting Hex with HEX_STREAMING=0 avoids this failure, keeps the same local model and Vulkan backend, and transcribes the complete recording after release. This also resolved the original physical-microphone symptom.
Steps to reproduce
The standalone script below generates its own non-private fixtures and runs the A/B tests against the installed release binary. It needs hex, python3, espeak-ng, ffmpeg, pactl, paplay, PipeWire with PulseAudio compatibility, and the PipeWire ALSA plugin. The streaming model must already be installed at the standard data path, and streaming must work on the GPU.
Save it as reproduce.py in a disposable directory, then run:
python3 reproduce.py
python3 reproduce.py --confirmIt uses separate Hex settings, a temporary virtual source selected explicitly through an isolated .asoundrc, no desktop session bus, and stop --print instead of paste. It leaves an already-running Hex and its settings alone, does not change the default audio source, and unloads the temporary audio modules on exit. results.json, confirmation.json, generated WAVs, and per-case logs remain in the test directory. Allow roughly two minutes for both commands.
Standalone reproduction script
#!/usr/bin/env python3
"""A/B-test Hex against generated speech, without touching the real microphone.
Uses isolated Hex settings and a temporary PipeWire virtual input. The user's
running Hex and systemd override are left unchanged. No clipboard paste occurs.
"""
import array
import argparse
import json
import math
import os
from pathlib import Path
import random
import re
import signal
import subprocess
import time
import wave
ROOT = Path(__file__).resolve().parent
MODEL = Path.home() / '.local/share/hex/models/parakeet-unified-en-0.6b-Q8_0.gguf'
SINK = 'hex_pause_repro'
SOURCE = 'hex_pause_repro_mic'
TEXT = ('This is a test of the complete recording. The first sentence comes at '
'the beginning. Now we continue speaking for several more seconds. '
'The final sentence should also be included. The last words are purple elephant.')
def run(args, **kwargs):
result = subprocess.run(args, text=True, capture_output=True, **kwargs)
if result.returncode:
raise RuntimeError(f'{args}: exit {result.returncode}\n{result.stdout}\n{result.stderr}')
return result
def write_wav(path, samples):
pcm = array.array('h', (max(-32767, min(32767, round(x * 32767))) for x in samples))
with wave.open(str(path), 'wb') as w:
w.setparams((1, 2, 16000, 0, 'NONE', 'not compressed'))
w.writeframes(pcm.tobytes())
def fixtures():
run(['espeak-ng', '-s', '145', '-w', str(ROOT / 'speech-original.wav'), TEXT])
run(['ffmpeg', '-y', '-hide_banner', '-loglevel', 'error', '-i',
str(ROOT / 'speech-original.wav'), '-ar', '16000', '-ac', '1',
str(ROOT / 'speech.wav')])
with wave.open(str(ROOT / 'speech.wav'), 'rb') as w:
raw = array.array('h', w.readframes(w.getnframes()))
speech = [x / 32768 for x in raw]
# Limit each 20 ms speech frame to -28 dBFS RMS. This keeps speech audible,
# but within the detector's hard-coded 12 dB margin over the background.
levelled = []
for i in range(0, len(speech), 320):
frame = speech[i:i + 320]
rms = math.sqrt(sum(x*x for x in frame) / len(frame))
gain = min(1.0, 10**(-28/20) / max(rms, 1e-12))
levelled.extend(x * gain for x in frame)
clean = [0.0] * 32000 + levelled + [0.0] * 8000
write_wav(ROOT / 'clean.wav', clean)
rng = random.Random(17)
# Uniform room noise at -35 dBFS RMS, independent of the speech.
amplitude = math.sqrt(3) * 10**(-35/20)
noisy = [x + rng.uniform(-amplitude, amplitude) for x in clean]
write_wav(ROOT / 'noisy.wav', noisy)
rng = random.Random(17)
amplitude = math.sqrt(3) * 10**(-50/20)
write_wav(ROOT / 'quiet-noise.wav', [x + rng.uniform(-amplitude, amplitude) for x in clean])
return len(clean) / 16000
def test_case(name, streaming, wav):
work = ROOT / name
support = work / 'support'
home = work / 'home'
home.mkdir(parents=True, exist_ok=True)
(support / 'models').mkdir(parents=True, exist_ok=True)
model_link = support / 'models' / MODEL.name
if not model_link.exists():
model_link.symlink_to(MODEL)
(home / '.asoundrc').write_text(
'pcm.!default { type pipewire capture_node "' + SOURCE + '" }\n')
settings = {
'sound_effects': False, 'sound_effect_volume': 0,
'release_microphone_while_idle': True,
'enable_on_launch': True, 'history_retention': 'off',
'transcription': {'model': 'parakeet_unified_en', 'language': 'en',
'recognition_hints': ''},
'capture': {'enabled': False},
'migrations': ['streaming-english-model', 'annotate-on-by-default',
'scrawl-capture-settings', 'scrawl-routing-settings'],
}
(support / 'settings.json').write_text(json.dumps(settings))
env = dict(os.environ, HOME=str(home), HEX_APPLICATION_SUPPORT_DIR=str(support),
XDG_CONFIG_HOME=str(home / '.config'), XDG_DATA_HOME=str(home / '.local/share'),
NO_COLOR='1', RUST_LOG='hex=info',
DBUS_SESSION_BUS_ADDRESS='unix:path=' + str(work / 'no-session-bus'))
if streaming is None:
env.pop('HEX_STREAMING', None)
else:
env['HEX_STREAMING'] = str(streaming)
env.pop('NOTIFY_SOCKET', None)
env.pop('HEX_RETAIN_DICTATION_AUDIO', None)
log_path = work / 'service.log'
player = None
with log_path.open('w') as log:
service = subprocess.Popen(['hex', 'service'], env=env, stdout=log, stderr=log,
start_new_session=True)
try:
for _ in range(300):
if service.poll() is not None:
raise RuntimeError('Test service exited: ' + log_path.read_text()[-6000:])
status = subprocess.run(['hex', 'status'], env=env, capture_output=True, text=True)
if status.returncode == 0:
s = json.loads(status.stdout)
if (s['desktop']['listener']['running']
and 'Hex dictation is ready' in log_path.read_text()):
break
time.sleep(0.1)
else:
raise RuntimeError('Test listener did not become ready: ' + log_path.read_text()[-6000:])
# Playback starts with two seconds of quiet or room noise. Open
# capture while that baseline is already present, then hear speech.
player = subprocess.Popen(['paplay', '--device=' + SINK, str(wav)])
time.sleep(0.6)
run(['hex', 'dictation', 'start'], env=env)
player.wait(timeout=45)
out = run(['hex', 'dictation', 'stop', '--print'], env=env, timeout=65)
(work / 'transcript.txt').write_text(out.stdout)
text = log_path.read_text()
text = re.sub(r'\x1b\[[0-9;]*m', '', text)
metrics = [line for line in text.splitlines()
if any(x in line for x in ['finished live stream',
'transcribed Linux dictation', 'live stream unusable'])]
result = {'case': name, 'streaming': streaming, 'transcript': out.stdout.strip(),
'has_ending': 'purple elephant' in out.stdout.lower(), 'metrics': metrics}
print(json.dumps(result), flush=True)
return result
finally:
if player and player.poll() is None:
player.terminate()
player.wait(timeout=5)
if service.poll() is None:
service.send_signal(signal.SIGTERM)
try:
service.wait(timeout=15)
except subprocess.TimeoutExpired:
service.kill()
service.wait()
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--confirm', action='store_true',
help='Repeat the noisy failure with default streaming, plus a quiet-noise control')
args = parser.parse_args()
duration = fixtures()
modules = []
try:
modules.append(run(['pactl', 'load-module', 'module-null-sink',
'sink_name=' + SINK, 'rate=16000', 'channels=1']).stdout.strip())
modules.append(run(['pactl', 'load-module', 'module-remap-source',
'master=' + SINK + '.monitor', 'source_name=' + SOURCE]).stdout.strip())
time.sleep(0.5)
results = []
cases = [
('clean-stream', 1, 'clean.wav'),
('noisy-stream', 1, 'noisy.wav'),
('noisy-offline', 0, 'noisy.wav'),
]
if args.confirm:
cases = [
('noisy-default-1', None, 'noisy.wav'),
('noisy-default-2', None, 'noisy.wav'),
('quiet-noise-default', None, 'quiet-noise.wav'),
]
for name, streaming, filename in cases:
results.append(test_case(name, streaming, ROOT / filename))
output = 'confirmation.json' if args.confirm else 'results.json'
(ROOT / output).write_text(json.dumps({'fixture_seconds': duration,
'results': results}, indent=2))
finally:
for module in reversed(modules):
subprocess.run(['pactl', 'unload-module', module], check=False)
if __name__ == '__main__':
main()
Activity
Fix #458: streaming dictation pause trimming (#459)
thdxr commentedon Oct 30, 2026
Thanks for the report. A fix is merged into
devand ships in the next dev build: #459What we understood
— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊