Skip to content

Commit 8b96570

Browse files
mnmlywclaude
andcommitted
docs: add TUTORIAL.md (5-minute walkthrough)
Ten progressive snippets — one note → melody → rests → channels → effects → drums → multi-line → polyrhythm → live coding tips → a full mini-song. Each block is copy-pasteable into the editor. README now links the tutorial and the public Pages URL up top so new visitors land on something runnable rather than dev tooling. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1e04d80 commit 8b96570

2 files changed

Lines changed: 154 additions & 1 deletion

File tree

‎README.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@ kick noise x . . x . . x . : lpf 55 decay .05
1616

1717
## Run it
1818

19-
Open `index.html` in any modern browser. No build step. No dependencies.
19+
Open `index.html` in any modern browser, or visit
20+
**https://mnmlyw.github.io/hum/**. No build step. No dependencies.
21+
22+
## Learn it
23+
24+
[TUTORIAL.md](TUTORIAL.md) walks through every feature in 5 minutes —
25+
one note → melody → drums → polyrhythm. [SPEC.md](SPEC.md) is the full
26+
reference if you'd rather read the grammar.
2027

2128
## Repo layout
2229

‎TUTORIAL.md‎

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# tutorial
2+
3+
a 5-minute walkthrough of every feature in hum. type each block into the
4+
editor and press play. each one builds on the last.
5+
6+
## 1. one note
7+
8+
```
9+
bpm 120
10+
lead sin c4
11+
```
12+
13+
a line is a channel. `lead` is its name. `sin` is the waveform. `c4` is
14+
middle C. you'll hear it pulse once per beat.
15+
16+
## 2. a melody
17+
18+
```
19+
bpm 120
20+
lead sin c4 e4 g4 c5
21+
```
22+
23+
each token is one step (an 8th note). four tokens = four pitches. the
24+
pattern loops forever.
25+
26+
## 3. rests
27+
28+
```
29+
bpm 120
30+
lead sin c4 . . e4 . . g4 .
31+
```
32+
33+
`.` is a rest. so is `_` if you prefer. rest tokens count as steps too —
34+
this pattern is 8 steps long, not 3.
35+
36+
## 4. a second channel
37+
38+
```
39+
bpm 120
40+
lead sin c4 e4 g4 c5
41+
bass saw c2 . g2 .
42+
```
43+
44+
two lines, two channels. they play at the same time. waveforms: `sin`,
45+
`tri`, `sqr`, `saw`, `noise`. octaves run 0–8.
46+
47+
## 5. effects
48+
49+
```
50+
bpm 120
51+
lead sin c4 e4 g4 c5 : vol .5
52+
bass saw c2 . g2 . : lpf 400
53+
```
54+
55+
after `:` you can set effects. `vol` (0–1), `lpf` (low-pass filter Hz),
56+
`hpf` (high-pass), `decay` (seconds — makes notes percussive). `.5` is
57+
shorthand for `0.5`; `400` is just a number; `2k` means 2000.
58+
59+
## 6. drums
60+
61+
```
62+
bpm 120
63+
kick noise x . . . x . . . : lpf 50 decay .05
64+
hat noise . . x . . . x . : hpf 8k decay .015
65+
```
66+
67+
`noise` is the noise waveform. `x` triggers a hit. high-pass + short
68+
decay = hi-hat. low-pass + slightly-longer decay = kick.
69+
70+
## 7. multi-line patterns
71+
72+
```
73+
bpm 96
74+
lead tri
75+
c4 e4 g4 c5
76+
g4 e4 c4 .
77+
: vol .4
78+
```
79+
80+
indent any line to continue the previous channel. the pattern above
81+
plays as `c4 e4 g4 c5 g4 e4 c4 .` — one 8-step loop. effects can live on
82+
their own line too.
83+
84+
## 8. polyrhythm — the trick
85+
86+
```
87+
bpm 120
88+
lead sin c4 e4 g4 c5 e4 g4 c5
89+
kick noise x . . . x . . .
90+
```
91+
92+
the lead has 7 steps, the kick has 8. they loop independently and never
93+
re-align. give two channels different lengths and you get polyrhythm
94+
for free. coprime lengths (5 vs 7, 7 vs 11) drift forever.
95+
96+
## 9. live coding
97+
98+
playback runs while you type. edits land after a 300 ms pause:
99+
100+
- pattern changes (note swaps, rests added) take effect on the next
101+
scheduler tick.
102+
- structural changes (new channel, swapped waveform, removed channel)
103+
quantize to the next step boundary so they land musically.
104+
- press **Cmd/Ctrl+Enter** to apply immediately without waiting on the
105+
debounce.
106+
- press **Esc** to stop. press it again with **Cmd/Ctrl+Enter** to start
107+
fresh. there is no rewind — start always means step 0.
108+
109+
## 10. all together
110+
111+
a full mini-song using everything above:
112+
113+
```
114+
bpm 96
115+
116+
-- glass
117+
lead tri
118+
. . f#4 . a4 . c#5 .
119+
d5 . . . c#5 . a4 .
120+
: vol .5
121+
122+
bass saw
123+
d2 . . d2 . . d3 .
124+
: lpf 200
125+
126+
kick noise x . . . . . x . : lpf 50 decay .06
127+
hat noise . . x . . . x . : hpf 8k decay .03
128+
```
129+
130+
four channels, two waveforms, two filters, one decay. a verse loop in
131+
sixteen lines.
132+
133+
## what to try next
134+
135+
- open one of the demos via the **presets** picker and read it. they're
136+
the same `.hum` text you've been writing.
137+
- give two melodic channels different lengths (e.g. 7 vs 11) and listen
138+
to them drift. this is hum's core pleasure.
139+
- aim a long `decay` (`.5`, `1.5`) at a `sin` channel — it becomes a
140+
pluck or a bell.
141+
- save your song with the **save** button, drag the file onto the page
142+
later to load it. `.hum` files are plain text — open them in any
143+
editor.
144+
145+
that's the whole language. the [SPEC](SPEC.md) is the full reference;
146+
the [demos/](demos/) folder has six longer examples to read.

0 commit comments

Comments
 (0)