Reputation: 53
so I have the code below
m3 = stream.Measure()
m4 = stream.Measure()
m5 = stream.Measure()
m3.append(instrument.Guitar())
m4.append(instrument.Tuba())
m5.append(instrument.Harp())
#----adding notes to track------#
newNote = note.Note('F')
newNote.duration.type = 'quarter'
m3.append(newNote)
newNote = note.Note('A')
newNote.duration.type = 'eighth'
m4.append(newNote)
newNote = note.Note('G')
newNote.duration.type = 'quarter'
m5.append(newNote)
#-----adding tracks to song------------#
song = stream.Score()
song.insert(0,m3)
song.insert(0,m4)
song.insert(0,m5)
song.write('midi', 'blah.mid')
i want to create a song with 3 different tracks and each playing a different instrument. above code kind of combines everything into 1 track and overwrites the first 2 instruments. Is there a way that I can do this?
Upvotes: 0
Views: 630
Reputation: 53
Ok, I figured it out. I need to change
m3 = stream.Measure()
to m3 = stream.Part()
and
m3.append(instrument.Guitar())
to m3.insert(instrument.Guitar())
Upvotes: 1