caelum0x 524f2ddea5 fix(near-hackathon): re-voice false "live on two other chains" claim in pitch demo video
Narration line 2 said Cred402 is "already live on two other chains, and
now native NEAR" — false. Live checks against
cred402-1.onrender.com/v1/x402/{algorand,qie}/status both return
configured:false. The deck was already corrected (4eb21fe); this patches
the video's narration to match.

New line 2: "Cred402 sells credit scores to AI agents over a pay per
call payment protocol, and now it's enforced natively on NEAR." Same
Aura-2 voice (aura-2-asteria-en — re-derived acoustically, since no
voice ID was recorded in the original build: synthesized the real line 1
text in all 5 cataloged voices and compared pitch/spectral-centroid
against the shipped audio; asteria matched an order of magnitude closer
than the next candidate). Same per-line Deepgram nova-3 QC round-trip.

Only the line 2 window (8.9s-17.766s) was touched — confirmed by frame
diff that this whole span is a single static held title card in the
shipped video, so the patch could re-render just that card + new
captions + new audio and splice it between the untouched first 8.9s and
untouched remainder (which includes line 3's unmoved 19.5s start).
Re-transcribed the full final audio with nova-3 to confirm lines 1 and
3-6 are unchanged.

Duration unchanged (70.6s), resolution/fps/codec unchanged (1920x1080,
30fps, h264/aac). Re-mastered loudness: -14.8 LUFS integrated / -1.8
dBTP true peak (both within spec).

Reproducible recipe: media/video-recipe/line2-fix/ (generate_line2_audio.py
-> render_line2_assets.mjs -> build_patch.sh).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-11 02:06:42 +03:00

103 lines
4.5 KiB
Python

#!/usr/bin/env python3
"""
generate_line2_audio.py — regenerate ONLY narration line 2 for the NEAR
Hackathon pitch-demo video, because the original take said Cred402 is
"already live on two other chains" — false. Live checks against
https://cred402-1.onrender.com/v1/x402/{algorand,qie}/status both return
"configured": false (judge-review correction, 2026-11-11, see
../../README.md and PITCH-DECK.md).
Voice identity (aura-2-asteria-en) was not recorded anywhere in the original
build (no lines.json was committed with the first cut), so it was
re-derived acoustically: the real narration for line 1 and line 2 was
extracted from the shipped mp4 and compared (median F0 + spectral
centroid, autocorrelation pitch tracker, no scipy/librosa needed) against
fresh same-text takes in all 5 voices registered in
plans/gtm/tools/deepgram_voice.py. aura-2-asteria-en matched line 1 with
dF0=9.4Hz / dCentroid=31.2Hz — an order of magnitude closer than every
other candidate (next closest, pandora, was dF0=14.4 / dCentroid=474.3).
This script reuses the shared take()/QC machinery in deepgram_voice.py
(Aura-2 synth + nova-3 ASR round-trip, same letter-stream comparison, same
retry-until-it-passes discipline) rather than reimplementing it, and adds
one more acceptance gate specific to this cut: the new line must still fit
inside the ORIGINAL line 2 time slot (8.9s -> 17.756s on the film's master
clock, 8.856s) so line 3 (which starts at 19.5s, after a static-card hold
that doesn't move) is never touched.
Run:
DEEPGRAM_API_KEY=... python3 generate_line2_audio.py
Writes, next to this script:
voice/l2.mp3 the accepted take
l2_take.json dur, gain_db, transcript, word-level caption timings
"""
from __future__ import annotations
import json
import sys
from pathlib import Path
HERE = Path(__file__).resolve().parent
# Shared tool lives in a sibling product tree (products/plans/gtm/tools), not
# under cred402 — not a path derivable from HERE, so it's resolved from $HOME.
TOOLS_DIR = Path.home() / "products" / "plans" / "gtm" / "tools"
sys.path.insert(0, str(TOOLS_DIR))
import deepgram_voice as dg # noqa: E402
VOICE = "aura-2-asteria-en" # re-derived acoustically, see module docstring
SLOT_START = 8.9 # unchanged from the original build's l2 start
SLOT_END = 17.756 # unchanged from the original build's l2 end
MAX_DUR = SLOT_END - SLOT_START # 8.856s — do not touch l3's 19.5s start
# The old line said: "...already live on two other chains and now native
# Near." — false. The new line drops the overclaim, keeps the true part
# (pay-per-call protocol), and states only what's actually proven: the
# protocol is enforced natively on NEAR (matches l4's own "it's live right
# now" claim about the same NEAR contract). "x402" is deliberately left
# out of the SPOKEN line — it's already on screen in the card2 caption
# ("x402 (402 Payment Required)...") and Aura-2 cannot say "x402" as one
# token (it always comes back "x four zero two"); round-tripping still
# passes QC because deepgram_voice.letters() canonicalises number words,
# but leaving it out of speech avoids the long pause it otherwise forces,
# which was the real reason earlier full-length takes blew the time slot.
TEXT = (
"Cred402 sells credit scores to AI agents over a pay per call payment "
"protocol, and now it's enforced natively on NEAR."
)
MAX_ATTEMPTS = 10
def main() -> None:
auth = dg.key()
voice_dir = HERE / "voice"
voice_dir.mkdir(parents=True, exist_ok=True)
best = None
for attempt in range(1, MAX_ATTEMPTS + 1):
rec, problems = dg.take("l2", TEXT, TEXT, VOICE, auth, voice_dir)
if not rec:
print(f"attempt {attempt}: QC FAILED — {problems[0]}")
continue
print(f"attempt {attempt}: QC passed, dur={rec['dur']}s")
if rec["dur"] <= MAX_DUR:
best = rec
print(f" -> fits the {MAX_DUR:.3f}s slot, accepting")
break
print(f" -> QC ok but {rec['dur']}s > {MAX_DUR:.3f}s slot, retrying for a shorter take")
if not best:
sys.exit(f"no take of {MAX_ATTEMPTS} fit the {MAX_DUR:.3f}s slot — shorten TEXT further")
best["slot_start"] = SLOT_START
best["slot_end"] = SLOT_END
best["pad_tail_s"] = round(MAX_DUR - best["dur"], 3)
(HERE / "l2_take.json").write_text(json.dumps(best, indent=2) + "\n")
print(f"\nwrote {HERE}/l2_take.json and {voice_dir}/l2.mp3")
print(f"new line: {best['transcript']!r}")
print(f"dur {best['dur']}s, slot {MAX_DUR:.3f}s, tail silence {best['pad_tail_s']}s")
if __name__ == "__main__":
main()