MusicTheory Documentation
Welcome to the MusicTheory library documentation. This comprehensive C# library provides immutable domain objects for music theory concepts, built with modern .NET practices and extensive test coverage.
What is MusicTheory?
MusicTheory is a powerful .NET library that models music theory concepts as code. Whether you're building a music education app, a composition tool, or analyzing musical structures, this library provides the fundamental building blocks you need.
Key Features
- **Notes**: Create and manipulate musical notes with support for all alterations - **Intervals**: Calculate musical intervals with proper quality handling - **Scales**: Generate scales with 15+ scale types including modal and exotic scales - **Chords**: Build chords with 40+ types including triads, seventh chords, extended, altered, and suspended chords - **Key Signatures**: Handle key signatures with circle of fifths navigation
- **Transposition**: Transpose notes, chords, and scales by intervals - **Chord Progressions**: Roman numeral analysis and common progressions - **MIDI Integration**: Convert between notes and MIDI numbers - **Enharmonic Equivalence**: Handle enharmonic relationships (C# ↔ Db) - **Time & Rhythm**: Time signatures and note duration calculations
- **Immutable Objects**: Thread-safe, predictable behavior - **Fluent API**: Chainable method calls for readable code - **Type Safety**: Strong typing prevents invalid music theory constructs - **Performance**: Lazy evaluation and calculated properties - **Comprehensive Testing**: 479+ unit tests ensure reliability
Quick Example
Here's a simple example demonstrating the library's capabilities:
Installation
Getting Started
Clone the repository:
git clone https://github.com/phmatray/MusicTheory.git cd MusicTheoryBuild the solution:
dotnet buildRun tests to verify everything is working:
dotnet test
Where to Start?
Getting Started Guide - Learn the basics of the library
Working with Notes - Understanding the Note class
Building Chords - Create and manipulate chords
Scale Generation - Generate and work with scales
API Reference - Complete API documentation
Requirements
.NET 9.0 or later
Any IDE with C# support (Visual Studio, Rider, VS Code)