0.0.1 • Published 8 years ago
musicode v0.0.1
Musicode
Text format music notation.
Why Musicode
Because Musicode is extremely simple and readable.
Format
The Musicode has two parts:
- header: meta info such as name and composer.
- body: the music data, every block is equivalent to a bar.
A bar includes nodes, chords(option) and durations.
(C4 is middle C; 4 is quarter note; 2 is half note; '0' is rest note; '~' is tie)
name: Canon in D
composer: Johann Pachelbel
key: D
play: C
tempo: 64
time: 4/4
E4 D4 C4 B3
C G Am Em
4 4 4 4
A3 G3 A3 B3
F C F G
4 4 4 4
C4 ~ 0
C ~ 0
4 4 2
For tuplet:
C4-E4-G4
That's all, no more no less and even no quick start here.
Javascript API
<script src="musicode.js"></script>
<script>
var text = 'name: Canon in D\nE4 D4 C4 B3\nC G Am Em\n4 4 4 4\n';
var canon = musicode.load(text);
console.log(canon.name);
console.log(canon.bars[0].notes);
console.log(canon.bars[0].chords);
console.log(canon.bars[0].durations);
var canonText = musicode.dump(canon);
console.log(canonText);
text = 'name: Canon in D\ne4 d4 c4 b3\nc g am em\n4 4 4 4\n';
var formatted = musicode.format(text);
console.log(formatted);
</script>
0.0.1
8 years ago