A draft of a language to program write music ! (and dump it to MIDI format using mido)
// starting from a3
c c g g a a g // whitespace is ignored
f f e e d d c // can you guess the tune ?
Only the above works for now, future features are listed below.
Clone this repo and do
python -m midi <my-text-file>
to generate a .mid file that you can then read with your favorite media player.
Notes are single-letter symbols using their anglo-saxon names (A-G == from la to sol). You can add the exact octave to play:
// a3 is default
a
// ==
a3
If no octave is provided, the interpreter will deduce one from the default note reference (a3 by default).
Each note has a duration. The default duration is 1, == a noire.
Follows that:
- 1/2 une
croche
; - 1/4 une
double
; - 2 une
blanche
;
and so on. You can set a specific note's duration with <note>/<duration>
:
c c g g a a g/2
f f e e d d c/2
Add a dot at the end of the duration to eg have a croche pointée:
g/1/2.
Simply <note>_[b#]
:
c_b
c_#
Blocks allow you to control default duration & reference frequency as you would scopes:
{
!/2 // set the default duration to croche for this block
c c g g
}
a * 3 // repeat notes
{ a a } * 3 // or entire blocks
loop 35 times {
c c g g
}
Describe and reuse phrases here and there!
theme = {
!/1
c c g g a a g/2
f f e e d d c/2
}
couplet = { g g f f e e d/2 }
theme
couplet
couplet
theme
Plusieurs fichiers duh
Ou sinon
// Portée 1
a a b b
---
// Portée 2
c c d d
Ideas welcome
See more unstructured ideas.