TPP*_*PPZ 7 python latex lilypond musicxml
我正在尝试使用 MuseScore 3 作为小音乐片段的编辑器,例如从 MusicXML 文件打开的童谣。
然而,我尝试使用 Frescobaldi Python 库python-ly似乎导致使用该库生成的 MusicXML 文件出现一些非常奇怪的导入错误。
我该怎么做呢?有可能吗?
我为例如“老麦克唐纳有一个农场”编写了一些 LilyPond 文件,其中包括主旋律(音符)、歌词、尤克里里谱和和弦:
% command `lilypond --version`
\version "2.20.0"
mymelody = {
\time 4/4
\tempo 4 = 70
\key g \major
g'4 g'4 g'4 d'4 \bar "|" e'4 e'4 d'2 \bar "|" b'4 b'4 a'4 a'4 \bar "|" g'1
}
mychords = \chordmode {
g'1 \bar "|" c'2 d'2 \bar "|" g'2 d'2 \bar "|" g'1
}
mylyrics = \lyricmode {
old Mac -- Do -- nald had a farm, E -- I E -- I Oh
}
% https://lilypondcookbook.com/post/83531286313/fretted-strings-3-string-specific-notation
\score { \new StaffGroup <<
\new ChordNames { << \mychords >> }
\new Voice = "mywords" { << \mymelody >> }
\new Lyrics = "mywords"
\context Lyrics = "mywords" {
\lyricsto "mywords" {
\mylyrics
}
}
\new TabStaff \with { stringTunings = #ukulele-tuning } { \mymelody }
>> }
Run Code Online (Sandbox Code Playgroud)
它通过 LaTeX 呈现lyluatex为 PDF 片段,如下所示:
然后在 Python 方面,我将此old-macdonald-had-a-farm.ly文件导出到 MusicXML:
% command `lilypond --version`
\version "2.20.0"
mymelody = {
\time 4/4
\tempo 4 = 70
\key g \major
g'4 g'4 g'4 d'4 \bar "|" e'4 e'4 d'2 \bar "|" b'4 b'4 a'4 a'4 \bar "|" g'1
}
mychords = \chordmode {
g'1 \bar "|" c'2 d'2 \bar "|" g'2 d'2 \bar "|" g'1
}
mylyrics = \lyricmode {
old Mac -- Do -- nald had a farm, E -- I E -- I Oh
}
% https://lilypondcookbook.com/post/83531286313/fretted-strings-3-string-specific-notation
\score { \new StaffGroup <<
\new ChordNames { << \mychords >> }
\new Voice = "mywords" { << \mymelody >> }
\new Lyrics = "mywords"
\context Lyrics = "mywords" {
\lyricsto "mywords" {
\mylyrics
}
}
\new TabStaff \with { stringTunings = #ukulele-tuning } { \mymelody }
>> }
Run Code Online (Sandbox Code Playgroud)
最后我打开了MuseScore 3的GUI,点击文件>打开,然后打开old-macdonald-had-a-farm.xml,然后我发现弹出窗口中有很多非常严重但奇怪的错误:
Bar 9, stave 1 incomplete. Expected: 4/4; Found: 7/4
Bar 9, stave 2 incomplete. Expected: 4/4; Found: 7/4
Bar 9, stave 3 incomplete. Expected: 4/4; Found: 7/4
Bar 11, stave 1 incomplete. Expected: 4/4; Found: 5/4
Bar 11, stave 2 incomplete. Expected: 4/4; Found: 5/4
Bar 11, stave 3 incomplete. Expected: 4/4; Found: 5/4
Bar 13, stave 1 incomplete. Expected: 4/4; Found: 6/4
Bar 13, stave 2 incomplete. Expected: 4/4; Found: 6/4
Bar 13, stave 3 incomplete. Expected: 4/4; Found: 6/4
Run Code Online (Sandbox Code Playgroud)
乐谱对我来说似乎不错(见上面的屏幕截图)。
然后在 MuseScore 3 上看起来像:
我很难看出上述过程有什么问题。
是因为 LilyPond 文件必须以非常简单的方式编写,例如只有旋律音符,还是我所做的有什么问题?