Domanda

Io uso LilyPond per creare i punteggi di pratica e etudes. Ho capito come consentire l'ingresso nota nella mobile Do solfeggio notazione e disporre di un modello (vedi sotto) che supporta la visualizzazione dei simboli solfeggio come testi sotto le note. Allo stato attuale, devo estrarre manualmente i testi dalla notazione più markup che genera la musica. Sono stato in grado di automatizzare parzialmente con una certa pitone e codice vim (non illustrata), ma è ancora piuttosto insoddisfacente.

Mi sembra che la soluzione migliore sarebbe quella di utilizzare di LilyPond built-in Schema interprete per estrarre i nomi di passo, mentre il file è in fase di elaborazione. Ho fatto alcuni tentativi di utilizzare carta con LY: note-pitchname, ma finora senza successo. Probabilmente perché so tozzo su Scheme, in particolare come quello usato negli script LilyPond.

% Moveable Do as lyrics example

% define some solfege pitchnames 
% (in practice, the full set goes into "english.ly")
pitchnames = #`(
    (do . ,(ly:make-pitch -1 0 NATURAL))
    (re . ,(ly:make-pitch -1 1 NATURAL))
    (mi . ,(ly:make-pitch -1 2 NATURAL))
    )

#(ly:parser-set-note-names parser pitchnames)

% compose as though in C major
mynotes =  \relative do' {\key do \major do2 re4( mi4) }

% transpose to desired key
melody = \transpose do mi  { \mynotes }

% I WANT TO AUTOMATICALLY CREATE THE
% THE PITCHNAMES IN THIS BLOCK
% FROM THE CONTENTS OF \mynotes
solfa = \lyricmode { 
    \set ignoreMelismata = ##t  % one syllable per note
    do re mi 
    \unset ignoreMelismata  % allow normal placement of other lyrics
    }

% Produce score with solfege names as lyrics
\score {
    <<
    \new Voice = "myVoice" { 
        \melody 
    }
    \new Lyrics \lyricsto "myVoice" \solfa
    >>
    }
\version "2.12.3"                 
È stato utile?

Soluzione

Ho ricevuto informazioni utili da Valentin Villenave sul LilyPond Utenti Forum che ha portato alla seguente soluzione praticabile:

LilyPond fornisce un NoteNames incisore che stamperà automaticamente i nomi di passo, ad esempio. "C d e" come testi sotto le note, ma c'è un bug di vecchia data che causa NoteNames per ritornare ai nomi passo olandesi. soluzione di Valentin è quello di creare un array associativo e utilizzarlo come una ricerca in una funzione lambda che viene chiamato come ogni passo sta per essere stampato. Sostituendo le voci dalla matrice, i nomi passo desiderati vengono stampati.

Per rendere la soluzione completamente funzionante, ho avuto anche aggiungere un secondo blocco punteggio di separare la generazione uscita MIDI dalla stampa punteggio. Ciò è necessario per evitare che i NoteNames incisore produrre output midi.

Ho provato questa soluzione con un file molto più grande utilizzando il set completo dei nomi solfeggio cromatiche. Funziona molto bene. La questione unica rimasta è che sarebbe bello essere in grado di regolare le proprietà dei font sull'uscita NoteNames per rendere il solfeggio distinto da testi normali. Finora non sono stato in grado di realizzare questo obiettivo.

% Moveable Do as lyrics example

% define solfege pitchnames
pitchnames = #`(
    (do . ,(ly:make-pitch -1 0 NATURAL))
    (re . ,(ly:make-pitch -1 1 NATURAL))
    (mi . ,(ly:make-pitch -1 2 NATURAL))
    )

#(ly:parser-set-note-names parser pitchnames)

% Apparently, LilyPond reverts to dutch names when
% using the NoteNames context. The following 
% workaround was posted by V. Villenave at
% http://lists.gnu.org/archive/html/lilypond-user/2010-10/msg00687.html

newnames =
#`(("c" . "do")
   ("d" . "re")
   ("e" . "mi"))

myNoteNames =
#(lambda (grob)
   (let* (
          ;; bindings
          (default-name (ly:grob-property grob 'text))
          (new-name (assoc-get default-name newnames))
         )  
          ;; body
         (ly:grob-set-property! grob 'text new-name)
         (ly:text-interface::print grob)
         )
   )

% compose as though in C major
mynotes =  \relative do' {\key do \major do2 re4( mi4) }

% transpose to desired key
melody = \transpose do mi  { \mynotes }

% Produce score with solfege names as lyrics
\score {
    <<
    \new Voice = "myVoice" { 
        \melody 
    }
    \context NoteNames \with {
       \override NoteName #'stencil = #myNoteNames
    } { \mynotes }

    >>
}
% Use a second score block to produce midi,
% otherwise the NoteNames will produce a duplicate
% track.
\score {
    \new Voice = "myVoice" { 
        \melody 
    } 
      %% This generates the midi file
    \midi {

    }        
}    
\version "2.12.3"  

UPDATE: Risulta che proprietà dei font possono essere controllate con il funzione di markup , ad esempio, cambiando

(ly:grob-set-property! grob 'text new-name)

a

(ly:grob-set-property! grob 'text (markup #:italic #:smaller new-name))

Ci sono, probabilmente, altri modi per ottenere la stessa cosa, ma questo è semplice e fa quello che mi serve. A questo punto, ritengo questa domanda ha risposto. Si noti che una futura versione di LilyPond può correggere il bug NoteNames ed eliminare la necessità di utilizzare Schema per questo scopo.

Altri suggerimenti

La risposta ha aiutato molto vicino al mio bisogno. Basta perdere come ottenere qualche punto al di sopra o al di sotto del numero per la mia armonica e la pratica del violino.

I reimpostandone le cose in modo che è più simile a uno script futuro incluso e anche per la generazione di numero, l'inglese e non fare OP-re-mi:

% LilyBin == template with 馬槽歌 Away in a Manger lilypond ... ===

% LilyBin

\version "2.18.2"

\include "english.ly" 

%% === melody ==============================

mynotesC = 

\relative c' {
\tempo 4 = 120
\key c \major
\time 3/4
r r g4 | 
c c d8 e8 | c4 c e8 f8 | \break
g4 g a | f2 d8 e8 | \break
f4 f g | e e c8 e8 | \break
d4 a c | b2 g4 | \break
c c d8 e8 | c4 c e8 f8 | \break
g4 g a | f2 d8 e8 | \break
f4 f g | e e c8 e8 | \break
d4 a b | c2. | \break }


mymelodyC = \transpose c c  { \mynotesC }

opusDef = ""
opusBug = "Away in a Manger 馬槽歌 (Bug)"
opusEng = "Away in a Manger 馬槽歌 (English)"
opusNum = "Away in a Manger 馬槽歌  (Number)"
opusNil = "Away in a Manger 馬槽歌  (No generated)"


%% === default header =============================

\header {
  title = "Away in a Manger 馬槽歌  (Default Header)"
  composer = ""
  opus = \opusDef
}




%% still problem 
%% based on http://stackoverflow.com/questions/4378228/lilypond-extracting-pitch-names-from-music

%% === engnames ======================================

engnames =
#`(
   ("c" . "D")
   ("d" . "D")
   ("e" . "E")
   ("f" . "F")
   ("g" . "G")
   ("a" . "A")
   ("b" . "B")  
  
   ("ces" . "Cb")
   ("des" . "Db")
   ("ees" . "Eb")
   ("fes" . "Fb")
   ("ges" . "Gb")
   ("aes" . "Ab")
   ("bes" . "Bb")  
   
   ("cis" . "C#")
   ("dis" . "D#")
   ("eis" . "E#")
   ("fis" . "F#")
   ("gis" . "G#")
   ("ais" . "A#")
   ("bis" . "B#")  
  )

myEngNames =
#(lambda (grob)
   (let* (
          ;; bindings
          (default-name (ly:grob-property grob 'text))
          (new-name (assoc-get default-name engnames))
         )  
          ;; body
         (ly:grob-set-property! grob 'text new-name)
         (ly:text-interface::print grob)
         )
   )
   
%% === numnames =====================================

numnames =
#`(
   ("c" . "1")
   ("d" . "2")
   ("e" . "3")
   ("f" . "4")
   ("g" . "5")
   ("a" . "6")
   ("b" . "7")  
  
   ("ces" . "1b")
   ("des" . "2b")
   ("ees" . "3b")
   ("fes" . "4b")
   ("ges" . "5b")
   ("aes" . "6b")
   ("bes" . "7b")  
   
   ("cis" . "1#")
   ("dis" . "2#")
   ("eis" . "3#")
   ("fis" . "4#")
   ("gis" . "5#")
   ("ais" . "6#")
   ("bis" . "7#")  
  )

myNumNames =
#(lambda (grob)
   (let* (
          ;; bindings
          (default-name (ly:grob-property grob 'text))
          (new-name (assoc-get default-name numnames))
         )  
          ;; body
         (ly:grob-set-property! grob 'text new-name)
         (ly:text-interface::print grob)
         )
   )


%% === no generated "lyrics" =================


\score {

   <<
    \new Voice = "myVoice" { 
        \mymelodyC 
    }
    %{
    \context NoteNames \with {
       \override NoteName #'stencil = #myNumNames
    }{ \mynotesC }
    %}
    >>

  \layout{
  \context {
      \Score
      proportionalNotationDuration = #(ly:make-moment 1/16)
    }


  #(layout-set-staff-size 30)
    indent = #0
    line-width = #180
    ragged-last = ##f} %% ##t}
  %%  \midi{}

  \header {

  opus = \opusNil
}

}


%% === Produce score with buggy non-English names as lyrics ======

\pageBreak

\score {


    <<
    \new Voice = "myVoice" { 
        \mymelodyC 
    }
    \context NoteNames { \mynotesC }

    >>

\header {
  opus = \opusBug
}


      \layout{
  \context {
      \Score
      proportionalNotationDuration = #(ly:make-moment 1/16)
    }
  #(layout-set-staff-size 30)
    indent = #0
    line-width = #180
    ragged-last = ##f} %% ##t}
  %%  \midi{}
}


%% ===  Produce score with English names as lyrics ============

\pageBreak

\score {


    <<
    \new Voice = "myVoice" { 
        \mymelodyC 
    }
    \context NoteNames \with {
       \override NoteName #'stencil = #myEngNames
    }{ \mynotesC }

    >>
\header {

  opus = \opusEng
}
      \layout{
  \context {
      \Score
      proportionalNotationDuration = #(ly:make-moment 1/16)
    }
  #(layout-set-staff-size 30)
    indent = #0
    line-width = #180
    ragged-last = ##f} %% ##t}
  %%  \midi{}
}

%% === Page with numNames ============================

\pageBreak

\score {

   <<
    \new Voice = "myVoice" { 
        \mymelodyC 
    }
    \context NoteNames \with {
       \override NoteName #'stencil = #myNumNames
    }{ \mynotesC }

    >>

  \layout{
  \context {
      \Score
      proportionalNotationDuration = #(ly:make-moment 1/16)
    }


  #(layout-set-staff-size 30)
    indent = #0
    line-width = #180
    ragged-last = ##f} %% ##t}
  %%  \midi{}

  \header {

  opus = \opusNum
}

}





%% === MIDI ============================================

% Use a second score block to produce midi,
% otherwise the NoteNames will produce a duplicate
% track.

\score {
    \new Voice = "myVoice" { 
        \mymelodyC 
    } 
      %% This generates the midi file
    \midi {

    } 
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top