Features • Quick Start • Example • Documentation • Playground
Relanote is a programming language designed for describing music using relative intervals rather than absolute pitches. Built with functional programming principles and static typing, it makes musical transformations like transposition, modulation, and composition natural and type-safe.
; Define a major scale using intervals
scale Major = { R, M2, M3, P4, P5, M6, M7 }
; Create a melody using scale degrees
let melody = | <1> <3> <5> <3> <1> |
; Transform with builtins
let transformed = melody |> repeat 2
transformed
- 🎵 Relative Intervals - Describe melodies using intervals (M3, P5, m7) instead of absolute pitches
- λ Pure Functional - Immutable values, first-class functions, and composable transformations
- 🔒 Static Typing - Hindley-Milner type inference catches errors at compile time
- 🎼 Compositional - Build complex pieces from simple building blocks
- 🎹 MIDI Export - Render compositions to standard MIDI files
- 🌐 Web Playground - Try Relanote in your browser with live preview
# Clone the repository
git clone https://github.com/ubugeeei/relanote.git
cd relanote
# Trust and setup
mise trust
mise run setup
# Start the web playground
mise run dev# Build the CLI
cargo build --release
# Run a file
./target/release/relanote run examples/hello.rela
# Render to MIDI
./target/release/relanote render examples/hello.rela -o output.midscale Major = { R, M2, M3, P4, P5, M6, M7 }
; Twinkle Twinkle Little Star
let twinkle = | <1> <1> <5> <5> <6> <6> <5> - <4> <4> <3> <3> <2> <2> <1> - |
twinkle
scale Major = { R, M2, M3, P4, P5, M6, M7 }
; Major triad chord
chord Tonic = [ R, M3, P5 ]
; Simple progression
let progression = | <1> <4> <5> <1> |
progression
scale Major = { R, M2, M3, P4, P5, M6, M7 }
let melody = | <1> <2> <3> <4> |
; Repeat the melody
let repeated = melody |> repeat 2
; Reverse the melody
let reversed = melody |> reverse
; Transpose up a fifth
let higher = melody |> transpose P5
repeated
- Introduction - What is Relanote?
- Installation - Setup guide
- Quick Start - Your first program
- Tutorial - Step-by-step guide
- Intervals - P1, M3, P5, m7...
- Scales & Chords
- Blocks - Note sequences
- Pipes & Composition
Try Relanote in your browser at ubugeeei.github.io/relanote/playground
Features:
- Monaco editor with syntax highlighting
- Real-time error checking
- Staff notation preview
- Audio playback
- MIDI export
relanote/
├── crates/
│ ├── relanote_core/ # Shared types, spans, diagnostics
│ ├── relanote_lexer/ # Tokenizer (logos)
│ ├── relanote_ast/ # AST definitions
│ ├── relanote_parser/ # Parser (chumsky)
│ ├── relanote_hir/ # High-level IR
│ ├── relanote_resolver/ # Name resolution
│ ├── relanote_types/ # Type system (Hindley-Milner)
│ ├── relanote_eval/ # Evaluator
│ ├── relanote_stdlib/ # Standard library
│ ├── relanote_format/ # Code formatter
│ ├── relanote_lsp/ # Language Server Protocol
│ ├── relanote_render/ # MIDI rendering
│ ├── relanote_cli/ # CLI tool
│ └── relanote_wasm/ # WebAssembly bindings
├── web/ # Nuxt web playground
├── docs/ # VitePress documentation
└── examples/ # Example files
# Run tests
mise run test
# Run lints
mise run lint
# Format code
mise run fmt
# Build WASM
mise run wasm:build
# Start docs dev server
mise run docs:devContributions are welcome! Please read our contributing guidelines before submitting PRs.
MIT License - see LICENSE for details.
Made with ♪ by ubugeeei