]> git.donarmstrong.com Git - lilypond.git/commitdiff
Doc: harmonics and slides IX
authorPatrick L. Schmidt <p.l.schmidt@gmx.de>
Fri, 4 Mar 2011 16:04:53 +0000 (17:04 +0100)
committerGraham Percival <graham@percival-music.ca>
Fri, 4 Mar 2011 19:41:04 +0000 (19:41 +0000)
Documentation/notation/fretted-strings.itely
Documentation/snippets/new/tablature-chord-glissando.ly [new file with mode: 0644]
Documentation/snippets/new/tablature-fretted-string-harmonics.ly [new file with mode: 0644]
Documentation/snippets/new/tablature-open-string-harmonics.ly [new file with mode: 0644]
Documentation/snippets/new/tablature-slides.ly [new file with mode: 0644]
ly/chord-glissando-init.ly [new file with mode: 0644]

index 98de6e3335d68fcd4fc66d0c8d9dd68b32d81830..3c5161ebe618a358f82af6d5eec475c08258fba0 100644 (file)
@@ -363,15 +363,64 @@ ties = \relative c' {
 @cindex tablature and harmonic indications
 @cindex slides in tablature notation
 @cindex tablature and slides
+@cindex chord glissandi
+@funindex \harmonic
+@funindex \harmonicByFret
+@funindex \harmonicByRatio
+@funindex \chordGlissando
+
+Harmonic indications can be added to tablature notation as sounding
+pitches:
+
+@lilypond[verbatim,quote]
+firstHarmonic = {
+  <d'\4\harmonic>4
+  <g'\3\harmonic>4
+  <b'\2\harmonic>2
+}
+\score {
+  <<
+    \new Staff { \firstHarmonic }
+    \new TabStaff { \firstHarmonic }
+  >>
+}
+@end lilypond
 
-Harmonic indications and slides can be added to tablature
-notation.
+Note that the command @code{\harmonic} must always be defined
+inside a chord construct. It only makes sense for open-string harmonics
+in the 12th fret. All other harmonics should be calculated by LilyPond.
+This can be achieved by indicating the fret where a finger of the
+fretting hand should touch a string.
+
+@lilypond[verbatim,quote]
+fretHarmonics = {
+  \harmonicByFret #5 d16\4
+  \harmonicByFret #4 d16\4
+  \harmonicByFret #3 d8\4
+  \harmonicByFret #5 <g\3 b\2>2.
+}
+\score {
+  <<
+    \new Staff { \fretHarmonics }
+    \new TabStaff { \fretHarmonics }
+  >>
+}
+@end lilypond
 
-@lilypond[verbatim, quote, relative=1]
-\new TabStaff {
-  \new TabVoice {
-    <c g'\harmonic>4 d\2\glissando e\2
-  }
+Alternatively, harmonics can be computed by defining the ratio of
+string lengths above and below the harmonic fingering.
+
+@lilypond[verbatim,quote]
+ratioHarmonics = {
+  \harmonicByRatio #1/2 <g\3 b\2 e'\1>4
+  \harmonicByRatio #1/3 <g\3 b\2 e'\1>4
+  \harmonicByRatio #1/4 { g8\3 b8\2 e'4\1 }
+}
+\score {
+  <<
+    \new Staff { \ratioHarmonics }
+    \new TabStaff { \ratioHarmonics }
+  >>
 }
 @end lilypond
 
@@ -384,10 +433,24 @@ notation.
 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
 {polyphony-in-tablature.ly}
 
+@lilypondfile[verbatim,lilyquote,texidoc,doctitle]
+{tablature-open-string-harmonics.ly}
+
+@lilypondfile[verbatim,lilyquote,texidoc,doctitle]
+{tablature-fretted-string-harmonics.ly}
+
+@lilypondfile[verbatim,lilyquote,texidoc,doctitle]
+{tablature-slides.ly}
+
+@lilypondfile[verbatim,lilyquote,texidoc,doctitle]
+{tablature-chord-glissando.ly}
+
 
 @seealso
 Notation Reference:
-@ref{Stems}.
+@ref{Stems},
+@ref{Harmonics},
+@ref{Glissando}.
 
 Snippets:
 @rlsr{Fretted strings}.
diff --git a/Documentation/snippets/new/tablature-chord-glissando.ly b/Documentation/snippets/new/tablature-chord-glissando.ly
new file mode 100644 (file)
index 0000000..6466dcb
--- /dev/null
@@ -0,0 +1,31 @@
+\version "2.13.49"
+
+\header {
+  lsrtags = "fretted-strings"
+  texidoc = "
+Slides for chords can be indicated in both Staff and TabStaff.
+String numbers are necessary for TabStaff because automatic
+string calculations are different for chords and for single notes,
+and @code{\chordGlissando} draws lines between single notes.
+"
+  doctitle = "Chord glissando in tablature"
+}
+
+\include "chord-glissando-init.ly"
+
+myMusic = \relative c' {
+  \chordGlissando
+  <c\3 e\2 g\1>8 <f\3 a\2 c\1>
+}
+
+\score {
+  <<
+    \new Staff {
+      \clef "treble_8"
+      \myMusic
+    }
+    \new TabStaff {
+      \myMusic
+    }
+  >>
+}
diff --git a/Documentation/snippets/new/tablature-fretted-string-harmonics.ly b/Documentation/snippets/new/tablature-fretted-string-harmonics.ly
new file mode 100644 (file)
index 0000000..44ce72c
--- /dev/null
@@ -0,0 +1,74 @@
+\version "2.13.49"
+
+\header {
+  lsrtags = "fretted-strings"
+  texidoc = "
+Fretted-string harmonics:
+"
+  doctitle = "Fretted-string harmonics in tablature"
+}
+
+pinchedHarmonics = {
+   \textSpannerDown
+   \override TextSpanner #'bound-details #'left #'text =
+      \markup {\halign #-0.5 \teeny "PH" }
+      \override TextSpanner #'style =
+         #'dashed-line
+   \override TextSpanner #'dash-period = #0.6
+   \override TextSpanner #'bound-details #'right #'attach-dir = #1
+   \override TextSpanner #'bound-details #'right #'text =
+      \markup { \draw-line #'(0 . 1) }
+   \override TextSpanner #'bound-details #'right #'padding = #-0.5
+}
+
+harmonics = {
+  %artificial harmonics (AH)
+  \textLengthOn
+  <\parenthesize b b''\harmonic>4_\markup{ \teeny "AH 16" }
+  <\parenthesize g g''\harmonic>4_\markup{ \teeny "AH 17" }
+  <\parenthesize d' d'''\harmonic>2_\markup{ \teeny "AH 19" }
+  %pinched harmonics (PH)
+  \pinchedHarmonics
+  <a'\harmonic>2\startTextSpan
+  <g'\harmonic>4
+  <e'\harmonic>4\stopTextSpan
+  %tapped harmonics (TH)
+  <\parenthesize g\4 g'\harmonic>4_\markup{ \teeny "TH 17" }
+  <\parenthesize a\4 a'\harmonic>4_\markup{ \teeny "TH 19" }
+  <\parenthesize c'\3 c''\harmonic>2_\markup{ \teeny "TH 17" }
+  %touch harmonics (TCH)
+  a4( <e''\harmonic>2. )_\markup{ \teeny "TCH" }
+}
+
+frettedStrings = {
+  %artificial harmonics (AH)
+  \harmonicByFret #4 g4\3
+  \harmonicByFret #5 d4\4
+  \harmonicByFret #7 g2\3
+  %pinched harmonics (PH)
+  \harmonicByFret #7 d2\4
+  \harmonicByFret #5 d4\4
+  \harmonicByFret #7 a4\5
+  %tapped harmonics (TH)
+  \harmonicByFret #5 d4\4
+  \harmonicByFret #5 d4\4
+  \harmonicByFret #4 g2\3
+  %touch harmonics (TCH)
+  a4 \harmonicByFret #9 g2.\3
+}
+
+\score {
+  <<
+    \new Staff {
+      \new Voice {
+        \clef "treble_8"
+        \harmonics
+      }
+    }
+    \new TabStaff {
+      \new TabVoice {
+        \frettedStrings
+      }
+    }
+  >>
+}
diff --git a/Documentation/snippets/new/tablature-open-string-harmonics.ly b/Documentation/snippets/new/tablature-open-string-harmonics.ly
new file mode 100644 (file)
index 0000000..3524d28
--- /dev/null
@@ -0,0 +1,64 @@
+\version "2.13.49"
+
+\header {
+  lsrtags = "fretted-strings"
+  texidoc = "
+Reference for open-string harmonics:
+"
+  doctitle = "Reference for open-string harmonics"
+}
+
+openStringHarmonics = {
+  %first harmonic
+  \harmonicByFret #12 e,2\6_\markup{"1st harm."}
+  \harmonicByRatio #1/2 e,\6
+  %second harmonic
+  \harmonicByFret #7 e,\6_\markup{"2nd harm. - - - -"}
+  \harmonicByRatio #1/3 e,\6
+  \harmonicByFret #19 e,\6
+  \harmonicByRatio #2/3 e,\6
+  %\harmonicByFret #19 < e,\6 a,\5 d\4 >
+  %\harmonicByRatio #2/3 < e,\6 a,\5 d\4 >
+  %third harmonic
+  \harmonicByFret #5 e,\6_\markup{"3rd harm. - - - -"}
+  \harmonicByRatio #1/4 e,\6
+  \harmonicByFret #24 e,\6
+  \harmonicByRatio #3/4 e,\6
+  \break
+  %fourth harmonic
+  \harmonicByFret #4 e,\6_\markup{"4th harm. - - - - - - - - - - - - -"}
+  \harmonicByRatio #1/5 e,\6
+  \harmonicByFret #9 e,\6
+  \harmonicByRatio #2/5 e,\6
+  \harmonicByFret #16 e,\6
+  \harmonicByRatio #3/5 e,\6
+  %fifth harmonic
+  \harmonicByFret #3 e,\6_\markup{"5th harm."}
+  \harmonicByRatio #1/6 e,\6
+  \break
+  %sixth harmonic
+  \harmonicByFret #2.7 e,\6_\markup{"6th harm."}
+  \harmonicByRatio #1/7 e,\6
+  %seventh harmonic
+  \harmonicByFret #2.3 e,\6_\markup{"7th harm."}
+  \harmonicByRatio #1/8 e,\6
+  %eighth harmonic
+  \harmonicByFret #2 e,\6_\markup{"8th harm."}
+  \harmonicByRatio #1/9 e,\6
+}
+
+\score {
+  <<
+    \new Staff {
+      \new Voice {
+        \clef "treble_8"
+        \openStringHarmonics
+      }
+    }
+    \new TabStaff {
+      \new TabVoice {
+        \openStringHarmonics
+      }
+    }
+  >>
+}
diff --git a/Documentation/snippets/new/tablature-slides.ly b/Documentation/snippets/new/tablature-slides.ly
new file mode 100644 (file)
index 0000000..da6b4f2
--- /dev/null
@@ -0,0 +1,38 @@
+\version "2.13.49"
+
+\header {
+  lsrtags = "fretted-strings"
+  texidoc = "
+Slides can be typeset in both @code{Staff} and @code{TabStaff} contexts:
+"
+  doctitle = "Slides in tablature"
+}
+
+slides = {
+  c'8\3(\glissando d'8\3)
+  c'8\3\glissando d'8\3
+  \hideNotes
+  \grace { g16\3\glissando }
+  \unHideNotes
+  c'4\3
+  \afterGrace d'4\3\glissando {
+  \stemDown \hideNotes
+  g16\3 }
+  \unHideNotes
+}
+
+\score {
+  <<
+    \new Staff { \clef "treble_8" \slides }
+    \new TabStaff { \slides }
+  >>
+  \layout {
+    \context {
+      \Score
+      \override Glissando #'minimum-length = #4
+      \override Glissando #'springs-and-rods =
+                          #ly:spanner::set-spacing-rods
+      \override Glissando #'thickness = #2
+    }
+  }
+}
diff --git a/ly/chord-glissando-init.ly b/ly/chord-glissando-init.ly
new file mode 100644 (file)
index 0000000..f59c99d
--- /dev/null
@@ -0,0 +1,83 @@
+%%%% This file is part of LilyPond, the GNU music typesetter.
+%%%%
+%%%% Copyright (C) 2010 Carl D. Sorensen <c_sorensen@byu.edu>
+%%%%
+%%%% LilyPond is free software: you can redistribute it and/or modify
+%%%% it under the terms of the GNU General Public License as published by
+%%%% the Free Software Foundation, either version 3 of the License, or
+%%%% (at your option) any later version.
+%%%%
+%%%% LilyPond is distributed in the hope that it will be useful,
+%%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
+%%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+%%%% GNU General Public License for more details.
+%%%%
+%%%% You should have received a copy of the GNU General Public License
+%%%% along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
+
+\version "2.13.49"
+
+%%  Make slide indication for chords
+chordGlissando =
+#(define-music-function (parser location mus1 mus2) (ly:music? ly:music?)
+   "Make a glissando between the notes of triads @code{mus1} and @code{mus2}."
+
+   (define (add-glissando musChord)
+     (let ((els (ly:music-property musChord 'elements)))
+       (ly:music-set-property! musChord 'elements (append els (list (make-music 'GlissandoEvent))))
+       musChord))
+
+   (define (get-notes musicChord)
+     (filter (lambda(x) (eq? (ly:music-property x 'name) 'NoteEvent))
+             (ly:music-property musicChord 'elements)))
+
+   (define (select-note musChord index)
+     (let* ((notes (get-notes musChord))
+            (non-notes (filter (lambda (x)
+                                 (not (eq? (ly:music-property x 'name)
+                                           'NoteEvent)))
+                               (ly:music-property musChord 'elements)))
+            (selected-note (list-ref notes index))
+            (new-els (cons selected-note non-notes))
+            (new-mus (ly:music-deep-copy musChord)))
+       (ly:music-set-property! new-mus 'elements new-els)
+       new-mus))
+
+   (define (add-glissando-line mus1 mus2 index)
+     (context-spec-music
+      (context-spec-music
+       (make-sequential-music
+        (list
+         hideNotes
+         (make-grob-property-set 'StringNumber 'transparent #t)
+         (make-grob-property-set 'NoteColumn 'ignore-collision #t)
+         ;; obviously, this isn't equivalent to \once,
+         ;; so could be changed if required
+         (make-grob-property-set 'Glissando 'thickness 2)
+         (make-grob-property-set 'DynamicText 'transparent #t)
+         (make-grob-property-set 'DynamicLineSpanner 'transparent #t)
+         (make-grob-property-set 'DynamicTextSpanner 'transparent #t)
+         (add-glissando (select-note mus1 index))
+         (select-note mus2 index)))
+       'Bottom (symbol->string (gensym)))
+      'Staff))
+
+   (let* ((notes1 (get-notes mus1))
+          (notes2 (get-notes mus2))
+          (note-count (min (length notes1) (length notes2))))
+
+    #{
+       \once \override Glissando #'minimum-length = #4
+       \once \override Glissando #'springs-and-rods = #ly:spanner::set-spacing-rods
+     <<
+       {
+         $(add-glissando mus1)
+         $mus2
+       }
+       $(make-simultaneous-music
+           (map (lambda (x)
+                        (add-glissando-line mus1 mus2 x))
+                (iota note-count)))
+    >>
+    \revert NoteColumn #'ignore-collision
+  #}))