Skip to content

ubugeeei/relanote

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Relanote - Everything is relative

CI License

FeaturesQuick StartExampleDocumentationPlayground


What is Relanote?

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

Features

  • 🎵 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

Quick Start

Using mise (Recommended)

# 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

Manual Installation

# 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.mid

Example

Simple Melody

scale 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

Chord Progression

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

Transformations

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

Documentation

Language Reference

Playground

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

Project Structure

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

Development

# 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:dev

Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.

License

MIT License - see LICENSE for details.


Made with ♪ by ubugeeei

About

formal music language. everything are relative.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors