A high-performance music theory and composition library with AI-powered musical intelligence, implemented in Rust with comprehensive cross-platform bindings.
- Advanced Music Theory: Complete chord analysis, Roman numeral notation, scale theory, and voice leading.
- Chord Progression Suggestions: ML-driven recommendations using trie-based pattern matching.
- Difficulty Assessment: Statistical models for musical complexity analysis.
- Bass Line Harmonization: Intelligent harmonization with multiple styles.
- Scale Degree Harmonization: Advanced harmonic analysis and suggestion.
- Cross-Platform: Native Rust, Python bindings, and WebAssembly for web applications.
- Thread-Safe: Built-in concurrency support throughout the library.
use composer_core::{Chord, ScaleFingerprint, get_stable_scale_degrees};
use composer_ai::AiEngine;
// Create and analyze a G7 chord
let chord = Chord::new(5, 7)?;
let scale = ScaleFingerprint::major_scale();
let degrees = get_stable_scale_degrees(&chord, &scale)?;
// AI-powered suggestions
let ai_engine = AiEngine::new(Default::default());
let suggestions = ai_engine.get_chord_suggestions(&pattern, &context, &config)?;Install from PyPI:
pip install composerimport composer
# Create and analyze chords
chord = composer.PyChord(5, 7) # G7 chord
scale = composer.PyScaleFingerprint([True, False, True, False, True, True, False, True, False, True, False, True])
# Binary serialization for ML applications
binary_data = composer.serialize_chord_to_binary(chord)
hex_string = composer.chord_to_hex(chord)
# AI-powered suggestions
engine = composer.PyAiEngine()
suggestions = engine.get_chord_suggestions(progression, context, config)Install from NPM:
npm install @composer/composer-wasmNode.js:
const composer = require('@composer/composer-wasm');
const chord = new composer.WasmChord(5, 7);
const scale = composer.WasmScaleFingerprint.major();
const roman = composer.getRomanNumeral(chord, scale);
console.log(`${chord.toString()} = ${roman}`);Browser:
import init, * as composer from '@composer/composer-wasm/web';
await init(); // Initialize WASM module
const chord = new composer.WasmChord(6, 5); // vi chord
const degrees = composer.getStableScaleDegrees(chord, scale);The project is organized as a cross-platform monorepo:
composer/
├── rust/ # Rust workspace
│ └── crates/
│ ├── composer-core/ # Core music theory algorithms
│ ├── composer-config/ # Configuration constants
│ ├── composer-serialization/ # Binary data formats
│ ├── composer-ai/ # AI-powered features
│ ├── composer-ffi/ # Python FFI bindings
│ └── composer-wasm/ # WebAssembly bindings
├── python/ # Python package with PyO3 bindings
├── wasm/ # WebAssembly NPM package
├── examples/ # Cross-platform usage examples
└── docs/ # Documentation
- Rust 1.70+ with Cargo
- Python 3.8+ (for Python bindings)
- Node.js 14+ and npm (for WebAssembly)
- just command runner
Install development dependencies and set up the environment:
just setupBuild all packages:
just buildBuild specific packages:
just build-rust # Rust workspace
just build-python # Python package
just build-wasm # WebAssembly packageRun all tests:
just testRun platform-specific tests:
just test-rust # Rust tests
just test-python # Python tests (multi-version)
just test-wasm # WebAssembly testsFormat and lint all code:
just fmt # Format all code
just lint # Lint all codeRun comprehensive examples:
just examples # All examples
just examples-python # Python examples
just examples-wasm # WebAssembly examplesGenerate documentation:
just docs # All documentation
just docs-rust # Rust API docs
just docs-python # Python docs
just docs-wasm # WebAssembly/TypeScript docsContributions are welcome! The core implementation is complete, but we appreciate:
- Additional examples and tutorials
- Performance optimizations
- New AI algorithms
- Integration with other music software
- Documentation improvements
Please run the full development cycle before submitting:
just full # clean + build + test + lintjust status # Check development status
just dev # Quick build + test cycle
just clean # Clean all build artifacts
just deps # Show dependency information
just dev-server # Start WASM development server
just release-check # Validate ready for releaseMIT OR Apache-2.0