Developer Documentation
Welcome to the RMT Compose developer documentation. This section covers the internal architecture, APIs, and contribution guidelines.
Overview
RMT Compose is built with:
| Technology | Purpose |
|---|---|
| ES Modules | Native JavaScript modules |
| Vite | Build tool and dev server |
| WebGL2 | Hardware-accelerated rendering |
| Web Audio API | Audio synthesis and playback |
| Fraction.js | Arbitrary-precision rational arithmetic |
| Rust/WASM | Optional high-performance evaluation |
Architecture
The system consists of several key layers:
┌─────────────────────────────────────────────────┐
│ UI Layer │
│ (player.js, menu-bar.js, variable-controls.js) │
├─────────────────────────────────────────────────┤
│ Core Engine │
│ ┌───────────┐ ┌────────────┐ ┌──────────────┐ │
│ │ Module │ │ Expression │ │ Dependency │ │
│ │ + Notes │ │ Compiler │ │ Graph │ │
│ └───────────┘ └────────────┘ └──────────────┘ │
│ ┌───────────────────────────────────────────┐ │
│ │ Binary Evaluator (Stack VM) │ │
│ └───────────────────────────────────────────┘ │
├─────────────────────────────────────────────────┤
│ Output Layers │
│ ┌───────────────────┐ ┌─────────────────────┐ │
│ │ WebGL2 Renderer │ │ Audio Engine │ │
│ └───────────────────┘ └─────────────────────┘ │
├─────────────────────────────────────────────────┤
│ Optional WASM Acceleration │
│ (evaluator, compiler, fractions, graphs) │
└─────────────────────────────────────────────────┘Documentation Sections
Architecture
- System Architecture - High-level system design
- Data Flow - How data moves through the system
- Module System - Module, Note, and BaseNote
- Rendering Pipeline - WebGL2 rendering architecture
Core Systems
- Expression Compiler - Text to bytecode compilation
- Binary Evaluator - Stack-based VM evaluation
- Dependency Graph - O(1) dependency tracking
- SymbolicPower - Irrational number algebra
Rendering
- WebGL2 Renderer - Instanced rendering pipeline
- Camera Controller - Pan/zoom and coordinates
- GPU Picking - Hit detection
Audio
- Audio Engine - Web Audio playback
- Instruments - Synth and sample instruments
- Streaming Scheduler - JIT note scheduling
WASM
- WASM Overview - Optional acceleration
- Building WASM - Rust/wasm-pack build process
- JS/WASM Adapters - Bridge pattern
API Reference
- Module Class - Module API
- Note Class - Note API
- BinaryExpression - Expression API
- EventBus - Event system
Contributing
- Development Setup - Get started developing
- Code Style - Coding conventions
- Pull Requests - Contribution workflow
Key Files
| File | Purpose |
|---|---|
src/main.js | Entry point |
src/player.js | Main orchestrator |
src/module.js | Module data model |
src/note.js | Note data model |
src/expression-compiler.js | Text → bytecode |
src/binary-evaluator.js | Bytecode interpreter |
src/dependency-graph.js | Dependency tracking |
src/renderer/webgl2/ | Rendering layer |
src/player/audio-engine.js | Audio playback |
Getting Started
- Set up your development environment
- Read the System Architecture
- Explore the Expression Compiler to understand the core
- Check the API Reference for implementation details