MuseLab: Compose Music by Coding
Published:
Compose Music by Coding: generating MIDI from Python script
Quick Start
Install MuseLab following setup.md
Create a file
mysong.py
and paste the following code:
from muselab import *
song = Song()
song.add("Part 1", length=16, key=F4, signature=(3, 4), tempo=120)
song["Part 1"].add("Piano", Acoustic_Grand_Piano)
song["Part 1"]["Piano"].write(2.0,
[.75, .25, 1.0, 1.0, 1.0, 2.0, .75, .25, 1.0, 1.0, 1.0, 2.0],
[ G3, G3, A3, G3, C4, B3, G3, G3, A3, G3, D4, C4],
['祝','你','生','日','快','樂','祝','你','生','日','快','樂']
)
song.save("mysong.mid")
song.view()
- Run the file by
python3 mysong.py
. Then you can view the music score, and the MIDI file will be saved asmysong.mid
:
More About
The detailed documentation is coming soon!
The following is a more advanced example, which composes and arranges the first part of Lemon (米津玄師). You can learn most things of MuseLab by examining the following example:
from muselab import *
song = Song()
song.add("A1", 36, key=B3, signature=(4,4), tempo=87)
song.add("A2", 36)
song.add("B1", 16)
song.add("C1", 40)
# Section A1
song["A1"].add("Vocal", Lead_6_Voice)
song["A1"].add("Guitar 1", Electric_Guitar_Clean)
song["A1"].add("Guitar 2", Electric_Guitar_Clean)
song["A1"].add("Drum", Percussion)
song["A1"].add("Piano", Acoustic_Grand_Piano)
song["A1"]["Vocal"].write(3.5, [.25, .25, .50, .25, .75, .50, .50, .25, .75, .50, .50, .25, .75, .50, 1.0],
[ C4, D4, E4, C4, A3, D4, B3, G3, E3, B3, A3, G3, C3, G3, E3],
['ゆ','め','な','ら','ば','ど','れ','ほ','ど','よ','かっ','た','で','しょ','う'])
song["A1"]["Vocal"].write(11.5, [.25, .25, 1.0, .50, .25, .25, 1.0, .50, .25, .25, .75, .25, .50, .25, .25, 1.0],
[ D3, E3, F3, C4, B3, C4, G3, F3, E3, F3, Fs3, Fs3, C4, B3, A3, Gs3],
['い','ま','だ','に','あ','な','た','の','こ','と','を','ゆ','め','に','み','る'])
song["A1"]["Vocal"].write(19.5, [.25, .25, .50, .25, .75, .50, .50, .25, .75, .50, .50, .25, .75, .50, 1.0],
[ C4, D4, E4, C4, A3, D4, B3, G3, E3, B3, A3, G3, C3, G3, E3],
['わ','す','れ','た','も','の','を','と','り','に','か','え','る','よう','に'])
song["A1"]["Vocal"].write(27.5, [.25, .25, 1.0, .50, .25, .25, .50, .50, .50, .50, .75, .25, .25, .50, .25, 1.0],
[ D3, E3, F3, G3, F3, G3, E3, G3, C4, E4, D4, D4, D4, C4, C4, C4],
['ふ','る','び','た','お','も','い','で','の','ほ','こ','り','を','','は','らう'])
song["A1"]["Guitar 1"].write(20, [.50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50],
[ E5, C5, G5, C5, B4, D5, G5, B4, C5, D5, G5, C5, C5, D5, E5, C5])
song["A1"]["Guitar 1"].write(28, [.50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50],
[ D5, C5, G5, C5, C5, D5, G5, C5, B4, D5, G5, C5, C5, D5, G5, C5])
song["A1"]["Guitar 2"].write(20, [.50, .50, .50, .50, .50, .50, 1.0, .50, .50, .50, .50, .50, .50, 1.0],
[ C4, G3, E4, G3, D4, G3, C4, F4, G3, D4, G3, E4, G3, C4])
song["A1"]["Guitar 2"].write(28, [.50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50],
[ F4, C4, D4, G3, E4, G3, C4, G3, B3, G3, B3, G3, C4, G3, C4, G3])
song["A1"]["Drum"].write(20, [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
[ '', Xhc, '', Xhc, '', Xhc, '', Xhc, '', Xhc, '', Xhc, '', Xhc, '', Xhc])
song["A1"]["Piano"].write(4, [ 2.0, 2.0, 2.0, 2.0],
[(A2, A3, C4, E4), (G2, G3, B3, D4), (F2, F3, G3, C4), (C2, C3, E3, G3)])
song["A1"]["Piano"].write(12, [ 2.0, 2.0, 2.0, 2.0],
[(F2, C3, F3, A3), (C2, C3, E3, G3), (Ds2, A2, Ds3, Fs3), (E2, B2, E3, Gs3)])
song["A1"]["Piano"].write(20, [ 2.0, 2.0, 2.0, 2.0],
[(A2, A3, C4, E4), (G2, G3, B3, D4), (F2, F3, G3, C4), (C3, G3, C4, E4)])
song["A1"]["Piano"].write(28, [ 2.0, 2.0, 2.0, 2.0],
[(F2, C3, G3, C4), (C2, C3, E3, G3), (G2, D2, G3, B3), (C2, C3, G3, C4)])
# Section A2
song["A2"].add("Vocal", Lead_1_Square)
song["A2"].add("Guitar 1", Electric_Guitar_Clean)
song["A2"].add("Guitar 2", Electric_Guitar_Clean)
song["A2"].add("Bass", Electric_Bass_Pick)
song["A2"].add("Drum", Percussion)
song["A2"].add("Piano", Acoustic_Grand_Piano)
song["A2"].add("String", String_Ensemble_1)
song["A2"]["Vocal"].write(3.5, [.25, .25, .50, .25, .75, .50, .50, .25, .75, .50, .50, .25, .75, .50, 1.0],
[ C4, D4, E4, C4, A3, D4, B3, G3, E3, B3, A3, G3, C3, G3, E3],
['も','ど','ら','な','い','し','あ','わ','せ','が','あ','る','こ','と','を'])
song["A2"]["Vocal"].write(11.5, [.25, .25, 1.0, .50, .25, .25, 1.0, .50, .25, .25, 1.0, .50, .25, .25, 1.0],
[ D3, E3, F3, C4, B3, C4, G3, F3, E3, F3, Fs3, C4, B3, A3, Gs3],
['さ','い','ご','に','あ','な','た','が','お','し','え','て','く','れ','た'])
song["A2"]["Vocal"].write(19.5, [.25, .25, .50, .25, .75, .50, .50, .25, .75, .50, .50, .25, .75, .50, 1.0],
[ C4, D4, E4, C4, A3, D4, B3, G3, E3, B3, A3, G3, C3, G3, E3],
['い','え','ず','に','か','く','し','て','た','く','ら','い','か','こ','も'])
song["A2"]["Vocal"].write(27.5, [.25, .25, 1.0, .50, .25, .25, .50, .50, .50, .50, .25, .75, .25, .50, .25, 1.0],
[ D3, E3, F3, G3, F3, G3, E3, G3, C4, E4, D4, D4, D4, C4, C4, C4],
['あ','な','た','が','い','な','きゃ','えい','えん','に','く','ら','い','','ま','ま'])
song["A2"]["Guitar 1"].write(4, [.50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50],
[ E5, C5, G5, C5, B4, D5, G5, B4, C5, D5, G5, C5, C5, D5, E5, C5])
song["A2"]["Guitar 1"].write(12, [.50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, 1.0],
[ D5, C5, G5, C5, C5, D5, G5, C5, A4, Ds4, C5, A4, D5, Gs4, B4])
song["A2"]["Guitar 1"].write(20, [.50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50],
[ E5, C5, G5, C5, B4, D5, G5, B4, C5, D5, G5, C5, C5, D5, E5, C5])
song["A2"]["Guitar 1"].write(28, [.50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, 1.0],
[ D5, C5, G5, C5, C5, D5, G5, C5, B4, E4, Gs4, E4, E5, A4, C5])
song["A2"]["Guitar 2"].write(4, [.50, .50, .50, .50, .50, .50, 1.0, .50, .50, .50, .50, .50, .50, 1.0],
[ C4, G3, E4, G3, D4, G3, C4, F4, G3, D4, G3, E4, G3, C4])
song["A2"]["Guitar 2"].write(12, [.50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, 1.0],
[ F4, C4, D4, G3, E4, G3, C4, G3, C4, Ds3, A3, Ds3, D4, E3, Gs3])
song["A2"]["Guitar 2"].write(20, [.50, .50, .50, .50, .50, .50, 1.0, .50, .50, .50, .50, .50, .50, 1.0],
[ C4, G3, E4, G3, D4, G3, C4, F4, G3, D4, G3, E4, G3, C4])
song["A2"]["Guitar 2"].write(28, [.50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, 1.0],
[ F4, C4, D4, G3, E4, G3, C4, G3, Gs3, E3, Gs3, E3, A3, E3, A3])
song["A2"]["Bass"].write(4, [2.0, .75, 1.25, 2.0, .75, .25, 1.0, 2.0, .75, .25, 1.0, 2.0, .75, .25, 1.0],
[ A1, G1, G1, F1, C2, C2, C2, F1, C2, C2, C2, Ds2, E2, E2, E1])
song["A2"]["Bass"].write(20, [2.0, .75, 1.25, 2.0, .75, .25, 1.0, 2.0, .75, .25, 1.0, 2.0, .75, .25, 1.0],
[ A1, G1, G1, F1, C2, C2, C2, F1, C2, C2, C2, E1, A1, A1, A1])
song["A2"]["Drum"].write(4, [1.0, .50, .25, .25, .75, .25, 1.0] * 7,
[ XB, Xhc, '', XB, XB, XB, Xhc] * 7)
song["A2"]["Drum"].write(4, [.50, .50, .50, .50, .50, .50, .50, .50] * 7,
[ '', XHc, XHc, XHc, '', XHc, XHc, XHc] * 7)
song["A2"]["Drum"].write(32, [1.0, .50, .25, .25, .75, .25, .50, .166, .167, .167],
[ XB, Xhc, '', XB, XB, XB, Xhc, XS, XS, XS])
song["A2"]["Drum"].write(32, [.50, .50, .50, .50, .50, .50, .50, .50],
[ '', XHc, XHc, XHc, '', XHc, XHc, ''])
song["A2"]["Piano"].write(4, [ 2.0, 2.0, 2.0, 2.0],
[(A2, A3, C4, E4), (G2, G3, B3, D4), (F2, F3, G3, C4), (C2, C3, E3, G3)])
song["A2"]["Piano"].write(12, [ 2.0, 2.0, 2.0, 2.0],
[(F2, C3, F3, A3), (C2, C3, E3, G3), (Ds2, A2, Ds3, Fs3, C4), (E2, B2, E3, Gs3, D4)])
song["A2"]["Piano"].write(20, [ 2.0, 2.0, 2.0, 2.0],
[(A2, A3, C4, E4), (G2, G3, B3, D4), (F2, F3, G3, C4), (C3, G3, C4, E4)])
song["A2"]["Piano"].write(28, [ 2.0, 2.0, 2.0, 2.0],
[(F2, C3, F3, A3), (C2, C3, E3, G3), (E2, B2, E3, Gs3), (A2, E3)])
song["A2"]["Piano"].write(34, [ 1.0, 1.0],
[(A3, C4), A3])
song["A2"]["String"].write(4, [ 2, 10, 2, 2, 4, 2, 6, 2, 2],
['', (G5, G6), (Fs5, Fs6), (E5, E6), (G5, G6), (A5, A6), (G5, G6), (E5, E6), (C5, C6)])
# Section B1
song["B1"].add("Vocal", Lead_1_Square)
song["B1"].add("Guitar 1", Electric_Guitar_Clean)
song["B1"].add("Guitar 2", Electric_Guitar_Clean)
song["B1"].add("Drum", Percussion)
song["B1"].add("Piano", Acoustic_Grand_Piano)
song["B1"]["Vocal"].write(0, [.75, .25, .50, .25, .25, .50, .50, 1.0, .75, .25, .50, .25, .25, .50, .50, .50],
[ A3, B3, C4, B3, A3, G3, E4, E4, D4, E4, F4, E4, D4, C4, D4, G3],
['きっ','と','もう','こ','れ','い','','じょう','き','ず','つ','く','こ','と','な','ど'])
song["B1"]["Vocal"].write(8, [.75, .25, .50, .25, .25, .50, .50, .50, .50, 1.0, .50, .50, .50, .50, .25, .25, .25, .25],
[ F3, G3, A3, G3, F3, E3, C4, C4, C4, B3, A3, B3, C4, '', D4, E4, D4, C4],
['あ','り','は','し','な','い','','と','わ','かっ','て','い','る','','あ','の','ひ','の'])
song["B1"]["Guitar 1"].write(14, [ .25, .25],
[ (C3, C4), (C3, C4)])
song["B1"]["Guitar 2"].write(14, [ .25, .25],
[ (C3, C4), (C3, C4)])
song["B1"]["Drum"].write(0, [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, .50, .166, .167, .167],
[XSe, Xhc, '', Xhc, '', Xhc, '', Xhc, XSe, XSe, XSe])
song["B1"]["Drum"].write(8, [1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
[XSe, Xhc, '', Xhc, '', Xhc])
song["B1"]["Piano"].write(0, [ 2.0, 2.0, 2.0, 2.0],
[(D3, A3, D4, F4), (A2, A3, C4, E4), (G2, G3, B3, D4), (C3, G3, C4, E4)])
song["B1"]["Piano"].write(8, [ 2.0, 2.0, 1.0, 1.0, 1.0],
[(D3, A3, D4, F4), (A2, A3, C4, E4), (F2, F3, A3, D4), (G2, D3, G3, B3), (C3, G3, C4, E4)])
# Section C1
song["C1"].add("Vocal", Lead_1_Square)
song["C1"].add("Guitar 1_", Electric_Guitar_Distortion)
song["C1"].add("Guitar 2_", Electric_Guitar_Distortion)
song["C1"].add("Bass", Electric_Bass_Pick)
song["C1"].add("Drum", Percussion)
song["C1"].add("Piano", Acoustic_Grand_Piano)
song["C1"].add("String", String_Ensemble_1)
song["C1"]["Vocal"].write(0, [.25, .75, .25, .75, .25, .25, .50, .25, .25, .25, .25, .25, .75, .25, .75, .25, .25, .50, .25, .25, .25, .25],
[ A3, C4, E4, G4, D4, C4, '', D4, E4, D4, C4, A3, C4, E4, G4, D4, C4, '', D4, E4, D4, C4],
['か','な','し','み','さ','え','','あ','の','ひ','の','く','る','し','み','さ','え','','そ','の','す','べ'])
song["C1"]["Vocal"].write(8, [.25, .75, .25, .75, .25, .75, .25, .75, .25, .75, .25, .75, .50, .50, .25, .25, .25, .25],
[ A3, C4, E4, G4, A4, G4, G4, C5, B4, G4, E4, G4, D4, '', D4, E4, D4, C4],
['て','を','あ','いし','て','た','あ','な','た','と','と','も','に','','む','ね','に','の'])
song["C1"]["Vocal"].write(16, [.25, .75, .25, .75, .25, .75, .25, .25, .25, .25, .25, .75, .25, .75, 1.0, .50, .25, .25],
[ A3, C4, E4, G4, D4, C4, C4, C4, D4, E4, F4, E4, D4, B3, C4, '', C4, B3],
['こ','り','は','な','れ','な','い','に','が','い','れ','もん','の','に','おい','','あ','め'])
song["C1"]["Vocal"].write(24, [.50, .50, .50, .50, .50, .50, .25, .75, .25, .75, .25, .75, 1.0, .50, .25, .25],
[ A3, B3, C4, D4, C4, G3, E3, G3, A3, D4, B3, C4, C4, '', C4, B3],
['が','ふ','り','や','む','ま','で','は','か','え','れ','な','い','','い','ま'])
song["C1"]["Vocal"].write(32, [.50, .50, .50, .50, .50, .50, .25, .75, .25, .75, .25, .75, 1.0],
[ A3, B3, C4, D4, C4, G3, C4, D4, E4, F4, D4, C4, C4],
['で','も','あ','な','た','は','わ','た','し','の','ひ','か','り'])
song["C1"]["Guitar 1_"].write(0, [ .50, .50, .50, .25, .25, .25, .25, .50, .50, .25, .25],
[(F2, C3, F3, A3), '/', '/', '/', '/', (C3, G3, C4, E5), '/', '/', '/', '/', '/'])
song["C1"]["Guitar 1_"].write(4, [ .50, .50, .50, .25, .25, .25, .25, .50, .50, .25, .25],
[(G2, D3, G3, B3), '/', '/', '/', '/', (A2, E3, A3, C4), '/', '/', '/', '/', '/'])
song["C1"]["Guitar 1_"].write(8, [ .50, .50, .50, .25, .25, .25, .25, .50, .50, .25, .25],
[(F2, C3, F3, A3), '/', '/', '/', '/', (C3, G3, C4, E5), '/', '/', '/', '/', '/'])
song["C1"]["Guitar 1_"].write(12, [ .50, .50, .50, .25, .25, .25, .25, .50, .50, .25, .25],
[(G2, D3, G3, B3), '/', '/', '/', '/', (E3, Gs3, D4, E4), '/', '/', '/', '/', '/'])
song["C1"]["Guitar 1_"].write(16, [ .50, .50, .50, .25, .25, .25, .25, .50, .50, .25, .25],
[(F2, C3, F3, A3), '/', '/', '/', '/', (C3, G3, C4, E5), '/', '/', '/', '/', '/'])
song["C1"]["Guitar 1_"].write(20, [ 1.0, .50, .25, .25, 1.0, .50, .25, .25],
[(B2, F3, B3, D4), (E3, B3, D4), '/', '/', (A2, E3, A3, C4), '/', '/', '/'])
song["C1"]["Guitar 1_"].write(24, [ .50, .50, .50, .25, .25, .25, .25, .50, .50, .25, .25],
[(D3, A3, D4), '/', '/', '/', '/', (A2, E3, A3), '/', '/', '/', '/', '/'])
song["C1"]["Guitar 1_"].write(28, [ 1.0, 1.0, 1.0, .50, .25, .25],
[(F2, C3, F3), (G2, D3, G3), (Fs2, C3, Fs3), '/', '/', '/'])
song["C1"]["Guitar 1_"].write(32, [ .50, .50, .50, .25, .25, .25, .25, .50, .50, .25, .25],
[(D3, A3, D4), '/', '/', '/', '/', (A2, E3, A3), '/', '/', '/', '/', '/'])
song["C1"]["Guitar 1_"].write(36, [ 1.0, 1.0, .75, .25, 1.0],
[(F2, C3, F3), (G2, D3, G3), (C3, G3, C4), '/', '/'])
song["C1"]["Guitar 2_"].write(0, [ .50, .50, .50, .25, .25, .25, .25, .50, .50, .25, .25],
[(F2, C3, F3, A3), '/', '/', '/', '/', (C3, G3, C4, E5), '/', '/', '/', '/', '/'])
song["C1"]["Guitar 2_"].write(4, [ .50, .50, .50, .25, .25, .25, .25, .50, .50, .25, .25],
[(G2, D3, G3, B3), '/', '/', '/', '/', (A2, E3, A3, C4), '/', '/', '/', '/', '/'])
song["C1"]["Guitar 2_"].write(8, [ .50, .50, .50, .25, .25, .25, .25, .50, .50, .25, .25],
[(F2, C3, F3, A3), '/', '/', '/', '/', (C3, G3, C4, E5), '/', '/', '/', '/', '/'])
song["C1"]["Guitar 2_"].write(12, [ .50, .50, .50, .25, .25, .25, .25, .50, .50, .25, .25],
[(G2, D3, G3, B3), '/', '/', '/', '/', (E3, Gs3, D4, E4), '/', '/', '/', '/', '/'])
song["C1"]["Guitar 2_"].write(16, [ .50, .50, .50, .25, .25, .25, .25, .50, .50, .25, .25],
[(F2, C3, F3, A3), '/', '/', '/', '/', (C3, G3, C4, E5), '/', '/', '/', '/', '/'])
song["C1"]["Guitar 2_"].write(20, [ 1.0, .50, .25, .25, 1.0, .50, .25, .25],
[(B2, F3, B3, D4), (E3, B3, D4), '/', '/', (A2, E3, A3, C4), '/', '/', '/'])
song["C1"]["Guitar 2_"].write(24, [ .50, .50, .50, .25, .25, .25, .25, .50, .50, .25, .25],
[(D3, A3, D4), '/', '/', '/', '/', (A2, E3, A3), '/', '/', '/', '/', '/'])
song["C1"]["Guitar 2_"].write(28, [ 1.0, 1.0, 1.0, .50, .25, .25],
[(F2, C3, F3), (G2, D3, G3), (Fs2, C3, Fs3), '/', '/', '/'])
song["C1"]["Guitar 2_"].write(32, [ .50, .50, .50, .25, .25, .25, .25, .50, .50, .25, .25],
[(D3, A3, D4), '/', '/', '/', '/', (A2, E3, A3), '/', '/', '/', '/', '/'])
song["C1"]["Guitar 2_"].write(36, [ 1.0, 1.0, .75, .25, 1.0],
[(F2, C3, F3), (G2, D3, G3), (C3, G3, C4), '/', '/'])
song["C1"]["Bass"].write(0, [1.25, .25, .25, .25, .75, .25, 1.0, 1.25, .25, .25, .25, .75, .25, 1.0],
[ F1, F1, A1, B1, C2, C2, C2, G1, E1, G1, Gs1, A1, A1, A1])
song["C1"]["Bass"].write(8, [1.5, .50, .75, .25, 1.0, 1.25, .25, .25, .25, .75, .25, 1.0],
[ F1, F1, C2, C2, C2, G1, E1, G1, Gs1, E2, E2, E1])
song["C1"]["Bass"].write(16, [1.25, .25, .25, .25, .75, .25, 1.0, 1.0, 1.0, .75, .25, .50, .50],
[ F1, F1, A1, B1, C2, G1, C2, B1, E2, A1, A1, A1, A1])
song["C1"]["Bass"].write(24, [2.0, .75, .25, 1.0, 1.0, 1.0, .50, .50, 1.0],
[ D2, A1, A1, A1, F1, G1, Fs1, Fs1, Fs2])
song["C1"]["Bass"].write(32, [1.5, .50, 1.5, .25, .25, 1.0, 1.0, .75, .25],
[ D2, D2, A2, D2, E2, F2, G2, C2, C2])
song["C1"]["Drum"].write(0, [1.0, 1.0, .75, .25, 1.0, 1.0, .50, .25, .25, .75, .25, 1.0] * 4,
[ XB, XS, XB, XB, XS, XB, XS, '', XB, XB, XB, XS] * 4)
song["C1"]["Drum"].write(32, [1.0, .50, .25, .25, .75, .25, 1.0, 1.0, 1.0, .75, .25, .50],
[ XB, XS, '', XB, XB, XB, XS, XB, XS, XB, XB, XS])
song["C1"]["Drum"].write(0, [ .50] + [.50] * 31,
[(XC1, XC2)] + [XHc] * 31)
song["C1"]["Drum"].write(16, [.50] + [.50] * 31,
[XC1] + [XHc] * 31)
song["C1"]["Drum"].write(32, [.50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50, .50],
[XC1, XHc, XHc, XHc, XHc, XHc, XHc, XHc, XC1, XHc, XC2, XHc, XC1, XHc, XHc])
song["C1"]["Piano"].write(0, [2.0, .50, 1.5, 2.0, .50, 1.5], [F2, '', C3, G2, '', A2])
song["C1"]["Piano"].write(0, [.50, 1.0, .50, .50, 1.0, .50] * 2, [F3, F3, F3, '', G3, G3, D3, D3, D3, '', E3, E3])
song["C1"]["Piano"].write(0, [1.0, 1.0, .25, .75, 1.0] * 2, [(A3, C4), A3, '', (C4, E4), C4, (G3, B3), G3, '', (A3, E4), A3])
song["C1"]["Piano"].write(8, [2.0, .50, 1.5, 2.0, 2.0], [F2, C3, C3, G2, E2])
song["C1"]["Piano"].write(8, [.50, 1.0, .50, 1.5, .50, .50, 1.0, .50, .50, .50, 1.0], [F3, F3, F3, E3, E3, D3, D3, D3, E3, E3, E3])
song["C1"]["Piano"].write(8, [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0], [(A3, C4), A3, (G3, C4), G3, (G3, B3), G3, (Gs3, B3, D4)])
song["C1"]["Piano"].write(16, [2.0, .50, 1.5, 1.0, 1.0, 2.0], [F2, '', C3, B2, E2, A2])
song["C1"]["Piano"].write(16, [.50, 1.0, .50, .50, 1.0, .50, 2.5, 1.5], [F3, F3, F3, '', G3, G3, '', E3])
song["C1"]["Piano"].write(16, [1.0, 1.0, .25, .75, 1.0, 1.0, 1.0, 1.0, 1.0], [(A3, C4), A3, '', (C4, E4), C4, (B3, D4, F4), (Gs3, B3, E4), (A3, C4, E4), (A3, C4, E4)])
song["C1"]["Piano"].write(24, [1.0, 1.0, 2.0, 1.0, 1.0, 1.0, 1.0], [D2, D2, A2, F2, G2, Fs2, Fs2])
song["C1"]["Piano"].write(24, [2.0, 2.0, 2.5, .50], [D3, A3, '', C2])
song["C1"]["Piano"].write(24, [1.25, .25, .25, .25, 1.25, .25, .25, .25], [(F3, A3), A4, B4, C5, C5, A4, B4, C5])
song["C1"]["Piano"].write(28, [1.0, 1.0, 1.0, 1.0], [(F3, A3, C4), (G3, B3, D4), (Fs3, A3, C4), (Fs3, A3, C4)])
song["C1"]["Piano"].write(32, [2.0, 2.0, 1.0, 1.0, .75, .25], [D2, A2, F2, G2, C3, C3])
song["C1"]["Piano"].write(32, [.50, 1.0, .50, .50, 1.0, .50], ['', A2, A2, '', E3, E3])
song["C1"]["Piano"].write(32, [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, .75, .25], [(F3, A3, D4, F4), '/', (A3, C4, E4), '/', (A3, C4, F4), (B3, D4, G4), (G3, C4, E4), '/'])
song["C1"]["String"].write(0, [2.0, 2.0, 2.0, 2.0], [(G5, G6), (C5, C6), (D5, D6), (E5, E6)])
song["C1"]["String"].write(8, [3.0, 1.0, 1.5, 0.5, 1.0, 1.0], [(G5, G6), (C6, C7), (B5, B6), (A5, A6), (Gs5, Gs6), (E5, E6)])
song["C1"]["String"].write(16, [2.0, 1.0, .50, .25, .25], [(C5, C6), (G4, G5), (G4, G5), (C5, C6), (G4, G5)])
song["C1"]["String"].write(20, [.25, .75, .25, .75, 2.0], [(F5, F6), (E5, E6), (D5, D6), (B4, B5), (C5, C6)])
song["C1"]["String"].write(24, [1.5, 0.5, 2.0, 1.0, 1.0, 2.0], [(D4, D5), (F4, F5), (E4, E5), (A4, A5), (B4, B5), (C5, C6)])
song["C1"]["String"].write(32, [2.0, 1.0, 1.0, .25, .75, 1.0, 1.0], [(F5, F6), (E5, E6), (C5, C6), (A4, A5), (D5, D6), (B4, B5), (C5, C6)])
song.save("lemon.mid")
song.view()