How iitzbambusel/chromaflow works
Chromaflow is a Chromium audio-analysis extension backed by a local FastAPI service. The main workflow captures a playing tab, streams audio for live BPM/key analysis, and can identify the track; the popup presents results and requests harmonic recommendations. Recognition, cover proxying, catalog matching, and platform links are distinct product stages. Edges use README-described workflows or source-index references; several extension runtime handoffs are documented but not shown in source excerpts, so those links are dashed.
Main entry points: main.py FastAPI Endpoints · offscreen.js Offscreen Runtime · service.py Recognition State Machine · engine.py Match Scoring
Components 30
Browser Extension
- Capture Coordinator
extension/background.js - Offscreen Runtime
extension/offscreen.js - Audio Graph
extension/offscreen/audio_graph.js - PCM Worklet
extension/offscreen/pcm_worklet.js - PCM Ring Buffer
extension/offscreen/pcm_buffer.js - Analysis Dispatcher
extension/offscreen/analysis_dispatcher.js - Track Recognizer Client
extension/offscreen/track_recognizer.js - Studio Popup
extension/popup.js - VU Meter
extension/shared/vu_meter.js - Match Client
extension/shared/match_client.js
Audio Analysis
- FastAPI Endpoints
backend/main.py - Session Ring Buffer
backend/buffer.py - Audio Decode
backend/audio.py - Analysis Facade
backend/dsp/analyzer.py - Key Detection
backend/dsp/key_detector.py - Tempo Detection
backend/dsp/tempo_detector.py - Stream Smoothing
backend/dsp/smoother.py
Recognition
- Recognition State Machine
backend/metadata/service.py - Fingerprint and Catalog Providers
backend/metadata/providers.py - Tab Title Parser
backend/metadata/title_parser.py - Cover Proxy
backend/metadata/cover_proxy.py
Harmonic Matching
- Match Scoring
backend/matching/engine.py - Track Catalog
backend/matching/catalog.py - Camelot Mapping
backend/matching/camelot.py - Platform Links
backend/matching/links.py
Other components
- Listener
- Playing Tab
- Local Backend
- Shazam Service
- iTunes Catalog
Connections 31
- Listener → Studio Popup: operates
README.md - Playing Tab → Capture Coordinator: initiates capture
- Capture Coordinator → Offscreen Runtime: dispatches capture
- Offscreen Runtime → Audio Graph: configures audio
extension/offscreen.js - Audio Graph → PCM Worklet: processes audio
- PCM Worklet → PCM Ring Buffer: writes PCM
- Offscreen Runtime → PCM Ring Buffer: reads audio
extension/offscreen.js - Offscreen Runtime → Analysis Dispatcher: starts dispatch
extension/offscreen.js - Analysis Dispatcher → Local Backend: sends audio chunks
README.md - Local Backend → FastAPI Endpoints: serves requests
README.md - FastAPI Endpoints → Session Ring Buffer: manages sessions
backend/main.py - FastAPI Endpoints → Audio Decode: decodes uploads
backend/main.py - FastAPI Endpoints → Analysis Facade: runs analysis
backend/main.py - Analysis Facade → Key Detection: detects key
backend/dsp/analyzer.py - Analysis Facade → Tempo Detection: detects tempo
backend/dsp/analyzer.py - FastAPI Endpoints → Stream Smoothing: smooths stream results
- Offscreen Runtime → Track Recognizer Client: requests recognition
extension/offscreen.js - Track Recognizer Client → Local Backend: sends session request
README.md - FastAPI Endpoints → Recognition State Machine: handles identification
backend/main.py - Recognition State Machine → Fingerprint and Catalog Providers: queries providers
backend/metadata/service.py - Fingerprint and Catalog Providers → Shazam Service: fingerprints audio
README.md - Fingerprint and Catalog Providers → iTunes Catalog: enriches matches
README.md - Recognition State Machine → Tab Title Parser: parses tab title
- Recognition State Machine → Cover Proxy: registers artwork
backend/metadata/service.py - Studio Popup → Match Client: requests recommendations
extension/popup.js - Match Client → Local Backend: posts match query
extension/shared/match_client.js - FastAPI Endpoints → Match Scoring: scores recommendations
backend/main.py - Match Scoring → Track Catalog: queries candidates
backend/matching/engine.py - Match Scoring → Camelot Mapping: scores key relations
backend/matching/engine.py - Match Scoring → Platform Links: builds platform links
backend/matching/engine.py - Studio Popup → VU Meter: renders audio level
extension/popup.js