Jump to content

Typesetting IPA transcriptions for lyrics

From LilyPond wiki

Singers may find it useful if you add International Phonetic Alphabet (IPA) transcriptions to some or all of your lyrics. This snippet shows four ways to typeset IPA transcriptions in LilyPond.

  1. As a stanza of lyrics. This approach works well when you want exhaustive IPA (i.e., transcriptions of every lyric).
  2. In a markup block separate from your score. Also good for exhaustive IPA. Tip: As you are editing, you can put \hspace commands into boxes to see their effects.
  3. Using a dedicated music function, \withIPA, and an IPA Lyrics context. Best when you want selective IPA (i.e., transcriptions for only some lyrics).
  4. Using a custom markup command, \IPA.

\version "2.24"

\paper { score-markup-spacing.padding = 4 }

%%  OPTION 1
\markup { \circle 1 When you want IPA 
  under every lyric, you can add a stanza: }

melodyUnmarked = \relative c'' {
  \key e \major \time 3/4 
  r2 b4 | e2 gis,8. fis16 | e2 cis'4 | 
  a4.( gis8) a4 | gis gis r |
}

textUnmarked = \lyricmode {
  I know that _ my Re -- 
  dee -- mer li -- veth, 
}

stanzaExhaustiveIPA = \lyricmode {
  % If needed, change typeface 
  % or font size to your preferences: 
  \override LyricText.font-name = "Times New Roman,"
  \override LyricText.font-size = #-1
  aɪ noʊ ðæt _ maɪ ɹɪ ˈdiː mə lɪ vɛθ
}

\score {
  <<
    \new Voice = "sop" \melodyUnmarked
    \new Lyrics 
      % The following line reduces
      % the vertical space between the text
      % and the IPA line underneath it: 
      \with { \override VerticalAxisGroup.nonstaff-nonstaff-spacing.minimum-distance = 2 }
      \lyricsto "sop" \textUnmarked
    \new Lyrics \lyricsto "sop" \stanzaExhaustiveIPA
  >>
}


%%  OPTION 2
\markup { \circle 2 Or you can put the IPA transcription 
  in a markup block separate from your score: }

\markup \null

\markup {
  \justify-line {
    \hspace #20
    \left-column {
      "I know that my Redeemer liveth,"
      "and that he shall stand …"
    }
    \override #'(font-name . "Times New Roman,") 
    \left-column {
      "aɪ noʊ ðæt maɪ ɹɪˈdiːmə lɪvɛθ"
      "ænd ðæt hiː ʃæl stænd"
    }
    \hspace #20
  }
}

\score {
  <<
    \new Voice = "sop" \melodyUnmarked
    \new Lyrics \lyricsto "sop" \textUnmarked
  >>
}


%%  OPTION 3
\markup \wordwrap { \circle 3 
  When you want IPA only under certain lyrics, 
  you can use a dedicated "\withIPA" function 
  that works with a dedicated Lyrics context for IPA: }

% Approach by Lukas-Fabian Moser
% https://lists.gnu.org/archive/html/lilypond-user/2026-01/msg00269.html 
% Define the \withIPA function: 
withIPA =
#(define-music-function (IPA word) (ly:music? ly:music?)
   #{
     <<
       \context Lyrics = IPA { #IPA }
       #word
     >>
   #})

textMarked = \lyricmode {
  I know that _ \withIPA maɪ my Re --
  dee -- mer \withIPA lɪ li -- veth,
}

\score {
  <<
    \new Voice = "sop" \melodyUnmarked
    \new Lyrics 
      \with { \override VerticalAxisGroup.nonstaff-nonstaff-spacing.minimum-distance = 2 }
      \lyricsto "sop" \textMarked
    \new Lyrics = IPA \with {
      \override LyricText.font-name = "Times New Roman,"
      \override LyricText.font-size = #-1
    } \lyricsto "sop" { 
      \repeat unfold #(length (music-pitches 
      melodyUnmarked)) \skip 1 }
  >>
}


%%  OPTION 4
\markup { \circle 4 Or you can use a custom "\IPA" 
  markup command to put IPA in markups on notes: }

% Approach by Kieren MacMillan 
% https://lists.gnu.org/archive/html/lilypond-user/2025-11/msg00161.html 
% Define a custom markup command 
% for the IPA transcriptions: 
#(define-markup-command (IPA layout props arg) (markup?)
   (interpret-markup layout props
     (markup #:override '(font-name . "Times New Roman,") #:fontsize -2 arg)))
% In the preceding line, change typeface 
% or font size to your preferences.

melodyMarkup = \relative c'' {
  \key e \major \time 3/4 
  % Set the alignment point on 
  % the markup’s parent (the note) 
  % to be the center of the note: 
  \override TextScript.parent-alignment-X = #CENTER
  % Set the alignment point on the markup itself 
  % to be the center of the markup: 
  \override TextScript.self-alignment-X = #CENTER
  % Thus, the center of each TextScript will be 
  % at the center of the note 
  r2 b4 | e2 gis,8. fis16 | 
  e2^\markup \IPA { /maɪ/ }
  cis'4 | a4.( gis8) a4 | 
  gis_\markup \IPA { /lɪ/ }
  gis r | 
}

\score {
  <<
    \new Voice = "sop" \melodyMarkup
    \new Lyrics \lyricsto "sop" \textUnmarked
  >>
}