0

所以我有下面的代码

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')

我想创建一首包含 3 条不同轨道且每条都演奏不同乐器的歌曲。上面的代码类型将所有内容组合成 1 个音轨并覆盖前 2 个乐器。有没有办法我可以做到这一点?

4

1 回答 1

1

好的,我想通了。我需要将 m3 = stream.Measure() 更改为 m3 = stream.Part() 和 m3.append(instrument.Guitar()) 更改为 m3.insert(instrument.Guitar())

于 2020-07-30T01:19:58.270 回答