diff --git a/docs/experiments/kikiri-anna-breath-2026-10-27/README.md b/docs/experiments/kikiri-anna-breath-2026-10-27/README.md new file mode 100644 index 0000000..593f4b7 --- /dev/null +++ b/docs/experiments/kikiri-anna-breath-2026-10-27/README.md @@ -0,0 +1,138 @@ +# Anna +20: granular breathing investigation · 27 October 2026 + +Michael confirms the Vögel correction. He hears virtually no difference between +the whole-paragraph A and sentence-split B, perhaps a very small preference for +B. The remaining slight robotic character is especially audible on breaths, +as if many tiny samples were joined. This is his description of texture, not +a measured number of sample blocks. **Strata/Qwen must remain loaded.** + +## Scope and diagnosis + +Use the unchanged selected +20 model/voicepack and the corrected synthetic +expressive passage. All work is on the CPU in an own private directory; no +GPU allocation, training, endpoint change, model reload, installer or client +patch. The original A is synthesized as one complete chunk, so actual +multi-chunk transmission joins cannot explain that specific file's texture. + +`diagnose.py` reuses the exact strict model-loader/front-end/render code from +the [preceding pronunciation experiment](../kikiri-anna-pronunciation-2026-10-27/README.md). +It changes only the own output root, checks the dependency source hash, and +attaches an observational decoder hook. The instrumented baseline must match +corrected A byte for byte. It records synthetic F0 and predicted log-energy +curves, never private reference audio. Low-F0 regions are **not annotated +breaths**: they also contain pauses and unvoiced consonants. + +Observed on corrected A: + +- No clipping; no exact-zero run of at least 1 ms before 15.496875 s of the + 15.525-s WAV. The longest zero run is 215 samples / 8.96 ms at the file end. + This check does not exclude every possible discontinuity or perceptual + artifact; it finds no repeated exact-zero holes through the speech. +- B has the five intentional 120-ms sentence gaps plus a few short quiet + tails. Those gaps do not explain the texture shared with the single-chunk A. +- Decoder is FP32. Its source voiced/unvoiced cutoff is 10 Hz, with 22 + transitions across 1,242 frames / 15.525 s; these are not thousands of rapid + voicing-mask changes. Raising the cutoff is not justified as a diagnosed fix. +- The source explicitly mixes generated harmonic excitation and Gaussian + noise for unvoiced regions. This is architecture evidence, **not proof** + that the particular random-noise code causes the audible grain. + +The first diagnostic run reached report serialization but failed on a NumPy +int64. The formatter was corrected to a Python int, and the independent second +run completed. Neither attempt modified production or weights. Keep the +successful report and do not count the failed report as a successful check. + +## One bounded smoothing ablation + +`smooth.py` retains the same phonemes, timing/durations, F0 curve, style vector, +source settings and weights. It applies only an **in-memory experimental hook** +to the decoder's predicted log-energy conditioning, N. N is not itself the +sample-level random-noise signal. + +In the interiors of unvoiced runs, blend N halfway toward a five-frame moving +average (62.5 ms at 80 frames/s), with a three-frame tapered mask. Voiced-frame +N values remain exactly unchanged. This is a heuristic diagnostic variant, +not a publisher-provided quality setting or an established breath detector. +It can also affect unvoiced consonants; check words and listen for dullness or +loss of Anna character. No spectral denoising, pitch correction, audio gate, +global equalizer, sample-rate change or new breath samples are used. + +The fresh baseline must again match corrected A. The candidate must have +exactly the same phoneme list and audio duration. Record changed-frame count, +input deltas, clipping, complete CPU generation time and local Parakeet words. +Only Michael's listening can decide whether this improves the breath texture; +ASR and trace statistics cannot accept that claim. + +## Native operation and reproducibility + +Own root `/data/athena-kikiri-anna-breath-20261027`, mode 0700. Read-only +dependencies: previous experiment source and pronunciation rule, selected +20 +model/voicepack, pinned public source/model assets and the existing standalone +CPU Python 3.11.18 / Torch 2.6.0 environment. Exact pins/setup/private-data +lineage: [selected checkpoint experiment](../kikiri-anna-full20-continuation-2026-10-27/README.md). +No dependencies are provided by a running container. The explicitly scoped +`athena-deck-dev` inspect reads only its start time for preservation verification. + +For `diagnose.py` / `smooth.py`, transient systemd units use quota 400%, allowed +CPUs 2–5/8–11, nice 10, RAM cap 3 GiB/no swap, private devices/network, read-only +system, own root writable, 120-second limit, existing CPU venv Python. CPU-only +Torch and hidden CUDA devices are asserted. `score.py` uses standalone Python +and the existing local Parakeet CLI/model, quota 200%, same protection/own root, +180-second cap. No permanent service or production request is created. + +Check relevant before/after state hashes, CPU TTS and Strata PIDs, Deck start +time and selected model/voicepack hashes. Keep all original selected assets. +A fresh host must reproduce the parent runtime and restore private assets; +these are experiments, not an installer or a certified full restore. No new +backup is made. Version only scripts, synthetic measurements and conclusions; +no private Anna input/transcripts, model files, keys, production snapshots or +listening WAVs enter Git. + +## Sources checked + +- Installed pinned Kokoro `istftnet.py`, `model.py` and actual traced tensors. +- [Source harmonic/noise implementation](https://github.com/hexgrad/kokoro/blob/main/kokoro/istftnet.py). +- [Open integer-phase proposal #353](https://github.com/hexgrad/kokoro/pull/353): + reports precision/drift effects and an optional source replacement. It is + not installed or presented as a fix here. This short FP32 breath symptom is + not established as the same problem as the proposal's reported FP16/long-form + failures. No unreviewed upstream patch is substituted into the runtime. +- [Kikiri troubleshooting](https://github.com/semidark/kikiri-tts/blob/main/docs/TROUBLESHOOTING.md). + +The observed original Anna identity remains the user's assessment; this test +does not override his acceptance of +20 or promote a new production profile. + +## Completed ablation and limits + +The fresh baseline exactly reproduces corrected A. The candidate modifies +271 of 1,242 log-energy conditioning frames: mean absolute input delta 0.01379, +maximum 0.75967. Voiced-frame N values and F0 are unchanged. This controls the +inputs, not a guarantee that all voiced waveform samples are identical after +the decoder's temporal receptive field. All phonemes and output duration +remain identical. The change is applied only in the transient process and +does not alter any saved learned tensor or package source. + +| Render | Audio | CPU generation | RTF | Normalized ASR word edits | +| --- | --- | --- | --- | --- | +| Corrected A, exact repeat | 15.525 s | 5.176 s | 0.3334 | 0 / 40 | +| Unvoiced log-energy smoothing | 15.525 s | 4.390 s | 0.2827 | 0 / 40 | + +Timings exclude model load and follow explicit warmup, four CPU threads; +the single candidate timing is not evidence the hook speeds synthesis up. +Both synthetic WAVs are finite mono 24-kHz PCM16, without clipped samples or +dropped phonemes. Local copies match hashes and durations. STT still recognizes +Vögel and all the other words. **Breath quality/naturalness verdict is pending**; +do not call the smoothing a successful artifact fix from those checks. + +Diagnostics and smoothing runs independently confirm unchanged production +configuration/reference hashes, CPU TTS PIDs, the same running Strata PID, +Deck start time and original selected model/voicepack hashes. All successful +transient units exited. No Qwen request, unload, reload, training or service +restart occurred. The first failed diagnostic report is documented above. + +Listening files are retained outside Git at +`/Users/mike_i386/Documents/ChatGPT/Athena Deck/work/kikiri-anna-breath-20261027/audio/anna-plus20-breath-baseline.wav` +and `anna-plus20-breath-soft.wav`. Previous A/B files remain unchanged. Only the +source scripts, synthetic result JSON and documentation are versioned; raw +private data, generated WAVs and synthetic intermediate tensor arrays are not. +No active TTS change is authorized or made by this experiment. diff --git a/docs/experiments/kikiri-anna-breath-2026-10-27/diagnose.py b/docs/experiments/kikiri-anna-breath-2026-10-27/diagnose.py new file mode 100644 index 0000000..2393d0c --- /dev/null +++ b/docs/experiments/kikiri-anna-breath-2026-10-27/diagnose.py @@ -0,0 +1,82 @@ +"""Instrument the selected CPU render; read-only model/production dependencies.""" +from pathlib import Path +import hashlib, json, sys, types + +ROOT=Path('/data/athena-kikiri-anna-breath-20261027') +PREVIOUS=Path('/data/athena-kikiri-anna-pronunciation-20261027') +sys.path.insert(0,str(PREVIOUS)) +source_path=PREVIOUS/'experiment.py' +source=source_path.read_text() +marker="(ROOT/'outputs').mkdir(exist_ok=True,mode=0o700)" +assert source.count(marker)==1 +prefix=source.split(marker)[0] +old="ROOT = Path('/data/athena-kikiri-anna-pronunciation-20261027')" +assert prefix.count(old)==1 +prefix=prefix.replace(old,"ROOT = Path('/data/athena-kikiri-anna-breath-20261027')") +module=types.ModuleType('anna_breath_cpu');module.__file__=str(source_path) +exec(compile(prefix,str(source_path), 'exec'),module.__dict__) +np=module.np;sf=module.sf +model=module.model +(ROOT/'outputs').mkdir(exist_ok=True,mode=0o700) +captures=[] + +def capture(component,args): + captures.append(dict(f0=args[1].detach().cpu().numpy().reshape(-1).copy(), + norm=args[2].detach().cpu().numpy().reshape(-1).copy())) + +handle=model.decoder.register_forward_pre_hook(capture) +module.render('Die Stimme ist bereit.','warmup',fixed=True,save=False) +captures.clear() +selected=json.loads((module.PARENT/'cpu-plus20.json').read_text()) +text=next(r['text'] for r in selected['runs'] if r['case']=='expressive') +row=module.render(text,'breath-diagnostic',fixed=True) +expected=json.loads((PREVIOUS/'results.json').read_text()) +original=next(r for r in expected['runs'] if r['arm']=='voegel-fixed') +assert row['sha256']==original['sha256'],'Instrumentation must preserve selected corrected A exactly' +assert len(captures)==1 +f0=captures[0]['f0'];norm=captures[0]['norm'] +assert np.isfinite(f0).all() and np.isfinite(norm).all() +trace=dict(f0_hz=f0.tolist(),predicted_norm=norm.tolist(), + estimated_frame_seconds=row['duration_seconds']/len(f0)) +module.write('synthetic-trace.json',trace) + +def zero_runs(x): + mask=(x==0) + edge=np.diff(np.r_[False,mask,False].astype(np.int8)) + spans=list(zip(np.flatnonzero(edge==1),np.flatnonzero(edge==-1))) + return dict(longest_zero_run_samples=int(max((b-a for a,b in spans),default=0)), + exact_zero_runs_at_least_1ms=[dict(start_seconds=a/24000,duration_ms=(b-a)/24) + for a,b in spans if b-a>=24], + exact_zero_fraction=float(mask.mean())) + +waves=[] +for name in ('voegel-fixed','sentences-fixed'): + path=PREVIOUS/'outputs'/f'anna-plus20-{name}.wav' + audio,sr=sf.read(path,dtype='float32');assert sr==24000 + waves.append(dict(arm=name,sample_rate=sr,samples=len(audio), + clipping_fraction=float(np.mean(np.abs(audio)>=1)),**zero_runs(audio))) + +generator=model.decoder.generator.m_source.l_sin_gen +thresholds=[] +for cutoff in (10,30,60,80): + mask=f0>cutoff + thresholds.append(dict(cutoff_hz=cutoff,below_frames=int((~mask).sum()), + fraction_below=float((~mask).mean()),transitions=int(np.count_nonzero(np.diff(mask.astype(np.int8)))))) +after=module.snapshot() +result=dict(complete=True,reused_source_sha256=hashlib.sha256(source.encode()).hexdigest(), + baseline_matches_corrected_A=True,baseline_render=row, + waveform_checks=waves,decoder_dtype=str(next(model.decoder.parameters()).dtype), + f0_frames=len(f0),f0_quantiles_hz={str(q):float(np.quantile(f0,q)) for q in (0,.01,.05,.25,.5,.75,.95,.99,1)}, + source_noise_std=generator.noise_std,source_sine_amp=generator.sine_amp, + source_voiced_threshold=generator.voiced_threshold,threshold_diagnostics=thresholds, + low_f0_regions_are_not_breath_labels=True, + predicted_norm_quantiles={str(q):float(np.quantile(norm,q)) for q in (0,.05,.5,.95,1)}, + preservation=dict(files_equal=module.before['hashes']==after['hashes'], + cpu_tts_pids_equal=module.before['pids']['articulino']==after['pids']['articulino'] and module.before['pids']['qwen_tts']==after['pids']['qwen_tts'], + strata_pids_equal=module.before['pids']['strata']==after['pids']['strata'], + deck_start_equal=module.before['deck_started']==after['deck_started'], + selected_exports_unchanged=module.initial_hashes==[module.sha(module.model_path),module.sha(module.voice_path)])) +module.write('diagnostics.json',result) +handle.remove() +assert all(result['preservation'].values()) +print(json.dumps({k:v for k,v in result.items() if k not in ('baseline_render',)},ensure_ascii=False),flush=True) diff --git a/docs/experiments/kikiri-anna-breath-2026-10-27/diagnostics.json b/docs/experiments/kikiri-anna-breath-2026-10-27/diagnostics.json new file mode 100644 index 0000000..9d83965 --- /dev/null +++ b/docs/experiments/kikiri-anna-breath-2026-10-27/diagnostics.json @@ -0,0 +1,145 @@ +{ + "complete": true, + "reused_source_sha256": "affe9c873debdac5786a22d621b3b4b712429f5c79b89bfb61684d151b1246af", + "baseline_matches_corrected_A": true, + "baseline_render": { + "arm": "breath-diagnostic", + "text": "Guten Morgen, Michael. Schön, dass du wieder da bist! Draußen rauscht der Regen, und die Vögel suchen Schutz unter dem Dach. Wirklich? Das hätte ich nicht gedacht. Heute nehmen wir uns ein wenig Zeit und machen alles ganz in Ruhe.", + "phonemes": [ + "ɡˈuːtən mˈɔɾɡən, mˈɪçaˌeːl. ʃˈøːn, das duː vˈiːdɜ dɑː bɪst! dɾˈWsən rˈWʃt dɛɾ rˈeːɡən, ʊnt diː fˈøːɡəl zˈuːxən ʃˈʊʦ ˌʊntɜ deːm dˈax. vˈɪɾklɪç? das hˌɛtə ɪç nˈɪçt ɡədˈaxt. hˈɔøtə nˈeːmən viːɾ ʊns In vˈeːnɪç ʦˈIt ʊnt mˈaxən ˈaləs ɡˌanʦ ɪn rˈuːə." + ], + "segments": 1, + "gap_seconds": 0.0, + "duration_seconds": 15.525, + "generation_seconds": 4.992677860005642, + "rtf": 0.32158955620004137, + "realtime_multiple": 3.1095537175279433, + "clipped_fraction": 0.0, + "dropped": [], + "file": "anna-plus20-breath-diagnostic.wav", + "sha256": "7b0c2c21cd7346d196df7b43f3b9acd0733c487bd7e0ba9d20f91216ea29708e" + }, + "waveform_checks": [ + { + "arm": "voegel-fixed", + "sample_rate": 24000, + "samples": 372600, + "clipping_fraction": 0.0, + "longest_zero_run_samples": 215, + "exact_zero_runs_at_least_1ms": [ + { + "start_seconds": 15.496875, + "duration_ms": 8.958333333333334 + }, + { + "start_seconds": 15.516416666666666, + "duration_ms": 3.1666666666666665 + }, + { + "start_seconds": 15.522291666666666, + "duration_ms": 2.1666666666666665 + } + ], + "exact_zero_fraction": 0.011969940955448202 + }, + { + "arm": "sentences-fixed", + "sample_rate": 24000, + "samples": 451200, + "clipping_fraction": 0.0, + "longest_zero_run_samples": 2884, + "exact_zero_runs_at_least_1ms": [ + { + "start_seconds": 2.299916666666667, + "duration_ms": 120.08333333333333 + }, + { + "start_seconds": 4.699958333333333, + "duration_ms": 1.0833333333333333 + }, + { + "start_seconds": 4.778208333333334, + "duration_ms": 1.3333333333333333 + }, + { + "start_seconds": 4.795, + "duration_ms": 120.16666666666667 + }, + { + "start_seconds": 9.814916666666667, + "duration_ms": 120.08333333333333 + }, + { + "start_seconds": 11.235, + "duration_ms": 120.04166666666667 + }, + { + "start_seconds": 13.58, + "duration_ms": 120.16666666666667 + }, + { + "start_seconds": 13.71425, + "duration_ms": 1.0416666666666667 + } + ], + "exact_zero_fraction": 0.050159574468085104 + } + ], + "decoder_dtype": "torch.float32", + "f0_frames": 1242, + "f0_quantiles_hz": { + "0": -3.881885051727295, + "0.01": 1.4577607583999634, + "0.05": 1.5953880548477173, + "0.25": 41.83435344696045, + "0.5": 209.1568374633789, + "0.75": 240.12539291381836, + "0.95": 297.5853576660156, + "0.99": 311.5728912353515, + "1": 325.967041015625 + }, + "source_noise_std": 0.003, + "source_sine_amp": 0.1, + "source_voiced_threshold": 10, + "threshold_diagnostics": [ + { + "cutoff_hz": 10, + "below_frames": 299, + "fraction_below": 0.24074074074074073, + "transitions": 22 + }, + { + "cutoff_hz": 30, + "below_frames": 306, + "fraction_below": 0.2463768115942029, + "transitions": 22 + }, + { + "cutoff_hz": 60, + "below_frames": 319, + "fraction_below": 0.25684380032206117, + "transitions": 26 + }, + { + "cutoff_hz": 80, + "below_frames": 323, + "fraction_below": 0.26006441223832527, + "transitions": 22 + } + ], + "low_f0_regions_are_not_breath_labels": true, + "predicted_norm_quantiles": { + "0": -7.835567474365234, + "0.05": -3.225163924694061, + "0.5": 5.510884761810303, + "0.95": 8.505026578903198, + "1": 9.261594772338867 + }, + "preservation": { + "files_equal": true, + "cpu_tts_pids_equal": true, + "strata_pids_equal": true, + "deck_start_equal": true, + "selected_exports_unchanged": true + } +} \ No newline at end of file diff --git a/docs/experiments/kikiri-anna-breath-2026-10-27/score.py b/docs/experiments/kikiri-anna-breath-2026-10-27/score.py new file mode 100644 index 0000000..53a1fe0 --- /dev/null +++ b/docs/experiments/kikiri-anna-breath-2026-10-27/score.py @@ -0,0 +1,25 @@ +"""ASR word completeness only for the synthetic ablation pair.""" +from pathlib import Path +import json,re,subprocess,time +ROOT=Path('/data/athena-kikiri-anna-breath-20261027') +BASE=Path('/opt/athena-deck-dev/runtime/state/parakeet-runtime/v0.6.1') +CLI=BASE/'runtime/parakeet-v0.6.1-bin-linux-cpu-x64/parakeet-cli' +rows=[] +data=json.loads((ROOT/'smooth-results.json').read_text());assert data['complete'] +for r in data['runs']: + start=time.monotonic() + p=subprocess.run([str(CLI),'transcribe','--model',str(BASE/'redux-packed.gguf'), + '--input',str(ROOT/'outputs'/r['file']),'--lang','de','--threads','2','--json'], + capture_output=True,text=True,timeout=90) + assert p.returncode==0,p.stderr[-300:] + recognized=json.loads(p.stdout)['text'] + a=re.findall(r'\w+',r['text'].casefold());b=re.findall(r'\w+',recognized.casefold()) + previous=list(range(len(b)+1)) + for i,x in enumerate(a,1): + row=[i] + for j,y in enumerate(b,1):row.append(min(row[-1]+1,previous[j]+1,previous[j-1]+(x!=y))) + previous=row + rows.append(dict(arm=r['arm'],file=r['file'],expected=r['text'],recognized=recognized, + word_edits=previous[-1],reference_words=len(a),seconds=time.monotonic()-start)) +(ROOT/'transcriptions.json').write_text(json.dumps(rows,indent=2,ensure_ascii=False)) +print(json.dumps(rows,ensure_ascii=False),flush=True) diff --git a/docs/experiments/kikiri-anna-breath-2026-10-27/smooth-results.json b/docs/experiments/kikiri-anna-breath-2026-10-27/smooth-results.json new file mode 100644 index 0000000..c593441 --- /dev/null +++ b/docs/experiments/kikiri-anna-breath-2026-10-27/smooth-results.json @@ -0,0 +1,70 @@ +{ + "complete": true, + "reused_source_sha256": "affe9c873debdac5786a22d621b3b4b712429f5c79b89bfb61684d151b1246af", + "baseline_matches_corrected_A": true, + "device": "cpu", + "threads": 4, + "model_sha256": "eac26cd33205c3ea3054102943ea956dd9f56e1751a5203bb7788fbbfd3d7d53", + "voice_sha256": "5c5f913c31155bc55c89076b1c46d58f4a843b45494e3b8dacfa9851484a8ee7", + "runs": [ + { + "arm": "breath-baseline", + "text": "Guten Morgen, Michael. Schön, dass du wieder da bist! Draußen rauscht der Regen, und die Vögel suchen Schutz unter dem Dach. Wirklich? Das hätte ich nicht gedacht. Heute nehmen wir uns ein wenig Zeit und machen alles ganz in Ruhe.", + "phonemes": [ + "ɡˈuːtən mˈɔɾɡən, mˈɪçaˌeːl. ʃˈøːn, das duː vˈiːdɜ dɑː bɪst! dɾˈWsən rˈWʃt dɛɾ rˈeːɡən, ʊnt diː fˈøːɡəl zˈuːxən ʃˈʊʦ ˌʊntɜ deːm dˈax. vˈɪɾklɪç? das hˌɛtə ɪç nˈɪçt ɡədˈaxt. hˈɔøtə nˈeːmən viːɾ ʊns In vˈeːnɪç ʦˈIt ʊnt mˈaxən ˈaləs ɡˌanʦ ɪn rˈuːə." + ], + "segments": 1, + "gap_seconds": 0.0, + "duration_seconds": 15.525, + "generation_seconds": 5.175580409995746, + "rtf": 0.33337071884030567, + "realtime_multiple": 2.9996635681702726, + "clipped_fraction": 0.0, + "dropped": [], + "file": "anna-plus20-breath-baseline.wav", + "sha256": "7b0c2c21cd7346d196df7b43f3b9acd0733c487bd7e0ba9d20f91216ea29708e" + }, + { + "arm": "breath-soft", + "text": "Guten Morgen, Michael. Schön, dass du wieder da bist! Draußen rauscht der Regen, und die Vögel suchen Schutz unter dem Dach. Wirklich? Das hätte ich nicht gedacht. Heute nehmen wir uns ein wenig Zeit und machen alles ganz in Ruhe.", + "phonemes": [ + "ɡˈuːtən mˈɔɾɡən, mˈɪçaˌeːl. ʃˈøːn, das duː vˈiːdɜ dɑː bɪst! dɾˈWsən rˈWʃt dɛɾ rˈeːɡən, ʊnt diː fˈøːɡəl zˈuːxən ʃˈʊʦ ˌʊntɜ deːm dˈax. vˈɪɾklɪç? das hˌɛtə ɪç nˈɪçt ɡədˈaxt. hˈɔøtə nˈeːmən viːɾ ʊns In vˈeːnɪç ʦˈIt ʊnt mˈaxən ˈaləs ɡˌanʦ ɪn rˈuːə." + ], + "segments": 1, + "gap_seconds": 0.0, + "duration_seconds": 15.525, + "generation_seconds": 4.389589742990211, + "rtf": 0.2827433006756979, + "realtime_multiple": 3.5367769903308304, + "clipped_fraction": 0.0, + "dropped": [], + "file": "anna-plus20-breath-soft.wav", + "sha256": "e3fcb4e500057628bb8e6d5953ab3172d2306136a369350f60809d37d3906d65" + } + ], + "experimental_parameters": { + "energy_average_frames": 5, + "energy_average_ms": 62.5, + "maximum_blend": 0.5, + "mask_taper_frames": 3, + "only_unvoiced": true, + "unvoiced_is_not_an_annotated_breath_mask": true + }, + "changes": [ + { + "frames": 1242, + "changed_frames": 271, + "mean_absolute_delta": 0.013790731318295002, + "max_absolute_delta": 0.7596727609634399, + "voiced_frames_unchanged": true, + "f0_unchanged": true + } + ], + "preservation": { + "files_equal": true, + "cpu_tts_pids_equal": true, + "strata_pids_equal": true, + "deck_start_equal": true, + "selected_exports_unchanged": true + } +} \ No newline at end of file diff --git a/docs/experiments/kikiri-anna-breath-2026-10-27/smooth.py b/docs/experiments/kikiri-anna-breath-2026-10-27/smooth.py new file mode 100644 index 0000000..159dc77 --- /dev/null +++ b/docs/experiments/kikiri-anna-breath-2026-10-27/smooth.py @@ -0,0 +1,68 @@ +"""One in-memory CPU ablation of unvoiced predicted log-energy; no weight edits.""" +from pathlib import Path +import hashlib,json,sys,types +ROOT=Path('/data/athena-kikiri-anna-breath-20261027') +PREVIOUS=Path('/data/athena-kikiri-anna-pronunciation-20261027') +sys.path.insert(0,str(PREVIOUS)) +source=(PREVIOUS/'experiment.py').read_text() +marker="(ROOT/'outputs').mkdir(exist_ok=True,mode=0o700)" +assert source.count(marker)==1 +prefix=source.split(marker)[0] +old="ROOT = Path('/data/athena-kikiri-anna-pronunciation-20261027')" +assert prefix.count(old)==1 +prefix=prefix.replace(old,"ROOT = Path('/data/athena-kikiri-anna-breath-20261027')") +module=types.ModuleType('anna_breath_ablation') +exec(compile(prefix,str(PREVIOUS/'experiment.py'),'exec'),module.__dict__) +torch=module.torch;F=torch.nn.functional +(ROOT/'outputs').mkdir(exist_ok=True,mode=0o700) +module.render('Die Stimme ist bereit.','warmup',fixed=True,save=False) +selected=json.loads((module.PARENT/'cpu-plus20.json').read_text()) +text=next(r['text'] for r in selected['runs'] if r['case']=='expressive') +original=next(r for r in json.loads((PREVIOUS/'results.json').read_text())['runs'] if r['arm']=='voegel-fixed') +base=module.render(text,'breath-baseline',fixed=True) +assert base['sha256']==original['sha256'] +changes=[] + +def smooth_energy(decoder,args): + asr,f0,norm,style=args + assert f0.shape==norm.shape and f0.ndim==2 + # F0, timing, excitation settings and learned tensors stay unchanged. + # N is a learned log-energy conditioning curve, not the random noise itself. + unvoiced=(f0<=decoder.generator.m_source.l_sin_gen.voiced_threshold).to(norm.dtype) + averaged=F.avg_pool1d(F.pad(norm[:,None],(2,2),mode='replicate'),5,stride=1).squeeze(1) + stable=(F.avg_pool1d(unvoiced[:,None],5,stride=1,padding=2).squeeze(1)>=1).to(norm.dtype) + taper=F.avg_pool1d(stable[:,None],3,stride=1,padding=1).squeeze(1)*unvoiced + adjusted=norm+0.5*taper*(averaged-norm) + assert torch.equal(adjusted[unvoiced==0],norm[unvoiced==0]) + assert torch.isfinite(adjusted).all() + delta=(adjusted-norm).detach() + changes.append(dict(frames=norm.numel(),changed_frames=int((delta!=0).sum()), + mean_absolute_delta=float(delta.abs().mean()),max_absolute_delta=float(delta.abs().max()), + voiced_frames_unchanged=True,f0_unchanged=True)) + return asr,f0,adjusted,style + +hook=module.model.decoder.register_forward_pre_hook(smooth_energy) +result=dict(complete=False,reused_source_sha256=hashlib.sha256(source.encode()).hexdigest(), + baseline_matches_corrected_A=True,device='cpu',threads=4, + model_sha256=module.initial_hashes[0],voice_sha256=module.initial_hashes[1],runs=[base], + experimental_parameters=dict(energy_average_frames=5,energy_average_ms=62.5, + maximum_blend=0.5,mask_taper_frames=3,only_unvoiced=True, + unvoiced_is_not_an_annotated_breath_mask=True)) +try: + row=module.render(text,'breath-soft',fixed=True) + assert row['phonemes']==base['phonemes'] and row['duration_seconds']==base['duration_seconds'] + assert len(changes)==1 and changes[0]['changed_frames']>0 + result.update(complete=True,changes=changes) + result['runs'].append(row) +finally: + hook.remove() + after=module.snapshot() + result['preservation']=dict(files_equal=module.before['hashes']==after['hashes'], + cpu_tts_pids_equal=module.before['pids']['articulino']==after['pids']['articulino'] and module.before['pids']['qwen_tts']==after['pids']['qwen_tts'], + strata_pids_equal=module.before['pids']['strata']==after['pids']['strata'], + deck_start_equal=module.before['deck_started']==after['deck_started'], + selected_exports_unchanged=module.initial_hashes==[module.sha(module.model_path),module.sha(module.voice_path)]) + module.write('smooth-results.json',result) + print(json.dumps(dict(complete=result['complete'],changes=changes,preservation=result['preservation'], + runs=[{k:r[k] for k in ('arm','duration_seconds','generation_seconds','rtf')} for r in result['runs']])),flush=True) +assert all(result['preservation'].values()) diff --git a/docs/experiments/kikiri-anna-breath-2026-10-27/transcriptions.json b/docs/experiments/kikiri-anna-breath-2026-10-27/transcriptions.json new file mode 100644 index 0000000..3801f50 --- /dev/null +++ b/docs/experiments/kikiri-anna-breath-2026-10-27/transcriptions.json @@ -0,0 +1,20 @@ +[ + { + "arm": "breath-baseline", + "file": "anna-plus20-breath-baseline.wav", + "expected": "Guten Morgen, Michael. Schön, dass du wieder da bist! Draußen rauscht der Regen, und die Vögel suchen Schutz unter dem Dach. Wirklich? Das hätte ich nicht gedacht. Heute nehmen wir uns ein wenig Zeit und machen alles ganz in Ruhe.", + "recognized": "Guten Morgen Michael, schön, dass du wieder da bist, draußen rauscht der Regen und die Vögel suchen Schutz unter dem Dach. Wirklich, das hätte ich nicht gedacht. Heute nehmen wir uns ein wenig Zeit und machen alles ganz in Ruhe.", + "word_edits": 0, + "reference_words": 40, + "seconds": 1.2785634820029372 + }, + { + "arm": "breath-soft", + "file": "anna-plus20-breath-soft.wav", + "expected": "Guten Morgen, Michael. Schön, dass du wieder da bist! Draußen rauscht der Regen, und die Vögel suchen Schutz unter dem Dach. Wirklich? Das hätte ich nicht gedacht. Heute nehmen wir uns ein wenig Zeit und machen alles ganz in Ruhe.", + "recognized": "Guten Morgen Michael, schön, dass du wieder da bist, draußen rauscht der Regen und die Vögel suchen Schutz unter dem Dach. Wirklich, das hätte ich nicht gedacht. Heute nehmen wir uns ein wenig Zeit und machen alles ganz in Ruhe.", + "word_edits": 0, + "reference_words": 40, + "seconds": 1.3005464429879794 + } +] \ No newline at end of file diff --git a/docs/experiments/kikiri-anna-pronunciation-2026-10-27/README.md b/docs/experiments/kikiri-anna-pronunciation-2026-10-27/README.md index 3fc5e7d..64db603 100644 --- a/docs/experiments/kikiri-anna-pronunciation-2026-10-27/README.md +++ b/docs/experiments/kikiri-anna-pronunciation-2026-10-27/README.md @@ -114,3 +114,15 @@ Local listening files: and `anna-plus20-sentences-fixed.wav`. Baseline and corrected-story files are retained in the same directory. Scripts/results are versioned; WAVs stay outside Git. No native/client playback integration or fresh-host restore is certified. + +## Listening follow-up + +Michael confirms the Vögel pronunciation is very good. He hears no meaningful +A/B difference from sentence splitting; at most B may be slightly better. +The residual artifact is particularly noticeable on breathing, described as +many tiny samples joined together. This is a description of perceived texture, +not evidence of actual missing sample blocks. Keep the confirmed word correction +and investigate the decoder/noise texture separately; do not adopt segmentation +as a demonstrated robotic-timbre fix or automatically train more epochs. +The [CPU breath investigation](../kikiri-anna-breath-2026-10-27/README.md) +preserves Qwen's loaded state and the selected weights. diff --git a/docs/experiments/tts-candidate-shortlist-2026-10-27.md b/docs/experiments/tts-candidate-shortlist-2026-10-27.md index 046e097..68efbe5 100644 --- a/docs/experiments/tts-candidate-shortlist-2026-10-27.md +++ b/docs/experiments/tts-candidate-shortlist-2026-10-27.md @@ -14,6 +14,15 @@ CPU run misses the required reserve, stop rather than completing a large voice or quality matrix. Do not spend further tuning time on a speed-rejected model; record the verdict and clean up its own test data when requested. +Latest Kikiri listening detail: Michael confirms the Vögel fix, but hears +virtually no A/B benefit from sentence splitting. The slight robotic character +is concentrated on breathing and sounds granular to him. A separate bounded +[CPU breath investigation](kikiri-anna-breath-2026-10-27/README.md) found no +recurrent exact-zero holes in the whole-paragraph speech and retains FP32. +One in-memory smoothing ablation of unvoiced predicted log-energy preserves +words, duration and the selected files; its perceptual verdict is pending. +Do not treat segmentation or smoothing as an accepted fix. Qwen stays loaded. + | Model | Current decision | Evidence and next question | | --- | --- | --- | | Sopro V2 Turbo, FP32 | **Serious candidate; retain — preferred listening sample: technical B** | About 2.42× realtime on Athena CPU, four threads. All three story samples matched all words in local STT. Raw technical text still has ASR discrepancies around Unraid, MiB, CEST and time wording. Michael hears technical B as the closest Anna approximation so far, better than Articulino but not perfect. Reference B is 05:25.14–05:33.00 of the supplied recording; fixed recipe and results: [Sopro experiment](sopro-cpu-2026-10-27/README.md). No activation/integration authorized; continue evaluating other models. |