from mido import Message, MidiFile, MidiTrack, bpm2tempo
mid = MidiFile()
track = MidiTrack()
mid.tracks.append(track)
tempo = bpm2tempo(70) # 70 bpm para clima romântico
track.append(Message('program_change', program=24, time=0)) # Piano acústico
quarter_note = 480
def add_chord(notes, duration):
for note in notes:
track.append(Message('note_on', note=note, velocity=64, time=0))
track.append(Message('note_off', note=notes[0], velocity=64, time=duration))
for note in notes[1:]:
track.append(Message('note_off', note=note, velocity=64, time=0))
progression = [
[57, 60, 64], # Am
[62, 65, 69], # Dm
[67, 71, 74], # G
[60, 64, 67], # C
[65, 69, 72], # F
[64, 68, 74], # E7
[57, 60, 64], # Am
]
for chord in progression:
add_chord(chord, quarter_note * 4)
mid.save("O_Homem_dos_meus_Sonhos_Ana_Carolina_Style.mid")
print("Arquivo MIDI criado: O_Homem_dos_meus_Sonhos_Ana_Carolina_Style.mid")