[{"data":1,"prerenderedAt":2397},["ShallowReactive",2],{"en-blog-detail-/en/blog/20261203-gemini-tts-interactive-boardbook-pipeline-2026-12-03":3,"en-blog-linked-project-/en/blog/20261203-gemini-tts-interactive-boardbook-pipeline-2026-12-03":2386,"en-blog-ko-counterpart-/en/blog/20261203-gemini-tts-interactive-boardbook-pipeline-2026-12-03":2390,"en-blog-surround-/en/blog/20261203-gemini-tts-interactive-boardbook-pipeline-2026-12-03":2391},{"id":4,"title":5,"adsEnabled":6,"author":7,"body":8,"buildLogLabel":2364,"category":2365,"coverImage":2366,"coverImageAlt":2367,"date":2368,"description":2369,"extension":2370,"faq":2371,"meta":2372,"navigation":6,"noindex":2373,"path":2374,"project":2375,"promo":2373,"seo":2376,"seoDescription":2371,"seoTitle":2371,"status":2377,"stem":2378,"tags":2379,"__hash__":2385},"enBlog/en/blog/20261203-Gemini-TTS-Interactive-Boardbook-Pipeline.md","Gemini TTS Parent Voice Cloning & 300 DPI Print-to-Web Boardbook Pipeline",true,"KangSum",{"type":9,"value":10,"toc":2346},"minimark",[11,15,32,44,68,71,79,91,112,117,132,201,553,579,581,585,588,595,603,611,618,710,717,743,997,1000,1117,1119,1126,1133,1214,2029,2043,2045,2053,2060,2164,2166,2170,2184,2245,2256,2258,2262,2271,2336,2342],[12,13,5],"h1",{"id":14},"gemini-tts-parent-voice-cloning-300-dpi-print-to-web-boardbook-pipeline",[16,17,18,19,23,24,27,28,31],"p",{},"When building a peekaboo and hidden-object picture book for 12-to-24-month-old toddlers, two engineering requirements shaped every architectural decision from day one. First, the child should hear ",[20,21,22],"strong",{},"their own mother's and father's warm voices"," rather than a generic studio narrator. Second, the physical ",[20,25,26],{},"300 DPI print boardbook"," and the NFC-triggered ",[20,29,30],{},"mobile sound remote and web boardbook"," had to stay lockstep synchronized through a Single Source of Truth (SSOT) manifest.",[16,33,34,35,39,40,43],{},"Turning that vision into a working pipeline turned out to be far harder than calling a text-to-speech endpoint. Recording parents in expressive, high-pitched \"storytime\" cadence immediately tripped ",[36,37,38],"code",{},"gemini-3.8-flash-tts","'s child-voice safety filter (",[36,41,42],{},"FINISH_REASON_INPUT_VR_TAKEDOWN","). Standard Korean grapheme input stumbled over storytelling liaison rules and nickname-dependent grammatical particles. On the visual and print side, dense backgrounds overwhelmed toddler perception while headless Chromium silently reused stale image caches when generating print PDFs.",[16,45,46,47,52,53],{},"This post walks through the production architecture behind the ",[48,49,51],"a",{"href":50},"/en/projects/interactive-sound-boardbook-studio","AI Voice Cloning & Print-to-Web Interactive Boardbook Studio",": ",[20,54,55,56,59,60,63,64,67],{},"① eliminating ",[36,57,58],{},"VR_TAKEDOWN"," false positives with one-take declarative chest-voice splitting, ② Korean standard pronunciation G2P normalization and 3-tier prosody across 39 clips per speaker, ③ ",[36,61,62],{},"70–90%"," polygon occlusion with ",[36,65,66],{},"+30%"," letterbox-inverted touch hit-testing, and ④ cache-busted 300 DPI dual PDF builds paired with a low-glare OLED dark sound remote.",[69,70],"hr",{},[72,73,75,76,78],"h2",{"id":74},"_1-solving-vr_takedown-false-positives-via-one-take-declarative-splitting","1. Solving ",[36,77,58],{}," False Positives via One-Take Declarative Splitting",[16,80,81,82,85,86,90],{},"In our earliest prototype, parents recorded 20 seconds of reference audio exactly the way they would read to a toddler—raising pitch, stretching vowels, and exaggerating onomatopoeia. Almost every attempt failed either during ",[36,83,84],{},"POST /v1beta/voices"," enrollment or initial synthesis verification with ",[20,87,88],{},[36,89,42],{},".",[92,93,94],"blockquote",{},[16,95,96,99,100,103,104,107,108,111],{},[20,97,98],{},"Key Takeaway:"," Gemini Voice Replication's safety classifier flags high fundamental-frequency pitch spikes (",[36,101,102],{},"F0 > 350 Hz",") and Infant-Directed Speech (\"parentese\") contours inside reference samples as potential unauthorized minor voice cloning. Worse, recording the ",[36,105,106],{},"source"," reference and mandatory ",[36,109,110],{},"consent"," statement on separate days or at different mic distances introduces room-tone mismatch that degrades speaker verification accuracy.",[113,114,116],"h3",{"id":115},"_11-adult-chest-voice-declarative-3s-silence-consent-one-take-spec","1.1. Adult Chest-Voice Declarative + 3s Silence + Consent One-Take Spec",[16,118,119,120,123,124,127,128,131],{},"The permanent fix was decoupling ",[20,121,122],{},"timbre capture"," from ",[20,125,126],{},"expressive acting",". Reference recordings now capture only a calm adult chest-voice fingerprint, while all warm, playful storytelling prosody is delegated strictly to synthesis-time ",[36,129,130],{},"speechMetadata.style"," prompting.",[133,134,135,158,167],"ol",{},[136,137,138,141,142,145,146,149,150,153,154,157],"li",{},[20,139,140],{},"Unified Preprocessing Chain:"," Apply an ",[36,143,144],{},"80–85 Hz"," high-pass filter to remove room rumble, light de-essing around ",[36,147,148],{},"6.5 kHz",", a gentle ",[36,151,152],{},"220 Hz -2 dB"," mud cut, and a ",[36,155,156],{},"1.8:1"," soft compressor to normalize vocal body.",[136,159,160,163,164,90],{},[20,161,162],{},"Single Continuous One-Take Capture:"," Without stopping the recorder or moving off-axis from the microphone, the parent records ",[36,165,166],{},"[Part 1: 20–23s calm declarative adult prose] → [3 seconds of silence] → [Part 2: mandatory Korean voice-consent sentence]",[136,168,169,180,181,184,185,188,189,192,193,196,197,200],{},[20,170,171,172,175,176,179],{},"Zero-Click Splitting (",[36,173,174],{},"faster-whisper"," + ",[36,177,178],{},"ffmpeg silencedetect","):"," Word-level timestamps locate the exact onset of the consent opening token (",[36,182,183],{},"\"나는\"","), and ",[36,186,187],{},"silencedetect"," finds the exact midpoint of the preceding 3-second quiet window. Cutting at that midpoint with ",[36,190,191],{},"15ms"," fades and ",[36,194,195],{},"0.25s"," silence padding yields click-free ",[36,198,199],{},"24000 Hz, Mono, 16-bit PCM"," WAV pairs.",[202,203,208],"pre",{"className":204,"code":205,"language":206,"meta":207,"style":207},"language-python shiki shiki-themes github-light github-dark","# ~/workspace/storybook-studio/scripts/audio/split_onetake_ref.py (Zero-click one-take splitter)\nimport re\nimport subprocess\nfrom pathlib import Path\nfrom faster_whisper import WhisperModel\n\ndef split_onetake_reference(raw_audio: Path, out_dir: Path, speaker: str = \"dad\") -> tuple[Path, Path]:\n    out_dir.mkdir(parents=True, exist_ok=True)\n    norm_wav = out_dir / f\"{speaker}_onetake_24k.wav\"\n    subprocess.run(\n        [\"ffmpeg\", \"-y\", \"-i\", str(raw_audio), \"-ar\", \"24000\", \"-ac\", \"1\", \"-c:a\", \"pcm_s16le\", str(norm_wav)],\n        check=True, capture_output=True,\n    )\n\n    # 1. Locate the opening token of the Korean consent phrase (\"나는\") via word timestamps\n    wm = WhisperModel(\"mobiuslabsgmbh/faster-whisper-large-v3-turbo\", device=\"cpu\", compute_type=\"int8\", local_files_only=True)\n    segments, _ = wm.transcribe(str(norm_wav), language=\"ko\", word_timestamps=True)\n    consent_start_sec: float | None = None\n    for seg in segments:\n        for w in (seg.words or []):\n            token = re.sub(r\"\\s+\", \"\", w.word or \"\")\n            if \"나는\" in token and w.start >= 12.0:\n                consent_start_sec = float(w.start)\n                break\n        if consent_start_sec is not None:\n            break\n\n    if consent_start_sec is None:\n        raise RuntimeError(\"Failed to detect consent phrase opening token ('나는').\")\n\n    # 2. Compute exact midpoint of the preceding 3s silence window for a zero-click cut\n    sd = subprocess.run(\n        [\"ffmpeg\", \"-i\", str(norm_wav), \"-af\", \"silencedetect=noise=-40dB:d=1.2\", \"-f\", \"null\", \"-\"],\n        check=True, capture_output=True, text=True,\n    )\n    starts = [float(m.group(1)) for m in re.finditer(r\"silence_start:\\s*([0-9.]+)\", sd.stderr)]\n    ends = [float(m.group(1)) for m in re.finditer(r\"silence_end:\\s*([0-9.]+)\", sd.stderr)]\n    cut_sec = consent_start_sec - 0.35\n    for s_t, e_t in zip(starts, ends):\n        if e_t \u003C= consent_start_sec + 0.2 and (e_t - s_t) >= 1.2:\n            cut_sec = (s_t + e_t) / 2.0\n\n    # 3. Export 24kHz Mono PCM pair with 0.25s boundary padding and 15ms fade-in\n    src_wav = out_dir / f\"{speaker}_source_24k.wav\"\n    cons_wav = out_dir / f\"{speaker}_consent_24k.wav\"\n    trim_pad_af = (\n        \"silenceremove=start_periods=1:start_silence=0.05:start_threshold=-40dB,\"\n        \"areverse,silenceremove=start_periods=1:start_silence=0.05:start_threshold=-40dB,areverse,\"\n        \"afade=t=in:st=0:d=0.015,adelay=250|250,apad=pad_dur=0.25\"\n    )\n    for start_t, end_t, dest in [(\"0\", f\"{cut_sec:.3f}\", src_wav), (f\"{cut_sec:.3f}\", None, cons_wav)]:\n        cmd = [\"ffmpeg\", \"-y\", \"-i\", str(norm_wav), \"-ss\", start_t]\n        if end_t:\n            cmd.extend([\"-to\", end_t])\n        cmd.extend([\"-af\", trim_pad_af, \"-ar\", \"24000\", \"-ac\", \"1\", \"-c:a\", \"pcm_s16le\", str(dest)])\n        subprocess.run(cmd, check=True, capture_output=True)\n\n    return src_wav, cons_wav\n","python","",[36,209,210,218,224,230,236,242,248,254,260,266,272,278,284,290,295,301,307,313,319,325,331,337,343,349,355,361,367,372,378,384,389,395,401,407,413,418,424,430,436,442,448,454,459,465,471,477,483,489,495,501,506,512,518,524,530,536,542,547],{"__ignoreMap":207},[211,212,215],"span",{"class":213,"line":214},"line",1,[211,216,217],{},"# ~/workspace/storybook-studio/scripts/audio/split_onetake_ref.py (Zero-click one-take splitter)\n",[211,219,221],{"class":213,"line":220},2,[211,222,223],{},"import re\n",[211,225,227],{"class":213,"line":226},3,[211,228,229],{},"import subprocess\n",[211,231,233],{"class":213,"line":232},4,[211,234,235],{},"from pathlib import Path\n",[211,237,239],{"class":213,"line":238},5,[211,240,241],{},"from faster_whisper import WhisperModel\n",[211,243,245],{"class":213,"line":244},6,[211,246,247],{"emptyLinePlaceholder":6},"\n",[211,249,251],{"class":213,"line":250},7,[211,252,253],{},"def split_onetake_reference(raw_audio: Path, out_dir: Path, speaker: str = \"dad\") -> tuple[Path, Path]:\n",[211,255,257],{"class":213,"line":256},8,[211,258,259],{},"    out_dir.mkdir(parents=True, exist_ok=True)\n",[211,261,263],{"class":213,"line":262},9,[211,264,265],{},"    norm_wav = out_dir / f\"{speaker}_onetake_24k.wav\"\n",[211,267,269],{"class":213,"line":268},10,[211,270,271],{},"    subprocess.run(\n",[211,273,275],{"class":213,"line":274},11,[211,276,277],{},"        [\"ffmpeg\", \"-y\", \"-i\", str(raw_audio), \"-ar\", \"24000\", \"-ac\", \"1\", \"-c:a\", \"pcm_s16le\", str(norm_wav)],\n",[211,279,281],{"class":213,"line":280},12,[211,282,283],{},"        check=True, capture_output=True,\n",[211,285,287],{"class":213,"line":286},13,[211,288,289],{},"    )\n",[211,291,293],{"class":213,"line":292},14,[211,294,247],{"emptyLinePlaceholder":6},[211,296,298],{"class":213,"line":297},15,[211,299,300],{},"    # 1. Locate the opening token of the Korean consent phrase (\"나는\") via word timestamps\n",[211,302,304],{"class":213,"line":303},16,[211,305,306],{},"    wm = WhisperModel(\"mobiuslabsgmbh/faster-whisper-large-v3-turbo\", device=\"cpu\", compute_type=\"int8\", local_files_only=True)\n",[211,308,310],{"class":213,"line":309},17,[211,311,312],{},"    segments, _ = wm.transcribe(str(norm_wav), language=\"ko\", word_timestamps=True)\n",[211,314,316],{"class":213,"line":315},18,[211,317,318],{},"    consent_start_sec: float | None = None\n",[211,320,322],{"class":213,"line":321},19,[211,323,324],{},"    for seg in segments:\n",[211,326,328],{"class":213,"line":327},20,[211,329,330],{},"        for w in (seg.words or []):\n",[211,332,334],{"class":213,"line":333},21,[211,335,336],{},"            token = re.sub(r\"\\s+\", \"\", w.word or \"\")\n",[211,338,340],{"class":213,"line":339},22,[211,341,342],{},"            if \"나는\" in token and w.start >= 12.0:\n",[211,344,346],{"class":213,"line":345},23,[211,347,348],{},"                consent_start_sec = float(w.start)\n",[211,350,352],{"class":213,"line":351},24,[211,353,354],{},"                break\n",[211,356,358],{"class":213,"line":357},25,[211,359,360],{},"        if consent_start_sec is not None:\n",[211,362,364],{"class":213,"line":363},26,[211,365,366],{},"            break\n",[211,368,370],{"class":213,"line":369},27,[211,371,247],{"emptyLinePlaceholder":6},[211,373,375],{"class":213,"line":374},28,[211,376,377],{},"    if consent_start_sec is None:\n",[211,379,381],{"class":213,"line":380},29,[211,382,383],{},"        raise RuntimeError(\"Failed to detect consent phrase opening token ('나는').\")\n",[211,385,387],{"class":213,"line":386},30,[211,388,247],{"emptyLinePlaceholder":6},[211,390,392],{"class":213,"line":391},31,[211,393,394],{},"    # 2. Compute exact midpoint of the preceding 3s silence window for a zero-click cut\n",[211,396,398],{"class":213,"line":397},32,[211,399,400],{},"    sd = subprocess.run(\n",[211,402,404],{"class":213,"line":403},33,[211,405,406],{},"        [\"ffmpeg\", \"-i\", str(norm_wav), \"-af\", \"silencedetect=noise=-40dB:d=1.2\", \"-f\", \"null\", \"-\"],\n",[211,408,410],{"class":213,"line":409},34,[211,411,412],{},"        check=True, capture_output=True, text=True,\n",[211,414,416],{"class":213,"line":415},35,[211,417,289],{},[211,419,421],{"class":213,"line":420},36,[211,422,423],{},"    starts = [float(m.group(1)) for m in re.finditer(r\"silence_start:\\s*([0-9.]+)\", sd.stderr)]\n",[211,425,427],{"class":213,"line":426},37,[211,428,429],{},"    ends = [float(m.group(1)) for m in re.finditer(r\"silence_end:\\s*([0-9.]+)\", sd.stderr)]\n",[211,431,433],{"class":213,"line":432},38,[211,434,435],{},"    cut_sec = consent_start_sec - 0.35\n",[211,437,439],{"class":213,"line":438},39,[211,440,441],{},"    for s_t, e_t in zip(starts, ends):\n",[211,443,445],{"class":213,"line":444},40,[211,446,447],{},"        if e_t \u003C= consent_start_sec + 0.2 and (e_t - s_t) >= 1.2:\n",[211,449,451],{"class":213,"line":450},41,[211,452,453],{},"            cut_sec = (s_t + e_t) / 2.0\n",[211,455,457],{"class":213,"line":456},42,[211,458,247],{"emptyLinePlaceholder":6},[211,460,462],{"class":213,"line":461},43,[211,463,464],{},"    # 3. Export 24kHz Mono PCM pair with 0.25s boundary padding and 15ms fade-in\n",[211,466,468],{"class":213,"line":467},44,[211,469,470],{},"    src_wav = out_dir / f\"{speaker}_source_24k.wav\"\n",[211,472,474],{"class":213,"line":473},45,[211,475,476],{},"    cons_wav = out_dir / f\"{speaker}_consent_24k.wav\"\n",[211,478,480],{"class":213,"line":479},46,[211,481,482],{},"    trim_pad_af = (\n",[211,484,486],{"class":213,"line":485},47,[211,487,488],{},"        \"silenceremove=start_periods=1:start_silence=0.05:start_threshold=-40dB,\"\n",[211,490,492],{"class":213,"line":491},48,[211,493,494],{},"        \"areverse,silenceremove=start_periods=1:start_silence=0.05:start_threshold=-40dB,areverse,\"\n",[211,496,498],{"class":213,"line":497},49,[211,499,500],{},"        \"afade=t=in:st=0:d=0.015,adelay=250|250,apad=pad_dur=0.25\"\n",[211,502,504],{"class":213,"line":503},50,[211,505,289],{},[211,507,509],{"class":213,"line":508},51,[211,510,511],{},"    for start_t, end_t, dest in [(\"0\", f\"{cut_sec:.3f}\", src_wav), (f\"{cut_sec:.3f}\", None, cons_wav)]:\n",[211,513,515],{"class":213,"line":514},52,[211,516,517],{},"        cmd = [\"ffmpeg\", \"-y\", \"-i\", str(norm_wav), \"-ss\", start_t]\n",[211,519,521],{"class":213,"line":520},53,[211,522,523],{},"        if end_t:\n",[211,525,527],{"class":213,"line":526},54,[211,528,529],{},"            cmd.extend([\"-to\", end_t])\n",[211,531,533],{"class":213,"line":532},55,[211,534,535],{},"        cmd.extend([\"-af\", trim_pad_af, \"-ar\", \"24000\", \"-ac\", \"1\", \"-c:a\", \"pcm_s16le\", str(dest)])\n",[211,537,539],{"class":213,"line":538},56,[211,540,541],{},"        subprocess.run(cmd, check=True, capture_output=True)\n",[211,543,545],{"class":213,"line":544},57,[211,546,247],{"emptyLinePlaceholder":6},[211,548,550],{"class":213,"line":549},58,[211,551,552],{},"    return src_wav, cons_wav\n",[16,554,555,556,558,559,562,563,566,567,570,571,574,575,578],{},"Before invoking ",[36,557,84],{},", a pre-flight validation gate verifies that the reference audio remains within adult chest-voice pitch limits (",[36,560,561],{},"F0 \u003C= 350 Hz",") and that back-transcription of the consent clip matches the mandatory script. Returned voice handles are cached under speaker slots such as ",[36,564,565],{},"VOICE_PROFILE_MOM"," and ",[36,568,569],{},"VOICE_PROFILE_DAD"," in ",[36,572,573],{},"config/gemini_voices.json",", while API credentials stay isolated in runtime environment variables (",[36,576,577],{},"YOUR_API_KEY",").",[69,580],{},[72,582,584],{"id":583},"_2-single-ssot-architecture-korean-g2p-preprocessing-and-3-tier-prosody-across-39-clips","2. Single-SSOT Architecture, Korean G2P Preprocessing, and 3-Tier Prosody Across 39 Clips",[16,586,587],{},"Once voice enrollment succeeded reliably, the next challenge was making Korean storytelling speech sound genuinely natural while keeping page indices identical across print, audio, and web targets. The diagram below shows how a single SSOT manifest fans out into the audio/remote pipeline and the occlusion/300 DPI print pipeline.",[16,589,590],{},[591,592],"img",{"alt":593,"src":594},"Single-SSOT pipeline diagram linking 70-90% occlusion scene design, Korean G2P and Gemini TTS voice cloning, OLED dark sound remote, and 300 DPI dual PDF publishing","/images/content-images/blog/20261203-Gemini-TTS-Interactive-Boardbook-Pipeline/20261203-Gemini-TTS-Interactive-Boardbook-Pipeline002-en.svg",[113,596,598,599,602],{"id":597},"_21-korean-standard-pronunciation-g2p-layer-and-short-pause-breath-control","2.1. Korean Standard Pronunciation G2P Layer and ",[36,600,601],{},"\u003Cshort pause>"," Breath Control",[16,604,605,606,610],{},"Toddler picture-book scripts behave differently from news copy: they are packed with mimetic words, native Korean counting numbers, and grammatical particles attached dynamically to a child's nickname. If a nickname ends with a final consonant (",[607,608,609],"em",{},"batchim",") versus an open vowel, Korean vocative, subject, and comitative particles all change form—and naive grapheme input frequently misreads liaison or fortition boundaries.",[16,612,613,614,617],{},"To prevent robotic pronunciation before hitting the synthesis API, we inserted a ",[20,615,616],{},"Korean G2P (Grapheme-to-Phoneme) preprocessing stage"," with three responsibilities:",[619,620,621,653,659],"ul",{},[136,622,623,630,631,634,635,638,639,634,642,645,646,634,649,652],{},[20,624,625,626,629],{},"Final-Consonant (",[607,627,628],{},"Batchim",") Particle Resolution:"," Inspects the Unicode Hangul syllable coda of the configured child nickname and automatically harmonizes vocative (",[36,632,633],{},"아","/",[36,636,637],{},"야","), nominative (",[36,640,641],{},"이",[36,643,644],{},"가","), and comitative (",[36,647,648],{},"이랑",[36,650,651],{},"랑",") particles.",[136,654,655,658],{},[20,656,657],{},"Selective Standard Pronunciation Correction:"," Flags high-risk compound numerals and onomatopoeia against a standard pronunciation lexicon without rewriting entire sentences phonetically—preserving natural phrasal intonation while fixing jagged liaison.",[136,660,661,667,668,671,672,675,676,679,680,683,684,686,687,690,691,694,695,698,699,702,703,706,707,578],{},[20,662,663,664,666],{},"Priority-Ranked ",[36,665,601],{}," Injection:"," Normalizes ellipses (",[36,669,670],{},"...",", ",[36,673,674],{},"…",") and tildes (",[36,677,678],{},"~","), then injects at most ",[36,681,682],{},"5"," ",[36,685,601],{}," breath markers per clip ranked by expressive priority: exclamations (",[36,688,689],{},"\"까꿍!\""," / peekaboo, weight ",[36,692,693],{},"100",") → child callout (",[36,696,697],{},"95",") → ellipsis (",[36,700,701],{},"85",") → internal sentence breaks (",[36,704,705],{},"75",") → comma boundaries inside clauses longer than 22 characters (",[36,708,709],{},"40",[113,711,713,714,716],{"id":712},"_22-3-tier-speechmetadatastyle-prosody-and-39-clip-audio-mastering","2.2. 3-Tier ",[36,715,130],{}," Prosody and 39-Clip Audio Mastering",[16,718,719,720,723,724,727,728,671,731,734,735,738,739,742],{},"Across ",[20,721,722],{},"13 total pages"," (cover ",[36,725,726],{},"pageIndex: 0"," plus 12 hidden-object spreads), each page generates three interactive clips (",[36,729,730],{},"prompt",[36,732,733],{},"hint",", and ",[36,736,737],{},"found","). That produces ",[20,740,741],{},"39 clips per speaker","—or 78 mastered M4A assets for a two-parent edition—using distinct style directives per interaction state.",[202,744,746],{"className":204,"code":745,"language":206,"meta":207,"style":207},"# ~/workspace/storybook-studio/scripts/audio/gemini_tts_synth.py (3-tier prosody & G2P synthesis)\nimport json\nimport os\nimport urllib.request\n\nACTING_STYLES = {\n    \"prompt\": (\n        \"Warm parent storytelling tone reading a picture book with a toddler on their lap; \"\n        \"gentle smile in the voice, playful curiosity, softly rising inflection on the closing question.\"\n    ),\n    \"hint\": (\n        \"Cozy, reassuring storytelling tone whispering a playful secret clue into a toddler's ear, \"\n        \"articulating clearly with unhurried pauses between phrases.\"\n    ),\n    \"found\": (\n        \"Bright, joyful celebration greeting 'Peekaboo!' when the hidden character is discovered, \"\n        \"followed by warm praise; lively yet soft enough never to startle sensitive toddler ears.\"\n    ),\n    \"bedtime\": (\n        \"Lower-pitched, slower, softly hushed lullaby storytelling tone designed to wind down \"\n        \"after playtime and gently ease a toddler toward sleep.\"\n    ),\n}\n\ndef synthesize_story_clip(\n    normalized_ko: str,\n    clip_type: str,\n    speaker_profile: str = \"PARENT_VOICE_ID\",\n) -> bytes:\n    api_key = os.environ.get(\"GEMINI_API_KEY\", \"YOUR_API_KEY\")\n    payload = {\n        \"contents\": [{\n            \"role\": \"user\",\n            \"parts\": [{\n                \"text\": normalized_ko,  # Korean G2P normalized text with \u003Cshort pause> breath cues\n                \"speechMetadata\": {\"style\": ACTING_STYLES[clip_type]},\n            }],\n        }],\n        \"generationConfig\": {\n            \"responseModalities\": [\"AUDIO\"],\n            \"speechConfig\": {\"voiceConfig\": {\"voice\": speaker_profile}},\n        },\n    }\n    req = urllib.request.Request(\n        f\"https://generativelanguage.googleapis.com/v1beta/models/gemini-3.8-flash-tts:generateContent?key={api_key}\",\n        data=json.dumps(payload).encode(\"utf-8\"),\n        headers={\"Content-Type\": \"application/json\"},\n        method=\"POST\",\n    )\n    with urllib.request.urlopen(req, timeout=60) as resp:\n        return resp.read()\n",[36,747,748,753,758,763,768,772,777,782,787,792,797,802,807,812,816,821,826,831,835,840,845,850,854,859,863,868,873,878,883,888,893,898,903,908,913,918,923,928,933,938,943,948,953,958,963,968,973,978,983,987,992],{"__ignoreMap":207},[211,749,750],{"class":213,"line":214},[211,751,752],{},"# ~/workspace/storybook-studio/scripts/audio/gemini_tts_synth.py (3-tier prosody & G2P synthesis)\n",[211,754,755],{"class":213,"line":220},[211,756,757],{},"import json\n",[211,759,760],{"class":213,"line":226},[211,761,762],{},"import os\n",[211,764,765],{"class":213,"line":232},[211,766,767],{},"import urllib.request\n",[211,769,770],{"class":213,"line":238},[211,771,247],{"emptyLinePlaceholder":6},[211,773,774],{"class":213,"line":244},[211,775,776],{},"ACTING_STYLES = {\n",[211,778,779],{"class":213,"line":250},[211,780,781],{},"    \"prompt\": (\n",[211,783,784],{"class":213,"line":256},[211,785,786],{},"        \"Warm parent storytelling tone reading a picture book with a toddler on their lap; \"\n",[211,788,789],{"class":213,"line":262},[211,790,791],{},"        \"gentle smile in the voice, playful curiosity, softly rising inflection on the closing question.\"\n",[211,793,794],{"class":213,"line":268},[211,795,796],{},"    ),\n",[211,798,799],{"class":213,"line":274},[211,800,801],{},"    \"hint\": (\n",[211,803,804],{"class":213,"line":280},[211,805,806],{},"        \"Cozy, reassuring storytelling tone whispering a playful secret clue into a toddler's ear, \"\n",[211,808,809],{"class":213,"line":286},[211,810,811],{},"        \"articulating clearly with unhurried pauses between phrases.\"\n",[211,813,814],{"class":213,"line":292},[211,815,796],{},[211,817,818],{"class":213,"line":297},[211,819,820],{},"    \"found\": (\n",[211,822,823],{"class":213,"line":303},[211,824,825],{},"        \"Bright, joyful celebration greeting 'Peekaboo!' when the hidden character is discovered, \"\n",[211,827,828],{"class":213,"line":309},[211,829,830],{},"        \"followed by warm praise; lively yet soft enough never to startle sensitive toddler ears.\"\n",[211,832,833],{"class":213,"line":315},[211,834,796],{},[211,836,837],{"class":213,"line":321},[211,838,839],{},"    \"bedtime\": (\n",[211,841,842],{"class":213,"line":327},[211,843,844],{},"        \"Lower-pitched, slower, softly hushed lullaby storytelling tone designed to wind down \"\n",[211,846,847],{"class":213,"line":333},[211,848,849],{},"        \"after playtime and gently ease a toddler toward sleep.\"\n",[211,851,852],{"class":213,"line":339},[211,853,796],{},[211,855,856],{"class":213,"line":345},[211,857,858],{},"}\n",[211,860,861],{"class":213,"line":351},[211,862,247],{"emptyLinePlaceholder":6},[211,864,865],{"class":213,"line":357},[211,866,867],{},"def synthesize_story_clip(\n",[211,869,870],{"class":213,"line":363},[211,871,872],{},"    normalized_ko: str,\n",[211,874,875],{"class":213,"line":369},[211,876,877],{},"    clip_type: str,\n",[211,879,880],{"class":213,"line":374},[211,881,882],{},"    speaker_profile: str = \"PARENT_VOICE_ID\",\n",[211,884,885],{"class":213,"line":380},[211,886,887],{},") -> bytes:\n",[211,889,890],{"class":213,"line":386},[211,891,892],{},"    api_key = os.environ.get(\"GEMINI_API_KEY\", \"YOUR_API_KEY\")\n",[211,894,895],{"class":213,"line":391},[211,896,897],{},"    payload = {\n",[211,899,900],{"class":213,"line":397},[211,901,902],{},"        \"contents\": [{\n",[211,904,905],{"class":213,"line":403},[211,906,907],{},"            \"role\": \"user\",\n",[211,909,910],{"class":213,"line":409},[211,911,912],{},"            \"parts\": [{\n",[211,914,915],{"class":213,"line":415},[211,916,917],{},"                \"text\": normalized_ko,  # Korean G2P normalized text with \u003Cshort pause> breath cues\n",[211,919,920],{"class":213,"line":420},[211,921,922],{},"                \"speechMetadata\": {\"style\": ACTING_STYLES[clip_type]},\n",[211,924,925],{"class":213,"line":426},[211,926,927],{},"            }],\n",[211,929,930],{"class":213,"line":432},[211,931,932],{},"        }],\n",[211,934,935],{"class":213,"line":438},[211,936,937],{},"        \"generationConfig\": {\n",[211,939,940],{"class":213,"line":444},[211,941,942],{},"            \"responseModalities\": [\"AUDIO\"],\n",[211,944,945],{"class":213,"line":450},[211,946,947],{},"            \"speechConfig\": {\"voiceConfig\": {\"voice\": speaker_profile}},\n",[211,949,950],{"class":213,"line":456},[211,951,952],{},"        },\n",[211,954,955],{"class":213,"line":461},[211,956,957],{},"    }\n",[211,959,960],{"class":213,"line":467},[211,961,962],{},"    req = urllib.request.Request(\n",[211,964,965],{"class":213,"line":473},[211,966,967],{},"        f\"https://generativelanguage.googleapis.com/v1beta/models/gemini-3.8-flash-tts:generateContent?key={api_key}\",\n",[211,969,970],{"class":213,"line":479},[211,971,972],{},"        data=json.dumps(payload).encode(\"utf-8\"),\n",[211,974,975],{"class":213,"line":485},[211,976,977],{},"        headers={\"Content-Type\": \"application/json\"},\n",[211,979,980],{"class":213,"line":491},[211,981,982],{},"        method=\"POST\",\n",[211,984,985],{"class":213,"line":497},[211,986,289],{},[211,988,989],{"class":213,"line":503},[211,990,991],{},"    with urllib.request.urlopen(req, timeout=60) as resp:\n",[211,993,994],{"class":213,"line":508},[211,995,996],{},"        return resp.read()\n",[16,998,999],{},"Every synthesized clip passes through an automated mastering and quality verification gate engineered specifically for toddler hearing safety and snappy touch responsiveness:",[1001,1002,1003,1020],"table",{},[1004,1005,1006],"thead",{},[1007,1008,1009,1014,1017],"tr",{},[1010,1011,1013],"th",{"align":1012},"left","Post-Processing Stage",[1010,1015,1016],{"align":1012},"Key Parameters & Thresholds",[1010,1018,1019],{"align":1012},"Engineering Purpose",[1021,1022,1023,1051,1072,1097],"tbody",{},[1007,1024,1025,1031,1044],{},[1026,1027,1028],"td",{"align":1012},[20,1029,1030],{},"Leading Silence Trim",[1026,1032,1033,1035,1036,1039,1040,1043],{"align":1012},[36,1034,737],{}," leading silence ",[36,1037,1038],{},"\u003C= 50 ms"," (",[36,1041,1042],{},"lead_pad = 18 ms",")",[1026,1045,1046,1047,1050],{"align":1012},"Fires ",[36,1048,1049],{},"\"Peekaboo!\""," immediately on tap with zero sluggish vocal lag",[1007,1052,1053,1058,1069],{},[1026,1054,1055],{"align":1012},[20,1056,1057],{},"Toddler-Safe SFX Ducking",[1026,1059,1060,1061,1064,1065,1068],{"align":1012},"Sound effects ",[36,1062,1063],{},"-19 to -24 dB",", ducked ",[36,1066,1067],{},"-22 dB"," under speech",[1026,1070,1071],{"align":1012},"Keeps playful sound cues subordinate to the parent's voice clarity",[1007,1073,1074,1079,1090],{},[1026,1075,1076],{"align":1012},[20,1077,1078],{},"2-Pass EBU R128 Loudness",[1026,1080,1081,671,1084,671,1087],{"align":1012},[36,1082,1083],{},"I=-16 LUFS",[36,1085,1086],{},"TP=-1.5 dBTP",[36,1088,1089],{},"44.1 kHz / 128k M4A",[1026,1091,1092,1093,1096],{"align":1012},"Eliminates abrupt peak spikes across devices and embeds ",[36,1094,1095],{},"+faststart"," atoms",[1007,1098,1099,1104,1114],{},[1026,1100,1101],{"align":1012},[20,1102,1103],{},"Whisper Jamo QA Gate",[1026,1105,1106,1107,671,1110,1113],{"align":1012},"NFD Jamo similarity ",[36,1108,1109],{},"sim >= 0.78",[36,1111,1112],{},"tail >= 0.62",", onset check",[1026,1115,1116],{"align":1012},"Auto-quarantines clipped endings or slurred opening syllables for resynthesis",[69,1118],{},[72,1120,1122,1123,1125],{"id":1121},"_3-7090-occlusion-geometry-and-30-letterbox-inverted-multitouch","3. 70–90% Occlusion Geometry and ",[36,1124,66],{}," Letterbox-Inverted Multitouch",[16,1127,1128,1129,1132],{},"Great audio cannot save an interactive boardbook if the visual composition or touch mechanics fight a toddler's motor skills. Every ",[36,1130,1131],{},"1376×768"," illustration and its web hit-testing layer enforce three quantitative geometry rules.",[133,1134,1135,1145,1183],{},[136,1136,1137,1140,1141,1144],{},[20,1138,1139],{},"Visual Clutter Restraint & 3-Zone Spatial Rotation:"," Toddlers between 12 and 24 months lose figure-ground separation when small props share the same saturation as the hidden character. Background objects are strictly rationed, and hiding spots rotate evenly across ",[20,1142,1143],{},"left, right, and upper-center"," zones so the child cannot game the book by tapping the lower center of every page.",[136,1146,1147,1153,1154,671,1157,1160,1161,1164,1165,1168,1169,1172,1173,1178,1179,1182],{},[20,1148,1149,1150,1152],{},"Foreground Polygon Occlusion Converged to ",[36,1151,62],{}," Visibility:"," Characters are partially tucked behind foreground objects defined via polygon masks (",[36,1155,1156],{},"occlusionPolygons",[36,1158,1159],{},"1.5px"," edge feather) in ",[36,1162,1163],{},"scenes.yaml",". A local compositor measures the post-mask alpha ratio (",[36,1166,1167],{},"alpha >= 32",") and enforces ",[36,1170,1171],{},"visibleRatio"," strictly inside ",[20,1174,1175],{},[36,1176,1177],{},"0.70–0.90","—hidden enough to feel like peekaboo, visible enough for a one-year-old to recognize. Position adjustments run through ",[36,1180,1181],{},"compose-direct -> finalize"," locally at zero generative-image credit cost.",[136,1184,1185,1195,1196,1199,1200,1203,1204,1206,1207,1209,1210,1213],{},[20,1186,1187,1190,1191,1194],{},[36,1188,1189],{},"+30% touchHitbox"," & ",[36,1192,1193],{},"object-fit: contain"," Letterbox Inversion:"," The manifest expands each character's visible bounding box by ",[36,1197,1198],{},"30%"," on all sides into ",[36,1201,1202],{},"touchHitboxNormalized",". Because mobile phones and tablets render ",[36,1205,1131],{}," illustrations inside ",[36,1208,1193],{}," viewports with arbitrary horizontal or vertical letterbox bars, pointer coordinates are algebraically inverted back into normalized ",[36,1211,1212],{},"[0, 1]"," illustration space before hit evaluation.",[202,1215,1219],{"className":1216,"code":1217,"language":1218,"meta":207,"style":207},"language-ts shiki shiki-themes github-light github-dark","// ~/workspace/storybook-studio/web_remote/boardbookHitTest.ts (Letterbox inversion & palm rejection)\nexport interface NormalizedRect {\n  x: number\n  y: number\n  width: number\n  height: number\n}\n\nexport function clientPointToIllustrationNormalized(\n  clientX: number,\n  clientY: number,\n  containerRect: DOMRect,\n  naturalW = 1376,\n  naturalH = 768,\n): { nx: number; ny: number; insideImage: boolean } {\n  const containerRatio = containerRect.width / containerRect.height\n  const imageRatio = naturalW / naturalH\n\n  let renderW = containerRect.width\n  let renderH = containerRect.height\n  let offsetX = containerRect.left\n  let offsetY = containerRect.top\n\n  if (containerRatio > imageRatio) {\n    renderH = containerRect.height\n    renderW = renderH * imageRatio\n    offsetX = containerRect.left + (containerRect.width - renderW) / 2\n  } else {\n    renderW = containerRect.width\n    renderH = renderW / imageRatio\n    offsetY = containerRect.top + (containerRect.height - renderH) / 2\n  }\n\n  const nx = (clientX - offsetX) / renderW\n  const ny = (clientY - offsetY) / renderH\n  return { nx, ny, insideImage: nx >= 0 && nx \u003C= 1 && ny >= 0 && ny \u003C= 1 }\n}\n\nexport function evaluateBoardbookPointerDown(\n  event: PointerEvent,\n  imgEl: HTMLImageElement,\n  hitbox: NormalizedRect,\n): 'found' | 'miss' | 'ignored' {\n  const { nx, ny, insideImage } = clientPointToIllustrationNormalized(\n    event.clientX,\n    event.clientY,\n    imgEl.getBoundingClientRect(),\n    imgEl.naturalWidth || 1376,\n    imgEl.naturalHeight || 768,\n  )\n  if (!insideImage) return 'ignored'\n\n  const hit =\n    nx >= hitbox.x &&\n    nx \u003C= hitbox.x + hitbox.width &&\n    ny >= hitbox.y &&\n    ny \u003C= hitbox.y + hitbox.height\n  if (hit) return 'found'\n\n  // Reject accidental full-palm rests common with toddlers (contact box > 56px)\n  if ((event.width || 0) > 56 || (event.height || 0) > 56) return 'ignored'\n  return 'miss'\n}\n","ts",[36,1220,1221,1227,1244,1257,1266,1275,1284,1288,1292,1305,1318,1329,1341,1354,1366,1405,1423,1440,1444,1458,1469,1481,1493,1497,1511,1520,1535,1562,1572,1580,1592,1616,1621,1625,1647,1669,1715,1719,1723,1734,1746,1758,1769,1792,1817,1822,1827,1838,1850,1861,1866,1884,1888,1898,1911,1926,1938,1951,1963,1968,1974,2016,2024],{"__ignoreMap":207},[211,1222,1223],{"class":213,"line":214},[211,1224,1226],{"class":1225},"sJ8bj","// ~/workspace/storybook-studio/web_remote/boardbookHitTest.ts (Letterbox inversion & palm rejection)\n",[211,1228,1229,1233,1236,1240],{"class":213,"line":220},[211,1230,1232],{"class":1231},"szBVR","export",[211,1234,1235],{"class":1231}," interface",[211,1237,1239],{"class":1238},"sScJk"," NormalizedRect",[211,1241,1243],{"class":1242},"sVt8B"," {\n",[211,1245,1246,1250,1253],{"class":213,"line":226},[211,1247,1249],{"class":1248},"s4XuR","  x",[211,1251,1252],{"class":1231},":",[211,1254,1256],{"class":1255},"sj4cs"," number\n",[211,1258,1259,1262,1264],{"class":213,"line":232},[211,1260,1261],{"class":1248},"  y",[211,1263,1252],{"class":1231},[211,1265,1256],{"class":1255},[211,1267,1268,1271,1273],{"class":213,"line":238},[211,1269,1270],{"class":1248},"  width",[211,1272,1252],{"class":1231},[211,1274,1256],{"class":1255},[211,1276,1277,1280,1282],{"class":213,"line":244},[211,1278,1279],{"class":1248},"  height",[211,1281,1252],{"class":1231},[211,1283,1256],{"class":1255},[211,1285,1286],{"class":213,"line":250},[211,1287,858],{"class":1242},[211,1289,1290],{"class":213,"line":256},[211,1291,247],{"emptyLinePlaceholder":6},[211,1293,1294,1296,1299,1302],{"class":213,"line":262},[211,1295,1232],{"class":1231},[211,1297,1298],{"class":1231}," function",[211,1300,1301],{"class":1238}," clientPointToIllustrationNormalized",[211,1303,1304],{"class":1242},"(\n",[211,1306,1307,1310,1312,1315],{"class":213,"line":268},[211,1308,1309],{"class":1248},"  clientX",[211,1311,1252],{"class":1231},[211,1313,1314],{"class":1255}," number",[211,1316,1317],{"class":1242},",\n",[211,1319,1320,1323,1325,1327],{"class":213,"line":274},[211,1321,1322],{"class":1248},"  clientY",[211,1324,1252],{"class":1231},[211,1326,1314],{"class":1255},[211,1328,1317],{"class":1242},[211,1330,1331,1334,1336,1339],{"class":213,"line":280},[211,1332,1333],{"class":1248},"  containerRect",[211,1335,1252],{"class":1231},[211,1337,1338],{"class":1238}," DOMRect",[211,1340,1317],{"class":1242},[211,1342,1343,1346,1349,1352],{"class":213,"line":286},[211,1344,1345],{"class":1248},"  naturalW",[211,1347,1348],{"class":1231}," =",[211,1350,1351],{"class":1255}," 1376",[211,1353,1317],{"class":1242},[211,1355,1356,1359,1361,1364],{"class":213,"line":292},[211,1357,1358],{"class":1248},"  naturalH",[211,1360,1348],{"class":1231},[211,1362,1363],{"class":1255}," 768",[211,1365,1317],{"class":1242},[211,1367,1368,1370,1372,1375,1378,1380,1382,1385,1388,1390,1392,1394,1397,1399,1402],{"class":213,"line":297},[211,1369,1043],{"class":1242},[211,1371,1252],{"class":1231},[211,1373,1374],{"class":1242}," { ",[211,1376,1377],{"class":1248},"nx",[211,1379,1252],{"class":1231},[211,1381,1314],{"class":1255},[211,1383,1384],{"class":1242},"; ",[211,1386,1387],{"class":1248},"ny",[211,1389,1252],{"class":1231},[211,1391,1314],{"class":1255},[211,1393,1384],{"class":1242},[211,1395,1396],{"class":1248},"insideImage",[211,1398,1252],{"class":1231},[211,1400,1401],{"class":1255}," boolean",[211,1403,1404],{"class":1242}," } {\n",[211,1406,1407,1410,1413,1415,1418,1420],{"class":213,"line":303},[211,1408,1409],{"class":1231},"  const",[211,1411,1412],{"class":1255}," containerRatio",[211,1414,1348],{"class":1231},[211,1416,1417],{"class":1242}," containerRect.width ",[211,1419,634],{"class":1231},[211,1421,1422],{"class":1242}," containerRect.height\n",[211,1424,1425,1427,1430,1432,1435,1437],{"class":213,"line":309},[211,1426,1409],{"class":1231},[211,1428,1429],{"class":1255}," imageRatio",[211,1431,1348],{"class":1231},[211,1433,1434],{"class":1242}," naturalW ",[211,1436,634],{"class":1231},[211,1438,1439],{"class":1242}," naturalH\n",[211,1441,1442],{"class":213,"line":315},[211,1443,247],{"emptyLinePlaceholder":6},[211,1445,1446,1449,1452,1455],{"class":213,"line":321},[211,1447,1448],{"class":1231},"  let",[211,1450,1451],{"class":1242}," renderW ",[211,1453,1454],{"class":1231},"=",[211,1456,1457],{"class":1242}," containerRect.width\n",[211,1459,1460,1462,1465,1467],{"class":213,"line":327},[211,1461,1448],{"class":1231},[211,1463,1464],{"class":1242}," renderH ",[211,1466,1454],{"class":1231},[211,1468,1422],{"class":1242},[211,1470,1471,1473,1476,1478],{"class":213,"line":333},[211,1472,1448],{"class":1231},[211,1474,1475],{"class":1242}," offsetX ",[211,1477,1454],{"class":1231},[211,1479,1480],{"class":1242}," containerRect.left\n",[211,1482,1483,1485,1488,1490],{"class":213,"line":339},[211,1484,1448],{"class":1231},[211,1486,1487],{"class":1242}," offsetY ",[211,1489,1454],{"class":1231},[211,1491,1492],{"class":1242}," containerRect.top\n",[211,1494,1495],{"class":213,"line":345},[211,1496,247],{"emptyLinePlaceholder":6},[211,1498,1499,1502,1505,1508],{"class":213,"line":351},[211,1500,1501],{"class":1231},"  if",[211,1503,1504],{"class":1242}," (containerRatio ",[211,1506,1507],{"class":1231},">",[211,1509,1510],{"class":1242}," imageRatio) {\n",[211,1512,1513,1516,1518],{"class":213,"line":357},[211,1514,1515],{"class":1242},"    renderH ",[211,1517,1454],{"class":1231},[211,1519,1422],{"class":1242},[211,1521,1522,1525,1527,1529,1532],{"class":213,"line":363},[211,1523,1524],{"class":1242},"    renderW ",[211,1526,1454],{"class":1231},[211,1528,1464],{"class":1242},[211,1530,1531],{"class":1231},"*",[211,1533,1534],{"class":1242}," imageRatio\n",[211,1536,1537,1540,1542,1545,1548,1551,1554,1557,1559],{"class":213,"line":369},[211,1538,1539],{"class":1242},"    offsetX ",[211,1541,1454],{"class":1231},[211,1543,1544],{"class":1242}," containerRect.left ",[211,1546,1547],{"class":1231},"+",[211,1549,1550],{"class":1242}," (containerRect.width ",[211,1552,1553],{"class":1231},"-",[211,1555,1556],{"class":1242}," renderW) ",[211,1558,634],{"class":1231},[211,1560,1561],{"class":1255}," 2\n",[211,1563,1564,1567,1570],{"class":213,"line":374},[211,1565,1566],{"class":1242},"  } ",[211,1568,1569],{"class":1231},"else",[211,1571,1243],{"class":1242},[211,1573,1574,1576,1578],{"class":213,"line":380},[211,1575,1524],{"class":1242},[211,1577,1454],{"class":1231},[211,1579,1457],{"class":1242},[211,1581,1582,1584,1586,1588,1590],{"class":213,"line":386},[211,1583,1515],{"class":1242},[211,1585,1454],{"class":1231},[211,1587,1451],{"class":1242},[211,1589,634],{"class":1231},[211,1591,1534],{"class":1242},[211,1593,1594,1597,1599,1602,1604,1607,1609,1612,1614],{"class":213,"line":391},[211,1595,1596],{"class":1242},"    offsetY ",[211,1598,1454],{"class":1231},[211,1600,1601],{"class":1242}," containerRect.top ",[211,1603,1547],{"class":1231},[211,1605,1606],{"class":1242}," (containerRect.height ",[211,1608,1553],{"class":1231},[211,1610,1611],{"class":1242}," renderH) ",[211,1613,634],{"class":1231},[211,1615,1561],{"class":1255},[211,1617,1618],{"class":213,"line":397},[211,1619,1620],{"class":1242},"  }\n",[211,1622,1623],{"class":213,"line":403},[211,1624,247],{"emptyLinePlaceholder":6},[211,1626,1627,1629,1632,1634,1637,1639,1642,1644],{"class":213,"line":409},[211,1628,1409],{"class":1231},[211,1630,1631],{"class":1255}," nx",[211,1633,1348],{"class":1231},[211,1635,1636],{"class":1242}," (clientX ",[211,1638,1553],{"class":1231},[211,1640,1641],{"class":1242}," offsetX) ",[211,1643,634],{"class":1231},[211,1645,1646],{"class":1242}," renderW\n",[211,1648,1649,1651,1654,1656,1659,1661,1664,1666],{"class":213,"line":415},[211,1650,1409],{"class":1231},[211,1652,1653],{"class":1255}," ny",[211,1655,1348],{"class":1231},[211,1657,1658],{"class":1242}," (clientY ",[211,1660,1553],{"class":1231},[211,1662,1663],{"class":1242}," offsetY) ",[211,1665,634],{"class":1231},[211,1667,1668],{"class":1242}," renderH\n",[211,1670,1671,1674,1677,1680,1683,1686,1689,1692,1695,1697,1700,1702,1704,1706,1708,1710,1712],{"class":213,"line":420},[211,1672,1673],{"class":1231},"  return",[211,1675,1676],{"class":1242}," { nx, ny, insideImage: nx ",[211,1678,1679],{"class":1231},">=",[211,1681,1682],{"class":1255}," 0",[211,1684,1685],{"class":1231}," &&",[211,1687,1688],{"class":1242}," nx ",[211,1690,1691],{"class":1231},"\u003C=",[211,1693,1694],{"class":1255}," 1",[211,1696,1685],{"class":1231},[211,1698,1699],{"class":1242}," ny ",[211,1701,1679],{"class":1231},[211,1703,1682],{"class":1255},[211,1705,1685],{"class":1231},[211,1707,1699],{"class":1242},[211,1709,1691],{"class":1231},[211,1711,1694],{"class":1255},[211,1713,1714],{"class":1242}," }\n",[211,1716,1717],{"class":213,"line":426},[211,1718,858],{"class":1242},[211,1720,1721],{"class":213,"line":432},[211,1722,247],{"emptyLinePlaceholder":6},[211,1724,1725,1727,1729,1732],{"class":213,"line":438},[211,1726,1232],{"class":1231},[211,1728,1298],{"class":1231},[211,1730,1731],{"class":1238}," evaluateBoardbookPointerDown",[211,1733,1304],{"class":1242},[211,1735,1736,1739,1741,1744],{"class":213,"line":444},[211,1737,1738],{"class":1248},"  event",[211,1740,1252],{"class":1231},[211,1742,1743],{"class":1238}," PointerEvent",[211,1745,1317],{"class":1242},[211,1747,1748,1751,1753,1756],{"class":213,"line":450},[211,1749,1750],{"class":1248},"  imgEl",[211,1752,1252],{"class":1231},[211,1754,1755],{"class":1238}," HTMLImageElement",[211,1757,1317],{"class":1242},[211,1759,1760,1763,1765,1767],{"class":213,"line":456},[211,1761,1762],{"class":1248},"  hitbox",[211,1764,1252],{"class":1231},[211,1766,1239],{"class":1238},[211,1768,1317],{"class":1242},[211,1770,1771,1773,1775,1779,1782,1785,1787,1790],{"class":213,"line":461},[211,1772,1043],{"class":1242},[211,1774,1252],{"class":1231},[211,1776,1778],{"class":1777},"sZZnC"," 'found'",[211,1780,1781],{"class":1231}," |",[211,1783,1784],{"class":1777}," 'miss'",[211,1786,1781],{"class":1231},[211,1788,1789],{"class":1777}," 'ignored'",[211,1791,1243],{"class":1242},[211,1793,1794,1796,1798,1800,1802,1804,1806,1808,1811,1813,1815],{"class":213,"line":467},[211,1795,1409],{"class":1231},[211,1797,1374],{"class":1242},[211,1799,1377],{"class":1255},[211,1801,671],{"class":1242},[211,1803,1387],{"class":1255},[211,1805,671],{"class":1242},[211,1807,1396],{"class":1255},[211,1809,1810],{"class":1242}," } ",[211,1812,1454],{"class":1231},[211,1814,1301],{"class":1238},[211,1816,1304],{"class":1242},[211,1818,1819],{"class":213,"line":473},[211,1820,1821],{"class":1242},"    event.clientX,\n",[211,1823,1824],{"class":213,"line":479},[211,1825,1826],{"class":1242},"    event.clientY,\n",[211,1828,1829,1832,1835],{"class":213,"line":485},[211,1830,1831],{"class":1242},"    imgEl.",[211,1833,1834],{"class":1238},"getBoundingClientRect",[211,1836,1837],{"class":1242},"(),\n",[211,1839,1840,1843,1846,1848],{"class":213,"line":491},[211,1841,1842],{"class":1242},"    imgEl.naturalWidth ",[211,1844,1845],{"class":1231},"||",[211,1847,1351],{"class":1255},[211,1849,1317],{"class":1242},[211,1851,1852,1855,1857,1859],{"class":213,"line":497},[211,1853,1854],{"class":1242},"    imgEl.naturalHeight ",[211,1856,1845],{"class":1231},[211,1858,1363],{"class":1255},[211,1860,1317],{"class":1242},[211,1862,1863],{"class":213,"line":503},[211,1864,1865],{"class":1242},"  )\n",[211,1867,1868,1870,1872,1875,1878,1881],{"class":213,"line":508},[211,1869,1501],{"class":1231},[211,1871,1039],{"class":1242},[211,1873,1874],{"class":1231},"!",[211,1876,1877],{"class":1242},"insideImage) ",[211,1879,1880],{"class":1231},"return",[211,1882,1883],{"class":1777}," 'ignored'\n",[211,1885,1886],{"class":213,"line":514},[211,1887,247],{"emptyLinePlaceholder":6},[211,1889,1890,1892,1895],{"class":213,"line":520},[211,1891,1409],{"class":1231},[211,1893,1894],{"class":1255}," hit",[211,1896,1897],{"class":1231}," =\n",[211,1899,1900,1903,1905,1908],{"class":213,"line":526},[211,1901,1902],{"class":1242},"    nx ",[211,1904,1679],{"class":1231},[211,1906,1907],{"class":1242}," hitbox.x ",[211,1909,1910],{"class":1231},"&&\n",[211,1912,1913,1915,1917,1919,1921,1924],{"class":213,"line":532},[211,1914,1902],{"class":1242},[211,1916,1691],{"class":1231},[211,1918,1907],{"class":1242},[211,1920,1547],{"class":1231},[211,1922,1923],{"class":1242}," hitbox.width ",[211,1925,1910],{"class":1231},[211,1927,1928,1931,1933,1936],{"class":213,"line":538},[211,1929,1930],{"class":1242},"    ny ",[211,1932,1679],{"class":1231},[211,1934,1935],{"class":1242}," hitbox.y ",[211,1937,1910],{"class":1231},[211,1939,1940,1942,1944,1946,1948],{"class":213,"line":544},[211,1941,1930],{"class":1242},[211,1943,1691],{"class":1231},[211,1945,1935],{"class":1242},[211,1947,1547],{"class":1231},[211,1949,1950],{"class":1242}," hitbox.height\n",[211,1952,1953,1955,1958,1960],{"class":213,"line":549},[211,1954,1501],{"class":1231},[211,1956,1957],{"class":1242}," (hit) ",[211,1959,1880],{"class":1231},[211,1961,1962],{"class":1777}," 'found'\n",[211,1964,1966],{"class":213,"line":1965},59,[211,1967,247],{"emptyLinePlaceholder":6},[211,1969,1971],{"class":213,"line":1970},60,[211,1972,1973],{"class":1225},"  // Reject accidental full-palm rests common with toddlers (contact box > 56px)\n",[211,1975,1977,1979,1982,1984,1986,1989,1991,1994,1997,2000,2002,2004,2006,2008,2010,2012,2014],{"class":213,"line":1976},61,[211,1978,1501],{"class":1231},[211,1980,1981],{"class":1242}," ((event.width ",[211,1983,1845],{"class":1231},[211,1985,1682],{"class":1255},[211,1987,1988],{"class":1242},") ",[211,1990,1507],{"class":1231},[211,1992,1993],{"class":1255}," 56",[211,1995,1996],{"class":1231}," ||",[211,1998,1999],{"class":1242}," (event.height ",[211,2001,1845],{"class":1231},[211,2003,1682],{"class":1255},[211,2005,1988],{"class":1242},[211,2007,1507],{"class":1231},[211,2009,1993],{"class":1255},[211,2011,1988],{"class":1242},[211,2013,1880],{"class":1231},[211,2015,1883],{"class":1777},[211,2017,2019,2021],{"class":213,"line":2018},62,[211,2020,1673],{"class":1231},[211,2022,2023],{"class":1777}," 'miss'\n",[211,2025,2027],{"class":213,"line":2026},63,[211,2028,858],{"class":1242},[16,2030,2031,2032,2035,2036,2039,2040,2042],{},"With full-palm contacts (",[36,2033,2034],{},"> 56px",") filtered out, three consecutive valid misses (debounced at ",[36,2037,2038],{},"300ms",") illuminate a subtle visual hint ring around the hiding spot and automatically play the second-tier ",[36,2041,733],{}," clip—guiding the toddler to a self-directed discovery.",[69,2044],{},[72,2046,2048,2049,2052],{"id":2047},"_4-low-glare-oled-dark-sound-remote-nfc-deep-links-and-ios-http-206-range","4. Low-Glare OLED Dark Sound Remote, NFC Deep Links, and iOS HTTP ",[36,2050,2051],{},"206"," Range",[16,2054,2055,2056,2059],{},"One of the highest-value real-world scenarios is ",[20,2057,2058],{},"reading the physical paper boardbook together while a smartphone acts solely as a silent companion sound remote",". A bright white web UI sitting beside the book instantly steals a toddler's gaze away from the printed pages.",[619,2061,2062,2101,2127],{},[136,2063,2064,2067,2068,2071,2072,683,2075,2078,2079,2082,2083,2086,2087,2090,2091,671,2094,734,2097,2100],{},[20,2065,2066],{},"Low-Stimulus OLED Darkroom UI:"," The remote renders on a matte-black ",[36,2069,2070],{},"#16181B"," surface using ",[36,2073,2074],{},"\u003C1%",[36,2076,2077],{},"#E8661A"," signal accents to minimize screen luminance. Everything fits cleanly inside a ",[36,2080,2081],{},"390×844"," mobile viewport—a ",[36,2084,2085],{},"[Mom's Voice]"," / ",[36,2088,2089],{},"[Dad's Voice]"," dynamic switcher plus ",[36,2092,2093],{},"[Prompt]",[36,2095,2096],{},"[Hint]",[36,2098,2099],{},"[Peekaboo!]"," triggers—with zero text overlays on illustrations.",[136,2102,2103,2112,2113,2115,2116,2119,2120,2123,2124,90],{},[20,2104,2105,683,2108,2111],{},[36,2106,2107],{},"AudioContext",[36,2109,2110],{},"\u003C100 ms"," Trigger & NFC Deep Linking:"," Entering a spread pre-decodes its active M4A audio into ",[36,2114,2107],{}," memory buffers so button taps fire in under ",[36,2117,2118],{},"100 ms",". Tapping a paper page's embedded NFC tag (",[36,2121,2122],{},"https://storybook-remote.example.com/?scene=03&clip=prompt",") jumps straight to that scene and clip, then cleans up query parameters via ",[36,2125,2126],{},"history.replaceState",[136,2128,2129,2139,2140,2143,2144,2147,2148,671,2151,671,2154,734,2157,2160,2161,2163],{},[20,2130,2131,2132,2134,2135,2138],{},"iOS Safari HTTP ",[36,2133,2051],{}," Range & ",[36,2136,2137],{},"./"," Relative Paths:"," Mobile Safari ",[36,2141,2142],{},"\u003Caudio>"," playback stalls silently unless the media server answers its initial ",[36,2145,2146],{},"Range: bytes=0-1"," probe with a compliant ",[36,2149,2150],{},"206 Partial Content",[36,2152,2153],{},"Accept-Ranges: bytes",[36,2155,2156],{},"Content-Range",[36,2158,2159],{},"Access-Control-Expose-Headers",". To survive subpath reverse-proxy deployments cleanly, every static asset and API request is normalized to ",[36,2162,2137],{}," relative paths.",[69,2165],{},[72,2167,2169],{"id":2168},"_5-single-ssot-300-dpi-a4-landscape-dual-pdf-builds-with-cache-busting","5. Single-SSOT 300 DPI A4 Landscape Dual PDF Builds with Cache Busting",[16,2171,2172,2173,566,2176,2179,2180,2183],{},"While the web boardbook and sound remote consume ",[36,2174,2175],{},"scenes_manifest.json",[36,2177,2178],{},"audio_manifest.json",", the print publishing pipeline reads the exact same SSOT to produce ",[20,2181,2182],{},"two press-ready 300 DPI PDFs",". Early in development, one particularly insidious bug surfaced: after tweaking a character's occlusion mask and overwriting the scene PNG, headless Chromium's HTML-to-PDF renderer kept printing the old cached PNG into the new PDF.",[133,2185,2186,2207,2220],{},[136,2187,2188,2191,2192,2195,2196,2199,2200,671,2203,2206],{},[20,2189,2190],{},"Destructive Pre-Clean & Forced 300 DPI Regeneration:"," Every build begins by removing stale PDF outputs with ",[36,2193,2194],{},"rm -f"," and invoking ",[36,2197,2198],{},"upscaleCleanPrintPages(force=true)"," to regenerate full A4 landscape 300 DPI plates (",[36,2201,2202],{},"297×210 mm",[36,2204,2205],{},"3508×2480 px",") unconditionally.",[136,2208,2209,2215,2216,2219],{},[20,2210,2211,2214],{},[36,2212,2213],{},"file://...?t=\u003Cepoch_ms>"," Cache Busting:"," Every local image URL injected into Chromium's print HTML receives a fresh millisecond epoch query string (",[36,2217,2218],{},"?t=1764720000000","), completely neutralizing Chromium's internal resource cache.",[136,2221,2222,2225,2226,2233,2234,2240,2241,2244],{},[20,2223,2224],{},"Dual Edition Output & Full-Page QA Contact Sheet:"," A single run builds both the ",[20,2227,2228,2229,2232],{},"Picture-Only Boardbook (",[36,2230,2231],{},"13p",", text-free)","—ideal for parent improvisation alongside the sound remote—and the ",[20,2235,2236,2237,1043],{},"Storybook Edition (",[36,2238,2239],{},"15p"," complete with single-line narration scripts and a parent answer/reading guide appendix. Immediately afterward, the builder rasterizes every printed page back into ",[36,2242,2243],{},"all_12_scenes_qa_sheet.png"," to audit margins and trim marks.",[92,2246,2247],{},[16,2248,2249,2251,2252,2255],{},[20,2250,98],{}," macOS Preview.app and Adobe Acrobat also cache open file buffers by filesystem path when a PDF is overwritten in place. Always fully quit (",[36,2253,2254],{},"Cmd+Q",") the PDF viewer before reopening a freshly compiled print artifact to verify the true latest output.",[69,2257],{},[72,2259,2261],{"id":2260},"wrapping-up-bridging-a-toddlers-gaze-and-parents-voices-in-one-data-model","Wrapping Up: Bridging a Toddler's Gaze and Parents' Voices in One Data Model",[16,2263,2264,2265,2267,2268,2270],{},"Integrating ",[36,2266,38],{}," voice cloning, Korean G2P normalization, ",[36,2269,62],{}," occlusion geometry, 300 DPI dual print PDFs, and a low-glare OLED sound remote around a single SSOT surfaced four engineering lessons:",[133,2272,2273,2288,2303,2321],{},[136,2274,2275,2278,2279,2281,2282,2284,2285,2287],{},[20,2276,2277],{},"Decouple timbre capture from vocal acting for reliable voice cloning:"," Calm adult chest-voice one-take recordings (",[36,2280,561],{},") paired with zero-click silence splitting eliminated ",[36,2283,58],{}," false positives entirely, while ",[36,2286,130],{}," delivered consistent 3-tier prosody across all 39 clips.",[136,2289,2290,2293,2294,2296,2297,2299,2300,2302],{},[20,2291,2292],{},"Pair Korean G2P preprocessing with back-transcription QA:"," Resolving ",[607,2295,609],{},"-dependent particles, normalizing high-risk pronunciation, capping ",[36,2298,601],{}," cues, and gating synthesis with Whisper NFD Jamo verification (",[36,2301,1109],{},") caught slurred onsets and truncated tails automatically.",[136,2304,2305,2308,2309,2311,2312,2314,2315,2317,2318,2320],{},[20,2306,2307],{},"Design toddler touch physics around geometry, not guesswork:"," Converging polygon occlusion to ",[36,2310,62],{},", expanding touch targets by ",[36,2313,66],{},", inverting ",[36,2316,1193],{}," letterbox math, and rejecting ",[36,2319,2034],{}," palm contacts made the web boardbook genuinely playable by 12-to-24-month-olds.",[136,2322,2323,2326,2327,2329,2330,2332,2333,2335],{},[20,2324,2325],{},"Lock print and digital editions together with SSOT manifests and hard cache busting:"," Combining ",[36,2328,2213],{}," 300 DPI PDF regeneration with ",[36,2331,2137],{},"-relative, ",[36,2334,2150],{},"-compliant dark sound remotes guarantees that paper pages and voice triggers never drift out of sync.",[16,2337,2338,2339,90],{},"Full architecture specifications and deliverable breakdowns are also documented on the ",[48,2340,2341],{"href":50},"AI Voice Cloning & Print-to-Web Interactive Boardbook Studio project page",[2343,2344,2345],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}",{"title":207,"searchDepth":220,"depth":220,"links":2347},[2348,2352,2358,2360,2362,2363],{"id":74,"depth":220,"text":2349,"children":2350},"1. Solving VR_TAKEDOWN False Positives via One-Take Declarative Splitting",[2351],{"id":115,"depth":226,"text":116},{"id":583,"depth":220,"text":584,"children":2353},[2354,2356],{"id":597,"depth":226,"text":2355},"2.1. Korean Standard Pronunciation G2P Layer and \u003Cshort pause> Breath Control",{"id":712,"depth":226,"text":2357},"2.2. 3-Tier speechMetadata.style Prosody and 39-Clip Audio Mastering",{"id":1121,"depth":220,"text":2359},"3. 70–90% Occlusion Geometry and +30% Letterbox-Inverted Multitouch",{"id":2047,"depth":220,"text":2361},"4. Low-Glare OLED Dark Sound Remote, NFC Deep Links, and iOS HTTP 206 Range",{"id":2168,"depth":220,"text":2169},{"id":2260,"depth":220,"text":2261},"Gemini TTS Voice Cloning · Korean G2P · 300 DPI Dual Boardbook","tech","/images/content-images/blog/20261203-Gemini-TTS-Interactive-Boardbook-Pipeline/20261203-Gemini-TTS-Interactive-Boardbook-Pipeline001.jpg","Editorial cover on a matte-black darkroom background illustrating the 4-stage pipeline: Gemini TTS parent voice cloning troubleshooting, Korean G2P with 3-tier prosody across 39 clips, 70-90% occlusion geometry, and 300 DPI dual PDFs plus dark sound remote","2026-12-03","Solving Gemini TTS VR_TAKEDOWN false positives, Korean G2P and 39-clip prosody, 70-90% occlusion hitboxes, and a 300 DPI dual PDF + dark sound remote SSOT.","md",null,{},false,"/en/blog/20261203-gemini-tts-interactive-boardbook-pipeline","interactive-sound-boardbook-studio",{"title":5,"description":2369},"published","en/blog/20261203-Gemini-TTS-Interactive-Boardbook-Pipeline",[2380,2381,2382,2383,2384],"Gemini TTS","Voice Cloning","Korean G2P","Web Audio","Print PDF","VwHc06-rqAs7MHsTkoRDlMlXEF--KpMFFE6KoOg9jAk",{"path":50,"title":2387,"subtitle":2388,"track":2389,"liveUrl":2371,"liveLabel":2371,"date":2368,"status":2377},"AI Voice-Cloned & Print-to-Web Interactive Boardbook Studio","Single-SSOT multimodal studio simultaneously producing 70–90% occlusion peek-a-boo scenes, 39-clip Korean G2P parent-cloned narration, 300 DPI A4 landscape dual PDFs, and an OLED dark sound remote","ai-rnd","/blog/20261203-gemini-tts-interactive-boardbook-pipeline",[2392,2371],{"title":2393,"path":2394,"stem":2395,"date":2396,"status":2377,"noindex":2373,"children":-1},"Hybrid Search Across 34,050 Photos & Book Plates with a 0ms Progressive Lightbox","/en/blog/20261129-hybrid-photo-search-zero-ms-lightbox","en/blog/20261129-Hybrid-Photo-Search-Zero-Ms-Lightbox","2026-11-29",1796290674692]