Project Info
π
Inspiration
Picture this. You're at dinner with your family. Your daughter tells a joke. You laugh β but the only voice you can use to say "that's funny" sounds like a GPS. Your mom asks how you're feeling. You want to say "a little tired, but okay." By the time you've tapped it out on a stiff menu of pre-built phrases, the conversation has moved on. When the voice finally speaks, it sounds flat β like a stranger reading your words. You wanted to tell your dad you love him before bed. The robot did it for you. This is the daily reality for roughly \(97{,}000{,}000\) people worldwide who rely on augmentative and alternative communication (AAC): \(2\text{M}+\) Americans with aphasia after stroke β thought intact, retrieval broken \(\sim 30{,}000\) Americans with ALS β losing the voice they once had, progressively \(\frac{1}{36}\) children diagnosed with autism (CDC, 2023) β roughly \(30\%\) minimally verbal \(1\text{M}+\) with cerebral palsy whose motor variability makes typing painful The tools they're given today were designed in the 1990s. The voices sound robotic. The menus take minutes to navigate. The emotion is completely missing. We built Cadence because "I love you" should never sound like a GPS announcement. π What It Does Cadence is a real-time AAC tool. Four live AI agents turn a heard conversation into a reply spoken in your own cloned voice, with the right feeling, in seconds β using ElevenLabs Instant Voice Cloning + emotion-tuned voice_settings for the output. The full loop: $$ \text{partner speech} \;\rightarrow\; \text{Listener (Deepgram)} \;\rightarrow\; \text{transcript} \;\rightarrow\; \text{Tiles + Memory} \;\rightarrow\; \text{tile grid} \;\rightarrow\; \text{taps} \;\rightarrow\; \text{Generator} \;\rightarrow\; {c_1, c_2, c_3} \;\rightarrow\; \text{pick} \;\rightarrow\; \text{ElevenLabs} \;\rightarrow\; \text{your voice} $$ Each candidate \(c_i\) is a tuple: $$ c_i = (\text{text}i,\ e_i,\ \mathbf{S}{e_i}) $$ where \(e_i\) is one of 13 emotion labels and \(\mathbf{S}_{e_i}\) is the hand-tuned ElevenLabs voice_settings vector for that emotion. π§ How We Built It Four AI agents + a Memory layer + a Voice layer Four decision-making AI agents β Listener, Tiles, Suggester, Generator β coordinate over a Redis memory layer, with ElevenLabs as the voice output layer. ElevenLabs Voice Cloning β the identity layer For users who can still speak (ALS pre-diagnosis, autistic adults, anyone before a stroke), we record \(\sim 60\) seconds of phoneme-balanced Harvard Sentences in the browser and POST to ElevenLabs Instant Voice Cloning. The returned voice_id is stored per-session in Redis under cadence:session:{sid}:voice so it survives page refresh. From that moment, every TTS call uses the user's voice, not a stock voice. Latency budget Cadence has to feel as fast as natural conversation: $$ T_{\text{total}} = T_{\text{stt}} + T_{\text{generate}} + T_{\text{select}} + T_{\text{tts}} $$ Empirically: \(T_{\text{stt}} \approx 200\text{ms}\), \(T_{\text{generate}} \approx 600\text{ms}\), \(T_{\text{tts}} \approx 700\text{ms}\). ElevenLabs is tuned for low first-byte latency: output_format=mp3_44100_64 optimize_streaming_latency=2 model_id=eleven_turbo_v2_5 turbo_v2_5 was picked over flash_v2_5 because cloned voices need its better prosody handling; mode 2 keeps prosody intact while streaming the first byte fast. Pre-warming (the biggest latency win) The moment the Generator returns the 3 candidates, the frontend issues 3 parallel ElevenLabs TTS requests before the user has even read them: $$ T_{\text{perceived}} = T_{\text{generate}} + \max\left( T_{\text{select}},\ \max_i T_{\text{tts}}(c_i) \right) $$ Because users spend \(T_{\text{select}} \approx 2\text{s}\) reading and deciding, we cache the audio during that window, so: $$ T_{\text{tap-to-sound}} \approx 0\text{ms} $$ Savings vs. no pre-warming: \(\Delta T \approx 700\text{ms}\) per turn. Over a 20-turn conversation, \(\sim 14\) seconds of accumulated waiting removed. Emotion engine β the moat Cloning a voice is easy now. Making an ElevenLabs cloned voice express emotion is what nobody else does for AAC. Each emotion \(e\) maps to a voice_settings vector: $$ \mathbf{S}_e = (s_e,\ b_e,\ y_e,\ v_e) $$ where \(s_e\) = stability (lower = more variation), \(b_e\) = similarity_boost (anchors the cloned identity), \(y_e\) = style, \(v_e\) = speed multiplier. Selected profiles after 13 hand-tuned iterations: $$ \mathbf{S}{\text{excited}} = (0.35,\ 0.80,\ 0.55,\ 0.98) $$ $$ \mathbf{S}{\text{warm}} = (0.45,\ 0.80,\ 0.40,\ 0.92) $$ $$ \mathbf{S}{\text{tender}} = (0.55,\ 0.82,\ 0.40,\ 0.88) $$ $$ \mathbf{S}{\text{neutral}} = (0.55,\ 0.80,\ 0.25,\ 0.92) $$ Critical constraint discovered empirically: \(s_e \geq 0.35\) for all \(e\). Drop below this floor and the cloned voice warbles. The Generator returns only the label \(e\) (from a closed vocabulary of 13); the backend looks up \(\mathbf{S}_e\) and passes it to ElevenLabs. Numbers are locked; expression is flexible. Turn-taking state machine A 2-state machine (Listening / Composing) with timer-driven transitions: Listening β Composing on a final transcript followed by \(\Delta t > 3.5\text{s}\); Composing β Listening when a candidate is picked and playback ends + a 500ms buffer; auto-return to Listening if idle \(> 120\text{s}\) with no taps. AudioWorklet-level mic gating Mic state is read synchronously in the worklet, not via React state: When listening is false, audio frames are dropped at the worklet level β they never reach Deepgram. No re-render lag, no echo from ElevenLabs playback feeding back, no room-noise pollution of memory. Durability β surviving long conversations Deepgram closes idle WS connections after \(\sim 10\text{s}\). During "My turn" no audio flows, so we send a KeepAlive every 5s (\(5\text{s} < 10\text{s}\)): Dwell-click for cerebral palsy users A progress value \(p(t) = \min(1,\ (t - t_0) / T_{\text{dwell}})\) with \(T_{\text{dwell}} = 1.1\text{s}\) by default, rendered with requestAnimationFrame. Reach \(p = 1\) to activate the tile β no physical tap required. Per-profile feature differentiation ALS gets the voice-banking prompt because voice cloning is most emotionally loaded for them β recording now, before speech is lost. Every value overridable in Settings. π οΈ Challenges We Faced ElevenLabs cloned voices warbling at low stability. Early high-emotion profiles used \(s_e \in [0.15, 0.25]\) and warbled. Fix: floor stability at \(s_e \geq 0.35\), compensate with higher style and anchor identity with \(b_e \geq 0.80\). Deepgram dropping connections during composing. WS dies silently after 10s idle. Fix: explicit KeepAlive every 5s. Echo loop from speakers. TTS playback got captured by the mic and transcribed as a partner turn. Fix: AudioWorklet-level mic gating during my-turn + 500ms post-playback buffer. Profile differentiation felt cosmetic. Fix: built real per-profile features β picture+word tiles, ALS voice-banking flow, dwell-click for CP. Generator returning unreliable numeric voice settings. Claude's free-form numbers drifted out of range. Fix: Generator picks only a label \(e\) from 13; backend maps \(e \mapsto \mathbf{S}_e\) deterministically. π What We Learned Voice cloning is the easy part. Emotion is the moat. Making a cloned voice feel requires hand-tuning, not auto-generation. Pre-warming is the cheapest latency win. Generate TTS while the user reads candidates and tap-to-sound feels instant. Real-time systems are 80% durability work. KeepAlives, heartbeats, mic gating β the difference between a demo and a product. AAC needs vary wildly even within one diagnosis. Profiles set defaults; Settings override everything. Empathy first, tech second. Every decision flowed from: would this make someone feel more like a person? π What's Next Deployment β Vercel + Render/Fly so anyone can try it Screen-reader ARIA pass β accessibility audit SLP partnership β speech-language pathologist review of the defaults Switch/scanning input β single-switch users (severe CP, late-stage ALS) Real user testing β paid co-design with AAC users from each of the four audiences Cadence is a working prototype today β but the dream is that one day, someone who can't speak will look up from their tablet, hear their own voice say "I love you" with real warmth, and the person across the table will hear them. Really hear them. For the first time in years β maybe ever. That's why we built this. π
Cadence π
Real-time assistive communication that lets people who can't speak keep up with a live conversation β in their own voice, with real emotion.
Built solo in ~24 hours at the UC Berkeley AI Hackathon (June 2026).
What it does
Cadence is an augmentative and alternative communication (AAC) tool designed for people who are nonverbal or losing speech β including those with ALS, autism, aphasia, and cerebral palsy. It listens to the conversation partner in real time, presents AI-picked concept tiles the user can tap, and turns those taps into natural, first-person sentences spoken aloud in the user's own cloned voice with emotionally appropriate delivery.
Unlike traditional AAC, Cadence grounds every reply in what the other person just said: the same two taps after "Are you hungry?" and after "Did you like the food?" produce completely different sentences. The user always picks the final candidate before anything is spoken β Cadence proposes, never decides.
How it works
The backend runs a multi-agent pipeline with overlapping stages to minimize latency:
Partner speaks β Deepgram streaming ASR β live transcript
β
βββ Tiles agent (LLM) picks contextual tiles
βββ Suggester (LLM) predicts quick replies
βββ Memory (Redis) stores turn history
β
User taps tiles β Generator (LLM) fuses context + taps + memory
β
Emotion tagging β per-emotion voice settings
β
ElevenLabs TTS β spoken in user's cloned voice
- Streaming ASR (Listener) β Deepgram Nova-2 via raw WebSocket with interim results, endpointing, and KeepAlive pings to survive long conversational pauses.
- Tiles agent β After each partner turn, the LLM reads the conversation and picks the 12 most relevant concept tiles (short words and phrases the user is likely to need).
- Suggester β Proactively predicts 2 likely full-sentence replies with no taps needed.
- Generator (Fusion Engine) β The core of Cadence. Takes the tapped concept tiles, the heard context, and conversation history from Redis, and produces 3 natural first-person candidates, each tagged with one of 13 emotion labels.
- Emotion-tuned TTS β Each emotion label maps to hand-tuned ElevenLabs voice settings (stability, similarity boost, style, speed) so cloned voices don't warble or over-act. The audio is streamed as MP3 via a GET endpoint so
<audio src=...>can stream natively. - Redis Memory β Per-session conversation history (24-hour TTL), pinned/recent vocabulary, and cloned voice ID are stored in Redis. All features degrade gracefully when Redis is unavailable.
Latency work
- TTS pre-warming β the moment the Generator returns candidates, all three audio files are fetched in parallel so tap-to-speech feels near-instant.
- AudioWorklet-level mic gating β audio bytes are dropped at the AudioWorklet when it's the user's turn, preventing the system from transcribing its own spoken output (echo loop) or polluting memory with room noise.
- Pipeline overlap β tiles, suggestions, and memory fetch fire concurrently on each partner turn completion, not sequentially.
- Deepgram KeepAlive + browser heartbeat β the backend sends periodic KeepAlive frames to Deepgram and ping frames to the browser so neither connection idles out during the user's composing phase.
Stack
| Layer | Technology |
|---|---|
| Frontend | React 18 Β· Vite Β· Tailwind CSS Β· Framer Motion Β· Web Audio API (AudioWorklet) |
| Backend | FastAPI Β· WebSockets Β· Python 3.11+ |
| Speech-to-text | Deepgram (Nova-2 streaming) |
| LLM | Anthropic Haiku 4.5 |
| Memory | Redis |
| Text-to-speech | ElevenLabs (Instant Voice Cloning, eleven_turbo_v2_5) |
Local setup
Prerequisites
- Python 3.11+
- Node.js 18+
- API keys for Deepgram, Anthropic, and ElevenLabs
- (Optional) A Redis instance β the app works without it, but memory/vocab/voice-clone persistence require it
1. Backend
cd backend
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Copy the example env file and add your keys:
cp .env.example .env
# Edit .env with your API keys
Run the server:
python main.py
# β FastAPI on http://localhost:8000
2. Frontend
cd frontend
npm install
npm run dev
# β Vite dev server on http://localhost:5173
3. Use it
Open http://localhost:5173, click Connect, grant microphone access, and start talking.
No mic handy? Expand the "Practice" panel at the bottom to type a partner phrase and test the full pipeline without audio.
Project structure
cadence/
βββ backend/
β βββ main.py # FastAPI app β all agents, WebSocket, TTS, memory
β βββ requirements.txt
β βββ .env.example
β βββ .env # your local keys (git-ignored)
βββ frontend/
β βββ public/
β β βββ audio-processor.js # AudioWorklet β PCM16 mic capture + gating
β βββ src/
β β βββ App.jsx # Main app β turn state machine, tiles, candidates, TTS
β β βββ Landing.jsx # Welcome page + profile picker (ocean wave animation)
β β βββ Demo.jsx # "How it works" pitch page with A/B audio comparison
β β βββ Tutorial.jsx # Step-by-step guided walkthrough
β β βββ VoiceRecorder.jsx # Voice-banking flow (record β clone via ElevenLabs)
β β βββ symbols.js # Emoji symbol map for PECS-style tile rendering
β β βββ index.css # Design tokens + animations
β β βββ main.jsx # React entry point
β βββ package.json
βββ .gitignore
βββ README.md
Note
This is a working prototype built at a hackathon β not a medical device. For any clinical use, consult a speech-language pathologist. Voices are cloned with consent and stored privately per session.
Built solo by Yash Patil at the UC Berkeley AI Hackathon, June 2026.
Analysis
View
Metric
- 9
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- AnthropicIn code
- CSSIn code
- FastAPIIn code
- HTMLIn code
- JavaScriptIn code
- PythonIn code
- ReactIn code
- RedisIn code
- Tailwind CSSIn code
9 of 9 appear in the indexed code.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
165 KB
Source files
15
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
Yxp23/cadence
20 files Β· 253 KB Β· @ 88f8e0f
Structure
Interface
1 file Β· 5%Screens, components and styles rendered to the user.
Application logic
9 files Β· 45%Domain rules, services and shared utilities.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here β open the file browser to check anything the diagram implies.
Languages
- JavaScript70%
- Python24%
- CSS3%
- Markdown3%
- HTML0%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
backend/requirements.txt
pypi Β· 8- anthropic
- fastapi
- httpx
- python-dotenv
- python-multipart
- redis
- uvicorn[standard]
- websockets
frontend/package.json
npm Β· 8- framer-motion
- react
- react-dom
- +5 more
Declared in the repositoryβs manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This projectβs features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.