1

I'm writing a songbook with the (quite good!) songs package. I want to leverage its transposition ability, but I noticed something from the manual: if I want to use the solfedge note names (i.e. the latin ones, Do - Re - Mi etc.), I must use them in capital letters, which is tedious. I can still compose the document with lowercase notes using the ~\notenamesin/\notenamesout` macros, but I wondered: is there a workaround? Should I open a feature or pull request?

Thanks!


EDIT: To clarify, the current behaviour gives three possibilities:

  • Normal setting: only alphabetical names
\[G]How many \[C]roads must a \[D]man walk \[G]down,
before you \[C]call him a \[G]man
  • Using the \solfedge macro, but the chords must be provided in capitals to allow transposition
\solfedge
[...]
\[SOL]How many \[DO]roads must a \[RE]man walk \[SOL]down,
before you \[DO]call him a \[SOL]man

Notice this also produces the chords in capitals.

I'd like instead:

\somecommands
[...]
\[Sol]How many \[Do]roads must a \[Re]man walk \[Sol]down,
before you \[Do]call him a \[Sol]man

but this doesn't get recognized by the transpose engine.

The current partial solution I found is:

\notenamesin{LA}{SI}{DO}{RE}{MI}{FA}{SOL}
\notenamesout{La}{Si}{Do}{Re}{Mi}{Fa}{Sol}
[...]
\[SOL]How many \[DO]roads must a \[RE]man walk \[SOL]down,
before you \[DO]call him a \[SOL]man

this way I still have to type in the chords in capitals, but they get composed with only the initial capital and they get correctly transposed. The point is that the chords needs to be (IIUC) in capitals so the package can distinguish them from accents (flats, sharps, minors, sevenths etc.).

user202729
  • 7,143
  • Possibly, but it would require digging through the songs source code. – John Kormylo Nov 23 '22 at 16:56
  • Could you clarify the question a bit? Currently I don't fully understand what kind of input you want to provide and what kind of output you expect from that, or why \notenamesin and \notenamesout is not a solution for this. Could you provide a full document example with the code that you would like to use? – Marijn Nov 23 '22 at 18:50
  • I edit the title to highlight the issue is with the \transpose feature, because otherwise the package does work correctly. – user202729 Nov 24 '22 at 02:13

2 Answers2

2

A "without thinking" way is to patching/pile up on the original definition of \[ (whatever it is) to replace the definition whenever it's in a lookup table.

\documentclass{article}
\usepackage[chorded]{songs}
\noversenumbers

\ExplSyntaxOn

\cs_new_protected:Npn __aless_patched_value_Sol: { __aless_old_open_bracket:w SOL] } \cs_new_protected:Npn __aless_patched_value_Do: { __aless_old_open_bracket:w DO] } % type the rest yourself

\cs_new_protected:Npn __aless_patched_open_bracket:w #1 ] { \cs_if_exist_use:cF {__aless_patched_value_ #1 :} { % unlike e-TeX's \ifdefined this also returns true when the control sequence has meaning \relax __aless_old_open_bracket:w #1 ] } }

\cs_new_protected:Npn \custompatch { \let __aless_old_open_bracket:w [ \let [ __aless_patched_open_bracket:w }

\ExplSyntaxOff

\begin{document} \songsection{Worship Songs} \begin{songs}{}

\solfedge \notenamesout{La}{Si}{Do}{Re}{Mi}{Fa}{Sol}

\beginsong{Doxology}[by={Louis Bourgeois and Thomas Ken}, sr={Revelation 5:13}, cr={Public domain.}] \beginverse

\transpose{1}

\custompatch % ← run this command here

[Sol]How many [Do]roads

\endverse \endsong \end{songs} \end{document}

Control sequence names "roughly" follow expl3 naming convention, with OP username used as the module name.

(note this may file with certain definitions of robust commands where \[ itself is called internally in the source code of the package. Nevertheless it mostly works.)

user202729
  • 7,143
1

Define \Sol macro which redefines \[ and re-define \beginverse in order it applies \Sol

\def\Sol {\let\solori=\[ \def\[##1]{\uppercase{\solori##1]}}}
\expandafter\def \expandafter\beginverse \expandafter{\beginverse\Sol}
wipet
  • 74,238