我是在这里写问题的新手,所以请随时指出我如何提高未来问题的质量!
编辑:包含更多代码,如评论中所要求的那样
我正在尝试将 GuitarPro 文件读入 python。这些文件本质上包含歌曲的乐谱,但包含比 MIDI 文件更多的信息。
我想将笔记和笔记的持续时间解析为例如列表结构。此外,我希望其他效果也可以从 GuitarPro 文件中解析出来,例如弯曲、滑动、锤击等。
我一直在尝试使用库PyGuitarPro,但被卡住了:
import guitarpro
import os
# 'wet_sand.gp5' is the guitar pro file
parsed_song = guitarpro.parse('wet_sand.gp5')
song = guitarpro.gp5.GP5File(parsed_song,encoding='UTF-8')
song.readSong()
ReadSong()
我从(此处的文档)收到以下错误:
Traceback (most recent call last):
File "<ipython-input-15-e1663229852d>", line 8, in <module>
song.readSong()
File "C:\Python27\lib\site-packages\guitarpro\gp5.py", line 62, in readSong
song.version = self.readVersion()
File "C:\Python27\lib\site-packages\guitarpro\iobase.py", line 114, in readVersion
self.version = self.readByteSizeString(30)
File "C:\Python27\lib\site-packages\guitarpro\iobase.py", line 97, in readByteSizeString
return self.readString(size, self.readByte())
File "C:\Python27\lib\site-packages\guitarpro\iobase.py", line 47, in readByte
return (self.read(*args, default=default) if count == 1 else
File "C:\Python27\lib\site-packages\guitarpro\iobase.py", line 35, in read
data = self.data.read(count)
AttributeError: 'Song' object has no attribute 'read'