An open API service indexing awesome lists of open source software.

https://github.com/ubugeeei-prod/relanote

formal music language. everything are relative.
https://github.com/ubugeeei-prod/relanote

functional moonbit music programming-languages

Last synced: 18 days ago
JSON representation

formal music language. everything are relative.

Awesome Lists containing this project

README

          


relanote — music as a function


CI
License


What
Example
Quick start
Showcase
Docs

---

## What is relanote?

**relanote** is a pure functional, statically-typed language for music
where **everything is relative**. Pitch is relative: a melody is made
from scale-degree references, not absolute note names. Rhythm is
relative: a block divides its slot among the notes inside it. Chords are
intervals over a root, sections are blocks over a beat-grid, and parts
are sections over instruments. Change the key, scale, or tempo, and the
shape stays intact.

```rela
scale Major = { R, M2, M3, P4, P5, M6, M7 }

let theme = | <1> <3> <5> <3> <1> |

theme |> transpose P5 |> repeat 2
```

## Features

- **Pitch is relative.** `<1> <3> <5>` works in every key, every mode,
and every scale.
- **Rhythm is relative.** `| a b c d |` shares its slot equally among
four notes; `| a b |` gives two notes the same slot at half the
density.
- **Pure and typed.** Immutable values, first-class functions, and
Hindley-Milner inference keep musical transformations predictable.
- **Pipes for composition.** `theme |> transpose P5 |> repeat 2 |> reverb 0.3`
builds pieces by composing small functions.
- **MoonBit end to end.** The compiler pipeline, CLI, MIDI renderer, LSP
entry point, preview bridge, and Studio source live at the repository root.

## Quick Start

Install MoonBit once:

```bash
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
export PATH="$HOME/.moon/bin:$PATH"
```

Install Vite+ once for workspace tasks:

```bash
curl -fsSL https://vite.plus | bash
vp install
```

Then build and test the workspace:

```bash
git clone https://github.com/ubugeeei/relanote.git
cd relanote
vp run check
vp run test
vp run cli help
```

Root tasks live in `vite.config.mjs` and run through Vite Task:

```bash
vp run ci
vp run cli run examples/tutorials/01_hello.rela
vp run studio:build
```

If you use Nix, `nix develop` provides Node 24, pnpm, and helper tools.
The MoonBit and Vite+ installers above remain the sources for those
toolchains.

## Example

### Simple Melody

```rela
scale Major = { R, M2, M3, P4, P5, M6, M7 }

let twinkle = | <1> <1> <5> <5> <6> <6> <5> - <4> <4> <3> <3> <2> <2> <1> - |

twinkle
```

### Chord Progression

```rela
scale Major = { R, M2, M3, P4, P5, M6, M7 }

chord Tonic = [ R, M3, P5 ]

let progression = | <1> <4> <5> <1> |

progression
```

### Transformations

```rela
scale Major = { R, M2, M3, P4, P5, M6, M7 }

let melody = | <1> <2> <3> <4> |

let repeated = melody |> repeat 2
let reversed = melody |> reverse
let higher = melody |> transpose P5

repeated
```

## Documentation

- [Introduction](docs/guide/introduction.md)
- [Installation](docs/guide/installation.md)
- [Quick Start](docs/guide/quick-start.md)
- [Tutorial](docs/tutorial/getting-started.md)
- [Showcase](docs/showcase.md)
- [CLI Reference](docs/reference/cli.md)

## Showcase

The docs showcase is the public listening surface while Studio is being
rebuilt: polished `.rela` sketches, browser playback, and code you can
inspect.

## Studio Source

The hidden Studio view is authored with
[Vapor Moon](https://github.com/ubugeeei/vapor-moon) as
`src/studio/App.mbtv`. The callable bridge functions for diagnostics,
formatting, evaluation, and MIDI rendering live in `src/studio/playground.mbt`.

Build the component snapshot with:

```bash
vp run studio:build
```

## Project Structure

```text
relanote/
├── src/
│ ├── cmd/ # CLI entry point
│ ├── core/ # source, spans, diagnostics
│ ├── lexer/ # tokenizer
│ ├── ast/ # AST data types
│ ├── parser/ # parser
│ ├── hir/ # high-level IR
│ ├── resolver/ # module resolution
│ ├── types/ # type system
│ ├── eval/ # evaluator
│ ├── stdlib/ # embedded prelude
│ ├── format/ # formatter
│ ├── lsp/ # LSP entry point
│ ├── render/ # MIDI rendering
│ ├── studio/ # Vapor Moon view + playground bridge
│ └── site/ # docs/static-site build assets
├── docs/ # Markdown documentation
├── editors/vscode/ # VS Code extension package
└── examples/ # Example programs
```

## Development

```bash
vp run check
vp run test
vp run fmt
vp run studio:build
```

`vp run` opens the interactive Vite Task picker.

## License

MIT License - see [LICENSE](LICENSE) for details.

---


Made with ♪ by ubugeeei