summaryrefslogtreecommitdiff
path: root/examples/fun.rhai
blob: 05b915c728a8bb62e4b68d28f655708f487ac4cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// plays ode to joy, no matter which keys you press

const data = [64, 64, 65, 67, 67, 65, 64, 62, 60, 60, 62, 64, 64, 62, 62,
	64, 64, 65, 67, 67, 65, 64, 62, 60, 60, 62, 64, 62, 60, 60];

fn pm_note_played(channel, note, vel) {
	pm_play_note(0, data[this.i], vel); 
	this.i += 1;
	this.i %= data.len;
}

fn pm_start() {
	this.i = 0;
	pm_load_soundfont("soundfont.sf3");
	pm_load_preset(-1, "grand piano");
}