The Omi Real-Time Processor is built using a client-server architecture with the following components:
- HTTP server for serving static content and handling API requests
- WebSocket hub for managing real-time connections
- Separate channels for transcript and audio data
- Audio processing utilities for format conversion
- WebSocket connections for real-time data reception
- Canvas-based audio visualization
- Client-side audio buffer management
- Interactive UI with Nintendo-inspired design elements
TranscriptHubmanages all WebSocket connections- Separate connection pools for transcript and audio clients
- Connection tracking with metadata (UID, connection time)
- Automatic reconnection with exponential backoff
- Real-time PCM audio data handling
- Client-side buffer for storing audio data
- WAV header generation for audio downloads
- Audio statistics calculation (peak, RMS)
- Waveform visualization using Canvas API
- JSON-based transcript segment handling
- Real-time display with speaker identification
- Timestamp and duration information
- Interactive waveform displays with time markers
- Selection mechanism for audio segments
- Volume meter with dynamic color changes
- Connection status indicators
- Nintendo-style loading animation
-
Audio Processing:
- Client captures audio data
- Data sent to server via POST to
/audio/process - Server broadcasts to WebSocket clients on
/ws/audio - Client receives and processes binary audio data
- Visualization updated in real-time
-
Transcript Processing:
- External system sends transcript data to
/transcript/process - Server broadcasts to WebSocket clients on
/ws - Client displays transcript segments in real-time
- External system sends transcript data to
-
Audio Storage and Playback:
- Client maintains audio buffer in memory
- User can select segments for playback
- Audio can be downloaded in WAV or PCM format
- Connection upgrade handled by Gorilla WebSocket library
- Client registration/unregistration via channels
- Broadcast mechanisms for different data types
- Canvas-based waveform rendering
- Timeline with appropriate time markers
- Grid overlay for amplitude reference
- Selection overlay for segment selection
- In-memory audio buffer with size limits
- Conversion between binary and PCM formats
- WAV header generation for downloads
- Nintendo-style loading animation
- Sound effects for user interactions
- Dynamic volume meter with color changes
- Responsive canvas sizing
- Implement server-side audio processing for more advanced features
- Add authentication for secure user identification
- Support for more audio formats and higher quality
- Implement audio filtering and enhancement
- Add speech-to-text capabilities directly in the application