Getting started
The shortest path from zero to a piece of music. We'll write a few lines of relanote, see why "relative" matters, and render the result.
By the end you'll have written:
- An interval — the relationship between two notes.
- A scale-degree melody — pitches expressed by what they relate to.
- A pipe-driven transformation — composition the way you'd compose code.
- A MIDI file you can drop into any DAW.
If you don't have relanote installed locally, follow the Installation guide, or open the Showcase and listen in the browser first.
Your first program
Create tutorial.rela:
; My first Relanote program!
scale Major = { R, M2, M3, P4, P5, M6, M7 }
| <1> <3> <5> |Run it:
relanote run tutorial.relaYou should see output showing three intervals: the root, major third, and perfect fifth. This is a major triad!
Understanding the Output
Block {
slots: [
Note { interval: R (0 semitones) },
Note { interval: M3 (4 semitones) },
Note { interval: P5 (7 semitones) }
]
}Relanote shows you the internal representation. Notice how intervals are measured in semitones from the root.
Adding a Scale
Let's use scale degrees instead of raw intervals:
; Define a major scale
scale Major = { R, M2, M3, P4, P5, M6, M7 }
; Use scale degrees
let melody = | <1> <3> <5> |
melody<1>, <3>, <5> refer to the 1st, 3rd, and 5th degrees of the scale. This is the same major triad, but now expressed in terms of scale degrees!
Creating a Melody
Let's make something more interesting:
scale Major = { R, M2, M3, P4, P5, M6, M7 }
; A simple melody
let melody = | <1> <2> <3> <4> <5> <5> <3> <4> <5> <5> <1> |
melodyThis creates a familiar melody using the major scale.
Render to MIDI
Let's hear it! Render to a MIDI file:
relanote render tutorial.rela -o melody.midOpen melody.mid in your favorite music software (GarageBand, Logic, Ableton, etc.) to hear your creation!
What's Next?
- Your First Melody - Create a complete melody with rhythm
- Building Chords - Learn to create chord progressions
- Creating a Song - Put it all together
Quick Reference
| Syntax | Meaning | ||
R, M3, P5 | Intervals (Root, Major 3rd, Perfect 5th) | ||
scale Name = { ... } | Define a scale from intervals | ||
<n> | Reference the nth scale degree | ||
| `\ | >` | Pipe operator (apply left to right) | |
let x = ... | Define a variable | ||
| `\ | ... \ | ` | Create a block (sequence of notes) |
- | Rest |