>From 472fe10042ac43a56b8fb30584edaa2419ff56e3 Mon Sep 17 00:00:00 2001 From: Patrick L. Schmidt Date: Fri, 4 Mar 2011 17:04:53 +0100 Subject: [PATCH] Doc: harmonics and slides IX --- Documentation/notation/fretted-strings.itely | 79 +++++++++++++++++-- .../snippets/new/tablature-chord-glissando.ly | 31 +++++++ .../new/tablature-fretted-string-harmonics.ly | 74 +++++++++++++++++ .../new/tablature-open-string-harmonics.ly | 64 +++++++++++++++ Documentation/snippets/new/tablature-slides.ly | 38 +++++++++ ly/chord-glissando-init.ly | 83 ++++++++++++++++++++ 6 files changed, 361 insertions(+), 8 deletions(-) create mode 100644 Documentation/snippets/new/tablature-chord-glissando.ly create mode 100644 Documentation/snippets/new/tablature-fretted-string-harmonics.ly create mode 100644 Documentation/snippets/new/tablature-open-string-harmonics.ly create mode 100644 Documentation/snippets/new/tablature-slides.ly create mode 100644 ly/chord-glissando-init.ly diff --git a/Documentation/notation/fretted-strings.itely b/Documentation/notation/fretted-strings.itely index 98de6e3..3c5161e 100644 --- a/Documentation/notation/fretted-strings.itely +++ b/Documentation/notation/fretted-strings.itely @@ -363,15 +363,64 @@ ties = \relative c' { @cindex tablature and harmonic indications @cindex slides in tablature notation @cindex tablature and slides address@hidden chord glissandi address@hidden \harmonic address@hidden \harmonicByFret address@hidden \harmonicByRatio address@hidden \chordGlissando + +Harmonic indications can be added to tablature notation as sounding +pitches: + address@hidden,quote] +firstHarmonic = { + 4 + 4 + 2 +} +\score { + << + \new Staff { \firstHarmonic } + \new TabStaff { \firstHarmonic } + >> +} address@hidden 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. + address@hidden,quote] +fretHarmonics = { + \harmonicByFret #5 d16\4 + \harmonicByFret #4 d16\4 + \harmonicByFret #3 d8\4 + \harmonicByFret #5 2. +} +\score { + << + \new Staff { \fretHarmonics } + \new TabStaff { \fretHarmonics } + >> +} address@hidden lilypond address@hidden, quote, relative=1] -\new TabStaff { - \new TabVoice { - 4 d\2\glissando e\2 - } +Alternatively, harmonics can be computed by defining the ratio of +string lengths above and below the harmonic fingering. + address@hidden,quote] +ratioHarmonics = { + \harmonicByRatio #1/2 4 + \harmonicByRatio #1/3 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} address@hidden,lilyquote,texidoc,doctitle] +{tablature-open-string-harmonics.ly} + address@hidden,lilyquote,texidoc,doctitle] +{tablature-fretted-string-harmonics.ly} + address@hidden,lilyquote,texidoc,doctitle] +{tablature-slides.ly} + address@hidden,lilyquote,texidoc,doctitle] +{tablature-chord-glissando.ly} + @seealso Notation Reference: address@hidden address@hidden, address@hidden, address@hidden 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 index 0000000..6466dcb --- /dev/null +++ b/Documentation/snippets/new/tablature-chord-glissando.ly @@ -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 + 8 +} + +\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 index 0000000..44ce72c --- /dev/null +++ b/Documentation/snippets/new/tablature-fretted-string-harmonics.ly @@ -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 + 2\startTextSpan + 4 + 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( 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 index 0000000..3524d28 --- /dev/null +++ b/Documentation/snippets/new/tablature-open-string-harmonics.ly @@ -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 index 0000000..da6b4f2 --- /dev/null +++ b/Documentation/snippets/new/tablature-slides.ly @@ -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 index 0000000..f59c99d --- /dev/null +++ b/ly/chord-glissando-init.ly @@ -0,0 +1,83 @@ +%%%% This file is part of LilyPond, the GNU music typesetter. +%%%% +%%%% Copyright (C) 2010 Carl D. Sorensen +%%%% +%%%% 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 . + +\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 + #})) -- 1.7.0.4