Updated music section

This commit is contained in:
Kenneth John Odle 2023-06-26 18:08:34 -04:00
parent 9560f94138
commit b14101b4de
5 changed files with 66 additions and 7 deletions

BIN
003/build/songs-01.pdf Normal file

Binary file not shown.

BIN
003/build/songs-02.pdf Normal file

Binary file not shown.

View File

@ -94,13 +94,16 @@
% Use nice fractions
\usepackage{nicefrac}
% Keep the footnotes at the bottom of the page
\usepackage[bottom]{footmisc}
% Just for issue #003:
\usepackage{mathtools}
\usepackage{wasysym}
\usepackage{harmony}
\usepackage{musixtex}
\usepackage[generate,ps2eps]{abc}
\usepackage{mathptmx} %Necessary for abc package to work?
\usepackage{mathtools}
% Do we want to include URLs?
% Yes, but we also want to hide the big red box it puts around them in the pdf. Thanks /u/0b0101011001001011
@ -231,6 +234,8 @@ As it turns out, there are a number of packages that enable you to include music
First, there is the \texttt{wasysym} (or Waldi Symbol font) package, which is basically a symbol font for LaTeX. It includes a lot of different symbols, including some interesting circles (\Circle{}, \leftturn{}, \rightturn{}) that I could have used on a different project had I known about this then. It's a symbol font, so when it comes to music, what it offers is rudimentary: you can add an eighth note (\eighthnote), a quarter note (\quarternote), a half note (\halfnote), a whole note (\fullnote), or two joined eighth notes (\twonotes). In math mode, you can also add a natural symbol ($\natural$), a flat symbol ($\flat$), or a sharp symbol ($\sharp$).
I have to admit, while I like this, I'm not entirely sure what it's for. It's entirely possible that it started out as one thing and ended up as another. That is certainly true of most of the projects that I've worked on.
\subsection{harmony}
There is also the \texttt{harmony} package, which offers up some additional symbols:
@ -254,7 +259,7 @@ And it also has what I believe is chord notation (although I could be—and prob
I didn't create that. (I don't even know what it means.) I just copied it verbatim from the \texttt{harmony} guide. In reality, it looks like this:
\begin{verbatim}
\begin{Verbatim}[frame=lines, numbers=left, framesep=3mm, label=Harmony example]
%
\def\h#1h{\hspace*{#1em}}
\newcommand{\Str}[2][0.5]{\raise#1ex\hbox to #2em{\hrulefill}}
@ -263,7 +268,7 @@ I didn't create that. (I don't even know what it means.) I just copied it verbat
\h0,5h\HH.D..8\Str[0,65]{1,2}7\ST6\ST5.8\ST6\ST4\Str[0,65]{2}3
.6\ST5\ST8%
\Str[0,65]{3}7.%
\end{verbatim}
\end{Verbatim}
What this tells me is that the \texttt{harmony} package is very good at positioning things around other things. I may just have to tuck that in the back of my mind for later. The guide document for \texttt{harmony} is only five or six pages, but there is a lot of information to absorb there.
@ -271,7 +276,7 @@ What this tells me is that the \texttt{harmony} package is very good at position
And then there is the \texttt{musixtex} package. It makes use of a \texttt{music} environment, with your relevant code (of which there is a lot). I've copied this bit from the \texttt{musixtex} documentation:
\begin{verbatim}
\begin{Verbatim}[frame=lines, numbers=left, framesep=3mm, label=Musixtex example]
\begin{music}
\parindent10mm
\instrumentnumber{1} % a single instrument
@ -283,7 +288,7 @@ And then there is the \texttt{musixtex} package. It makes use of a \texttt{music
\Notes\ibu0f0\qb0{cge}\tbu0\qb0g|\ql l\sk\ql n\en
\zendextract % terminate excerpt
\end{music}
\end{verbatim}
\end{Verbatim}
which produces this bit of music:
@ -305,7 +310,7 @@ What strikes me most is that most of that code is not in any way intuitive. The
The \texttt{abc} package allows you to use the ABC language to create snippets of music directly in your LaTeX document, using the \texttt{abc} environment. Unfortunately, while I can get this to work in standalone documents, I have not been able to figure out how to incorporate into a regular LaTeX document like this one. For example, this bit of code:
\begin{verbatim}
\begin{Verbatim}[frame=lines, numbers=left, framesep=3mm, label=ABC example]
\begin{abc}
X:4
T:Cronins Hornpipe
@ -320,7 +325,7 @@ GABc dBde|gage dega|bage dBAB|G2G2 G2:|!
fg|afd^c d2ga|bged e2ga|(3bag (3agf gedB|(3cBA AG AcBA|!
GABc dBde|~g3e dega|bage dBAB|G2G2 G2:|!
\end{abc}
\end{verbatim}
\end{Verbatim}
should produce a lovely little bit of music, but all it produces is this:
@ -345,6 +350,46 @@ Obviously, I have a lot more research to do.
Tablature is a way of indicating which strings to play on stringed instruments like guitars and basses. (There are arguments about whether it's worth using tabs, as they do leave out some information, but I won't get into that here. Suffice it to say that everything has its divisive issues. Personally, I find that if you already know the tune, tabs are generally enough.)
\subsection{guitartabs}
The first package I found is \texttt{guitartabs}. Unfortunately, this introduces a completely separate document class (called, natch, ``guitartabs'') which means I can't really use it here. (In general, I dislike it when packages do this, because it really limits the usability of their package. In this case, it makes it impossible to incorporate guitar tabs into whatever existing document you would like to include them in.)
\subsection{songs}
The \texttt{songs} package\footnote{Which is available on SourceForge---see my later comments about that site.} says that it produces guitar \textit{tablature}, but what it really produces is guitar \textit{chords}. This should not be surprising, since it is really designed to produce church hymnals. I have very little (none, actually) use for church hymnals, but if you do, I recommend you look into this package because it is fairly powerful.
This code:
\begin{Verbatim}[frame=lines, numbers=left, framesep=3mm, label=Songs example \#1]
\gtab{A}{X02220:001230}
\end{Verbatim}
\noindent{}produces this chord diagram:
\includegraphics[scale=1]{songs-01}
\noindent{}Like it? Here's another:
\begin{Verbatim}[frame=lines, numbers=left, framesep=3mm, label=Songs example \#2]
\gtab{C#sus4}{4:XX3341}
\end{Verbatim}
\noindent{}produces this:
\includegraphics[scale=1]{songs-02}
Unfortunately, the \texttt{notes} package is incompatible with the \texttt{musixtex} package which I used earlier, as they both contain the commands \texttt{meterfont} and \texttt{transpose} and I can't figure out a way to make them play nicely together. My solution was to create a new document with the \texttt{standalone} class, create the chords in that document, and add them here using the \verb+\includegraphics[]{}+ command. (See the source code for how I accomplished this.)
This does point out one weakness of \LaTeX{}: it is possible to create a package with the same macro names as some other package, which essentially renders them incompatible.\footnote{For what it's worth, this is possible with just about \textit{any} bit of software.} It would be great if package developers would use some sort of personal prefix for their macros, but we are so far along in this game that I think it's far too late.
\subsection{musixtex}
As it turns out, this package can also be used to produce tab. However, because it was designed for classical music, you'll have to do some work to figure out how to use it for regular guitar tablature.
\section{Lilypond}
\section{Summary}
As it turns out, incorporating musical notation into a text document (which was my original goal) is not that easy in \LaTeX{}. Most of the packages out there are either too simple to produce something useful like a music tutorial or even music notes. The \texttt{musixtex} package seems to have the most potential for something like this, but it is far from intuitive. (If \verb+\Notes\ibu0f0\qb0{cge}\tbu0\qb0g|\ql+ makes sense to you, I think we are definitely buying donuts in different donut shops.)
\chapter{An Introduction to \LaTeX{}}

7
003/songs-01.tex Normal file
View File

@ -0,0 +1,7 @@
\documentclass{standalone}
\usepackage[chorded]{songs}
\begin{document}
\gtab{A}{X02220:001230}
\end{document}

7
003/songs-02.tex Normal file
View File

@ -0,0 +1,7 @@
\documentclass{standalone}
\usepackage[chorded]{songs}
\begin{document}
\gtab{C#sus4}{4:XX3341}
\end{document}