-
Notifications
You must be signed in to change notification settings - Fork 144
Description
from music21 import stream, note, chord, meter, key, tempo
part = stream.Part()
part.append(meter.TimeSignature('4/4'))
part.append(key.Key('C'))
part.append(tempo.MetronomeMark(number=100))
chords = [
["C4", "E4", "G4"],
["G3", "B3", "D4"],
["A3", "C4", "E4"],
["F3", "A3", "C4"],
]
melody_notes = [
"E4", "G4", "G4", "A4", "G4", "F4",
"E4", "F4", "G4", "F4", "E4", "D4",
"G4", "A4", "A4", "B4", "A4", "G4",
"F4", "G4", "A4", "A4", "G4", "F4"
]
note_index = 0
for _ in range(4):
for chord_notes in chords:
part.append(chord.Chord(chord_notes, quarterLength=1))
part.append(note.Note(melody_notes[note_index], quarterLength=1))
note_index += 1
score = stream.Score()
score.insert(0, part)
midi_fp = "/content/jeden_swiat_chorus_pop.mid"
score.write('midi', fp=midi_fp)
print("✅ Gotowe! Ściągnij plik poniżej 👇")