How jeanjerome/echoinstone works
Project Type and Purpose
• Type: An open-source, CLI-driven audio processing pipeline.
• Purpose: Download audio from various sources, transcribe it with Whisper, diarize speakers with Pyannote, align text to audio, and persist the results.
File Structure
• Top-level Modules:
• EchoInStone/capture/ – downloader implementations (YouTube, podcast, generic audio).
• EchoInStone/processing/ – orchestrator and processing interfaces (transcriber, diarizer, aligner).
• EchoInStone/utils/ – logging, timing, and data persistence.
• main.py – CLI entry point.
• config.py – holds Hugging Face token, model names, and global settings.
• Testing:
• tests/ (unit tests) and features/ (BDD scenarios) ensure downloader logic, orchestrator flows, and edge-case handling.
• Build & Config:
• pyproject.toml, requirements.txt, pytest.ini.
Extract Key Architecture Insights from the README
• Pipeline: A flexible, orchestrated sequence—download → transcribe → diarize → align → save.
• Interfaces: Abstract base classes allow swapping or extending downloaders and processors.
• External Dependencies:
• ffmpeg (audio handling)
• Hugging Face APIs (openai/whisper-large-v3-turbo, pyannote/speaker-diarization-3.1)
Main Components & Their Interactions
a. Downloader Layer (capture/):
• DownloaderFactory selects between YouTubeDownloader, PodcastDownloader, or AudioDownloader.
• Each downloader fetches raw audio, writes to local storage.
b. Processing Layer (processing/):
• AudioProcessingOrchestrator:
• Invokes WhisperAudioTranscriber → produces timestamped transcript.
• Invokes PyannoteDiarizer → produces speaker turn segments.
• Invokes SpeakerAligner → merges transcript and segments into a unified output.
c. Persistence & Utilities (utils/):
• DataSaver writes JSON outputs.
• LoggingConfig sets up console/file logging.
• Timer measures processing durations.
d. CLI / Entry Point:
• main.py parses arguments (URL, output directory, file names), loads config.py, and kicks off the orchestrator.
Architectural Patterns & Design Principles
• Modular Pipeline: each step (download, transcribe, diarize, align, save) is decoupled via interfaces.
• Factory Pattern: DownloaderFactory selects the correct downloader at runtime.
• Dependency Injection: components rely on interfaces (downloader_interface, aligner_interface, etc.), easing testability and extensibility.
• Separation of Concerns: download logic, processing logic, and utility logic reside in distinct modules.
Putting It All Together – High-Level View
[ Input URL ]
↓
[ DownloaderFactory ] → selects → [ YouTubeDownloader / PodcastDownloader / AudioDownloader ]
↓ (raw .wav)
[ AudioProcessingOrchestrator ]
├─> [ WhisperAudioTranscriber ] → (text + timestamps)
├─> [ PyannoteDiarizer ] → (speaker time segments)
└─> [ SpeakerAligner ] → (merged speaker-aligned transcript)
↓
[ DataSaver ] → writes JSON to results directory
↓
Logs & Metrics (via LoggingConfig & Timer)
Detail, Not Complexity
• Every interface and factory choice.
• External dependencies and where they’re invoked.