LilyPond

LilyPond 表示法雕刻机可以通过 lilypond-book 命令与 LaTeX 一起使用。首先让我们创建一个 LaTeX 文档(文件扩展名为 .lytex),将我们的音乐嵌入:

\documentclass[letterpaper,12pt]{article}

\begin{document}

\begin{center}
    {\fontsize{24pt}{24pt}\textbf{Twa Corbies}}\\
\end{center}

\begin{flushright}
    \textsc{Your Name}
\end{flushright}

% We don't need to require anything for this because lilypond-book will process it.
\lilypondfile{TwaCorbies.ly}
\end{document}

然后我们创建我们的 LilyPond 文件(.ly),包括 lilypond-book-preamble.ly 文件(LilyPond 将知道如何查找):

\version "2.16.2"

\include "lilypond-book-preamble.ly"

voice = <<
    \relative c' {
        \tempo "con affetto"
        \clef bass
        \key e \minor
        \time 3/4

        a a b | c a a | g a2 |
        a4 a b | c2 ~ c8 a8 | a8 g a2 |
        \bar "|."
    }
    \addlyrics{
        As I was wal -- king all a -- lane
        I heard twa cor -- bies make a mane.
    }
>>

\score {
    <<
        \new Staff = "voice" {
            \voice
        }
    >>
    \layout { }
    \midi {
        \context {
            \Score
            tempoWholesPerMinute = #(ly:make-moment 90 4)
        }
    }
}

为了构建,我们然后运行 lilypond-book 命令:

lilypond-book --include=mymusicsourcedirectory/ --pdf TwaCorbies.lytex

这将输出包含 LilyPond 雕刻音乐的 PDF:

StackOverflow 文档