How indiebubbler/metro works
Main Components
• User Interface (Frontend): The React application (most files in the “src” directory) displays an interactive UI with components for control panels (MixerPanel, ModePanel, TrackView, etc.), editing modals (EditPresetModal, SavePresetModal, ImportDialog), and visualizations (Vis, SimpleVis, SvgClock).
• Audio Engine: Integration with Tone.js (as highlighted in the README) which drives the metronome, drum machine sounds, polyrhythms, and instrument switching.
• Assets: The “public” directory contains static assets – HTML files, audio samples (organized by different instrument kits like Basic Drum Kit, Electrokit, Tabla, Yamaha RX5, and Metronome), manifest, and configuration files.
• Localization & Configuration: The “src/localization” directory with files for different languages (e.g., Polish and Italian) indicates built-in internationalization support.
• Hosting & Deployment: Files like firebase.json, .firebaserc, and GitHub Actions workflows point to Firebase hosting with automated deployment pipelines.
• Persistent/State Data: Although this is a front-end application that uses browser storage (saving presets locally via import/export functionality), the architecture should include this data management layer.
Relationships and Interactions
• UI components interact with the Audio Engine (Tone.js) by capturing user input (e.g., BPM adjustments, instrument selection, starting/stopping playback) and triggering sound events through Tone.js.
• Several components (like PresetsManager, ImportDialog, and SavePresetModal) interact with browser storage to persist user configurations.
• Localization components provide data and text strings to the UI components to support multilingual interfaces.
• Deployment and build tools are indirectly wired into the project; although not part of runtime architecture, they affect how the code is built and hosted (Firebase hosting, GitHub workflows).
Architectural Patterns and Design Principles
• Component-Based Architecture: The React app is organized into many small, reusable components (as seen in the “src/components” directory).
• Separation of Concerns: The UI presentation, business logic, and sound/audio processing (using Tone.js) are kept in clearly defined modules.
• Declarative UI and State Management: Through React, the app dynamically updates in response to user input, likely managing state via React state/hooks.
• Progressive Enhancement: The project supports multiple environments – desktops, smartphones, tablets, and possibly SmartTVs.
Technologies, Frameworks, and Libraries
• ReactJS: for building the complex user interface.
• Tone.js: as the core audio library to handle sound synthesis, metronome timings, and building the drum machine.
• Firebase: for hosting (as evidenced by firebase.json and GitHub CI for deployment).
• GitHub Workflows: to manage automated deployment processes.
• Web Audio API: implicitly used through Tone.js.