I'm hoping to run a corpus study on some local Lilypond (.ly) files, but I'm having trouble importing them into a local music21 corpus.
I can only assume the answer is on the music21.converter page, but I somehow can't seem to untangle it. As suggested at the top of that page, I have tried:
converter.parse('/home/richard/test.ly')
Only to receive:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/richard/.local/lib/python3.9/site-packages/music21/converter/__init__.py", line 1168, in parse
return parseFile(valueStr, number=number, format=m21Format,
File "/home/richard/.local/lib/python3.9/site-packages/music21/converter/__init__.py", line 1027, in parseFile
v.parseFile(fp, number=number, format=format, forceSource=forceSource, **keywords)
File "/home/richard/.local/lib/python3.9/site-packages/music21/converter/__init__.py", line 548, in parseFile
useFormat = self.getFormatFromFileExtension(fp)
File "/home/richard/.local/lib/python3.9/site-packages/music21/converter/__init__.py", line 526, in getFormatFromFileExtension
raise ConverterFileException(f'cannot find a format extensions for: {fp}')
music21.converter.ConverterFileException: cannot find a format extensions for: /home/richard/test.ly
Can anyone clarify the proper way to import these .ly files? I'm unfortunately new to Python, so I'm afraid I don't entirely know what I don't know.