簡體   English   中英

音樂21-> stream.chordify()不起作用

[英]music21 --> stream.chordify() not working

這里有音樂的新手。

我正在嘗試使用chordify(): http ://web.mit.edu/music21/doc/usersGuide/usersGuide_09_chordify.html

如何從Midi文件獲取流對象(可以在其上調用chordify())?

我嘗試了兩種方法:

1:

s = converter.parse(fn)
for el in s.recurse():
    print '\n'
    if 'Stream' in el.classes:
        el.chordify() # NOT WORKING! throws error.
    if 'Score' in el.classes:
        el.chordify() # NOT WORKING EITHER! also throws error.

2:

stream = c.parseFile(fn, format='.mid')
print stream # NOTHING! stream is None

預先感謝您告訴我如何從我的midi文件中獲取要在其上調用chordify()的流對象。

您的第一個答案是正確的。 跑步后

s = converter.parse(fn)

s2 = s.chordify()

然后,您可以調用s2.show()或任何您想要的東西。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM