Skip to content

Decision Polly Voice

Reese Hodge edited this page Nov 13, 2026 · 9 revisions

Decision: Polly Voice

Context

Max Height's voice must be cloud-provided, budget-aware, and legally safer than voice cloning. plan.md sets Amazon Polly Neural as the primary TTS service, and research.md R4 selects the concrete voice and audio-processing split.

Voice is part of the user experience and part of the budget. The related fallback behavior is recorded separately on Decision-Browser-TTS-Fallback, and the audio processing chain is summarized on Component-Audio-Chain.

Decision

Use Amazon Polly Neural, US English voice Matthew, as the primary Max Height TTS voice.

Concrete source values:

Item Source value
Primary voice Matthew
Engine Amazon Polly Neural
Language US English
SSML rate <prosody rate="105%">
Pitch treatment Client-side DSP, not Polly SSML pitch
EQ treatment R4 target: 4-6 kHz; current fixed response peaks near 3.34 kHz at 44.1 kHz (see Component-Audio-Chain)
Alternate voice for A/B testing Gregory
Polly Neural price $16.00 / 1,000,000 characters
Standard Polly comparison $4.00 / 1,000,000 characters
Generative Polly comparison $30.00 / 1,000,000 characters
Viseme support 13-14 US English visemes
Viseme timing accuracy +/- 50-100 ms

The implementation uses a dual-call architecture: audio MP3 plus viseme JSON, run with Promise.all(). Both calls are billed by character count.

The engine changes to Standard (decided 2026-11-13, not yet built). To bring the first deployment under budget, the builder chose Polly Standard, voice Matthew: $4 per 1M characters against Neural's $16. AWS's voice table lists a Standard Matthew, so the voice is kept. Spec 003 records it as constitution amendment A6 (1.7.0) on the 003-architecture-review branch, which takes effect for main when that branch merges. Until then the shipped greetings and code are still Neural. Standard Matthew has not been heard: spec 003's T158 probe is the first listen, and failing by ear reopens the choice. See Source-Amazon-Polly § Voices by engine.

IAM is not a voice selector. Checked 2026-11-07 against AWS's service authorization reference: polly:Engine and polly:VoiceId are not supported IAM condition keys. The synthesis grant can be Region-scoped; Matthew/Neural are request settings. See Source-Amazon-Polly and Concept-Credential-Hygiene before preparing audition credentials.

Consequences

Polly gives Max a consistent primary voice without cloning a performer or shipping local voice models. That supports Concept-Cloud-Only-Inference and the project's IP posture.

Polly Neural has partial SSML support. R4 says <break>, <say-as>, and <phoneme> are available, but <prosody> accepts only volume and rate; it does not accept pitch, and <emphasis> is unavailable. Unsupported SSML in a Neural request is rejected, so pitch is applied during playback instead.

R0's per-reply assumption is up to ~1,000 characters: $0.016 for one Polly request. Its old 50-turn $0.80 calculation counted audio only. R4's $0.20-$0.80/month projection does count two calls at ~200 characters per response, but does not specify monthly turn count and is not consistent with R0's 500-character average. Neither is a verified monthly forecast. The 50-turn session caps are not bound to an authenticated caller (#55), so they cannot themselves guarantee the $10/month ceiling. See Concept-Budget-Ceiling and #47.

Two corrections to that estimate

Checked against AWS's own pricing page on 2026-09-29 (see Source-Amazon-Polly), the spec's figure is wrong in both directions:

  • Two requests per reply. Speech Marks requests are billed per character at the same rate as speech. One 50-turn session of max-length replies is 100,000 billed characters and $1.60 before any free-tier allowance, not $0.80. This is a per-session scenario, not "worst case per month".
  • Free-tier eligibility is account-specific. Neural covers up to 1M characters/month for the account's first 12 months. An eligible account with remaining allowance would pay $0 for that example session. Neither account age nor consumption was verified here.

Standard's 5M/month free tier has no such time limit; Neural's does. Actual monthly cost depends on the number and length of sessions, total usage across the account, and tier eligibility; $1.60 is not a monthly upper bound. #47 owns the voice-path cost and unused-viseme follow-up, while #48 evaluates a different speech architecture rather than changing this path.

Alternatives considered

Alternative Rejected because
Stephen Sharper articulation, but less warmth for the intended broadcaster tone.
ElevenLabs Much more expensive and raises voice-cloning/IP concerns.
Google Cloud TTS More expensive than Polly Neural in the cited comparison.
Amazon Nova Sonic Not a like-for-like alternative — it is speech-to-speech, so it would replace speech input and the text model too. Researched 2026-09-29, not evaluated as a decision; see Source-Nova-Sonic.

Open problem: written stutters are spelled out

Recorded 2026-11-02, from the builder listening to the greeting MP3s. The builder ran the isolated three-pronunciation probe on 2026-11-07, preferred IPA schwa, and after further auditions chose rapid pacing, now shipped (see the decision below).

Symptom. Max says "b b ball" (letter names) instead of "buh-buh-ball".

Original cause (code checked 2026-11-02). Stutters reached Polly as literal hyphenated text, and Polly reads a lone letter as its name. The hand-tuned greeting SSML (packages/frontend/scripts/greetingSsml.ts) has b-b-buffering, L-l-ladies, p-pixels. systemPrompt.ts tells the model to write M-m-m-Max and W-w-welcome, and stutterInjection.ts injects the same forms. The planned server-side Polly path (spec 003 T029) would inherit the problem on every reply unless it uses the prepared transform.

Speech marks are not the fix. Marks are timing and mouth-shape output. They never change how the audio sounds. They also bill like speech, roughly doubling Polly's per-reply cost (see Concept-Budget-Ceiling).

Phonetic fix, shipped with rapid pacing. The tested stutterToSsml rewrites X-x-word into phonetic onsets, shared by the greeting generator and T029:

  • <phoneme alphabet="ipa" ph="bə">b</phoneme>, or
  • <sub alias="buh">b</sub>.

Alternatively or additionally, the browser's stutterProcessor.ts worklet was meant to replay about 50 ms of audio, but its replay is broken and it has no app trigger callers. Playback replays now come from the glitch engine; see Component-Audio-Chain.

Docs check (2026-11-02, re-read 2026-11-07, Polly Developer Guide). Verified from AWS's pages, not by listening:

  • <phoneme> and <sub> are both fully available on Neural voices (Supported SSML tags, phoneme, sub). Unsupported tags in Neural return an error, so a wrong tag fails loudly.
  • <phoneme> takes alphabet (ipa or x-sampa) and ph. The en-US table (phoneme table) lists IPA b, d, f, ɡ, k, l, m, p, s, t, w, the schwa ə ("arena") and the strut vowel ʌ, so bə and bʌ are valid. The table is written for Matthew's language, en-US.
  • <say-as interpret-as="characters"> is not an option. Neural does not support it: the sentence is synthesized with the Standard voice but billed as Neural.
  • <sub alias="..."> substitutes a word for the text; the docs show only acronym examples; the initial audition tested "buh" against phonetic onsets and the builder preferred schwa.

First probe complete (builder feedback, 2026-11-07). All three clips were generated and heard; schwa sounded best. Its current syllables and overall delivery were too slow. Faster nested prosody and final client naturalness still need the next generation and listening, not an inference from tag support.

Process. A bug fix to existing behavior: no new spec, no separate issue. It is tracked as spec 003 task T158 and fixed on the 003-architecture-review branch with the architecture refactor. TDD applies (a failing test for the transform first), then regenerate the greetings and listen. T081 deletes pollyTts.ts, so the shared transform was placed elsewhere and the generator's import was moved during experiment preparation.

First audition and faster comparison — 2026-11-07

The builder chose exaggerated glitches with the original dialogue preserved, initially deferred AWS generation, then ran the first experiment. The 16 authored SSML entries now have stronger repeats; the shipped MP3s and manifest still describe the old recordings. This is preparation, not a claim that the new voice sounds right.

The existing command supports generate:greetings --experiment --only greeting-015 --dry-run. Its dry run prints schwa, strut and alias SSML without AWS calls or file writes. Omitting --dry-run, after approval and temporary credential setup, writes three clips under packages/frontend/.greeting-experiment/, outside public, without changing the production manifest. The shared module lives at packages/agent/src/voice/ssml.ts; it has no AWS or browser dependencies and is ready for T029. greetingGenCore.ts no longer imports pollyTts.ts, clearing the T081 deletion hazard.

The initial trial used 100 ms pauses between single-consonant onsets. Schwa is now preferred, but this pacing is not approved. Vowel prefixes and multi-letter syllable glitches are not handled by this experiment; hard c/g mappings suit the current greetings, not arbitrary English pronunciation.

New duration trap, caught by a failing regression. The old generator wrote MP3s before calling calibrateDurations. Rejecting an overlong greeting could therefore leave new audio beside old manifest durations. It now synthesizes and measures the selected pool, validates all durations, and only then writes production audio. Auditions retain overlong clips and flag them for re-tuning; they never update production durations.

Use docs/audio-plan.md § T158 for commands, the conservative spend estimate and listening checklist. Listen through the existing pitch/EQ audio chain, then check the near-ceiling greeting-005 and a non-b greeting before accepting delivery. See Source-Audio-Plan and Contract-Greeting-Manifest. T158 stays open until that work and final regeneration finish.

Measured greeting-015 durations are 16992 ms alias, 16560 ms schwa, 16344 ms strut, versus 12792 ms shipped. All first trials exceed the unchanged 15000 ms ceiling. The source plan also records format, overall dialogue WPM and raw/reconstructed DSP peak/RMS, without claiming human acceptance.

The second audition measured 15408 ms for pace-faster and 14976 ms for pace-snappy. The builder preferred snappy, approved its normal speech speed, and requested faster stuttering only. Snappy has just 24 ms of headroom.

The latest --pace-experiment --only greeting-015 generated pace-snappier (20 ms onset gaps) and pace-rapid (no inserted gaps); both kept 115% normal speech and onset-only x-fast.

Decision: rapid is the production pacing (builder, 2026-11-07). The builder listened and chose pace-rapid ("almost too fast"). It is now the default SpeechPacing in packages/agent/src/voice/ssml.ts and buildGreetingSsml (code at f2c769d on 003-architecture-review), and all 16 production greeting MP3s were regenerated with manifest durations calibrated to 8424–14736 ms, inside the 1000–15000 ms bounds with no clamping.

Measured greeting-015 durations behind that choice:

Trial Duration
pace-snappier (20 ms gaps) 14784 ms
pace-onset-180 (onset rate 180%) 14544 ms
pace-onset-200 (onset rate 200%) 14424 ms
pace-rapid (no gaps) 12288 ms

The gaps, not the onset rate, set stutter speed. Raising the onset rate from x-fast to 200% (Polly's ceiling) saved only 360 ms, while removing the 20 ms <break> tags saved about 2.5 s, far more than their stated length. That suggests Polly renders each break much longer than written; this is an inference from durations, not checked by speech marks or listening. A final pace-gap-5ms trial (rapid plus 5 ms gaps) was not better, so rapid stays. Whether a nested prosody rate is relative to the 115% outer rate or absolute is also unverified. Still open: in-app listening through the playback chain and the greeting-005 and non-b checks. See Source-Amazon-Polly for voice-dependent rate controls and Source-Audio-Plan for the commands.

Status/verification

Verified against research.md R4 and plan.md on 2026-09-26; rates and free tier re-verified against AWS's pricing page on 2026-09-29. The exact browser fallback parameters are intentionally different from Polly DSP values; see Decision-Browser-TTS-Fallback before comparing pitch numbers.

Clone this wiki locally