Music21-无法显示休息

发布于 2025-02-11 03:31:32 字数 596 浏览 2 评论 0 原文

我正在将乐谱的部分切成节拍中的片段。我正在使用Music21和Lilypond将输出转换为PNG。尽管有一个非常具体的问题,但是我没有只显示摘要只包含休息。如果其余的用注释显示,则可以很好地显示。但是,如果条由休息组成,则图像为空白。我的猜测是,该程序在没有贝司谱号的上下文时不知道将其余的位置放置。 。如果有人可以提供一些很酷的见解! 当我使用上述代码时,请加油,

n = note.Note("C4")

r = note.Rest()

ss = stream.Stream()


ss.append(n)

ss.append(r)

ss.show("lily")

我将获得

然后,当我使用以下代码时,我将获得


r = note.Rest()

ss = stream.Stream()



ss.append(r)

ss.show("lily")

I'm cutting up sections of sheet music into snippets on the beat. I'm using music21 and LilyPond to convert the output into a png. There's a very specific issue though where I get no display of a snippet only containing a rest. If the rest is being displayed with note then it shows fine.. but if the bar consists of a rest and nothing else the image is blank. My guess would be the program doesn't know where to place the rest when there's no context to wether a bass clef - stave is being used.. but I did attempt to providing placement information to the rest through Style.absoluteY module but no joy. If anybody could provide a bit of insight that'd be cool! Cheers

n = note.Note("C4")

r = note.Rest()

ss = stream.Stream()


ss.append(n)

ss.append(r)

ss.show("lily")

When I use the above code I get an output of image of 1/4 note and 1/4 rest

Then, when I use the below code I get an output of blank white box, where there should be a single 1/4 rest


r = note.Rest()

ss = stream.Stream()



ss.append(r)

ss.show("lily")

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

〆一缕阳光ご 2025-02-18 03:31:32

Lilypond界面不是那么强,所以更好的是安装MusesCore

add-apt-repository ppa:mscore-ubuntu/mscore3-stable
apt update
apt install musescore3

pip uninstall music21
pip install music21

输出:

”在此处输入图像描述”

Lilypond interface is not so strong, so better would be to install MuseScore

add-apt-repository ppa:mscore-ubuntu/mscore3-stable
apt update
apt install musescore3

pip uninstall music21
pip install music21

output:

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文