How zohaibahmed/chatgpt-voice works
Project type and purpose
• This is a single‐page web application (React SPA) that lets users “talk” to ChatGPT using their own voice.
• It captures microphone input, streams audio to an unofficial ChatGPT API backend, receives text responses, then uses Resemble AI to synthesize spoken replies.
File structure
• Top level:
• package.json / package-lock.json → Node.js dependencies and scripts
• public/ → static HTML, manifest, robots.txt
• src/ → React source code
• src/ contains:
• App.js / App.css – root component & styling
• Recorder.js – captures microphone audio
• AudioVisualizer.js – renders live audio waveforms
• contexts/ → custom React Contexts for Web Audio / MediaStream / analysis state
• index.js – app entry point
• No backend code is present here; it relies on an external ChatGPT API server (Python) and Resemble AI.
README for additional insights
• Prerequisites call out the unofficial ChatGPT API server (server.py) and Resemble AI credentials.
• Usage flow: start the React dev server → ensure ChatGPT API is running → configure Resemble AI keys → interact via browser.
a. Main components:
• Browser / React SPA
• Recorder (MediaStreamContext)
• AudioAnalyzer (AudioAnalyserContext + AudioVisualizer)
• HTTP layer / fetch module inside React
• Unofficial ChatGPT API backend (external Python server)
• Resemble AI TTS service (external)
• Audio playback in browser
b. Relationships & data flows:
1. User speaks → browser MediaStream → Recorder component
2. Raw audio buffer → AudioAnalyserContext → AudioVisualizer (for UI feedback)
3. Recorder encodes/streams audio → HTTP POST to ChatGPT API
4. ChatGPT API returns text → React receives JSON
5. React sends text to Resemble AI (HTTP POST) → receives audio stream
6. React plays synthesized audio via Web Audio API
c. Architectural patterns & design principles:
• React Context API for global state (media stream, audio data, analysis results)
• Single‐page Application with clear separation of concerns: UI, audio capture, visualization, API integration
• External service integration via HTTP, minimal custom backend logic in front end
d. Key technologies/frameworks:
• React, Web Audio API, Context API
• Unofficial ChatGPT API (Python server)
• Resemble AI TTS service
• Node.js / npm dev server