无法使用MusicCore显示乐谱的png表示形式

2024-04-29 01:00:26 发布

您现在位置:Python中文网/ 问答频道 /正文

使用music21显示乐谱following instructions的png:

Some formats have sub-formats, for instance both musicxml and lilypond have a .png subformat which converts directly to a .png file. To use that, call .show("musicxml.png").

import music21 as m21    
us = m21.environment.UserSettings()
us['musicxmlPath'] = r'C:\Program Files\MuseScore 3\bin\MuseScore3.exe'
us['musescoreDirectPNGPath'] = r'C:\Program Files\MuseScore 3\bin\MuseScore3.exe'


s = m21.corpus.parse('josquin/milleRegrets')
s.show('musicxml.png')

File "C:\Users\xxx\miniconda3\lib\subprocess.py", line 1307, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable

Jupyter和Spyder中也有同样的错误。当然,通往MuseScore的道路是正确的。用musicxml作品替换musicxml.png,MuseScore打开并显示该乐谱


Tags: binpnghaveshowfilesprogramexemusic21