From 1775e47a86396dd57b9f46d89cf40250c21d9d2c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 3 Jan 2021 12:29:20 -0300 Subject: dengoso.ly: Polish \pestana and \corda functions --- TODOs.org | 16 ++--- music/common.ly | 10 +++ music/dengoso.ly | 181 ++++++++++++++++++++----------------------------------- music/guitar.ly | 33 ++++++++++ 4 files changed, 115 insertions(+), 125 deletions(-) create mode 100644 music/common.ly create mode 100644 music/guitar.ly diff --git a/TODOs.org b/TODOs.org index 6c1edf1..ed223ff 100644 --- a/TODOs.org +++ b/TODOs.org @@ -2,22 +2,22 @@ :PROPERTIES: :CUSTOM_ID: tasks :END: -** TODO =dengoso.ly= [1/11] +** TODO =dengoso.ly= [8/11] :PROPERTIES: :CUSTOM_ID: 95ac1eec-1a56-47cb-b7ad-8cadf5737323 :END: - State "TODO" from [2021-01-01 ven. 22:23] - [X] use " = 100" over "Andante moderato for =meter= -- [ ] turn =cWithSlash= into a function -- [ ] move =pestana== into shared =pestana.ly= -- [ ] use fret-number over roman string on =\pestana #"II" { }= +- [X] turn =cWithSlash= into a function +- [X] move =pestana== into shared =pestana.ly= +- [X] +use fret-number over roman string on =\pestana #"II" { }=+ - [ ] measures 21~24: map previous notes, removing fingering notation instead of repeating notes -- [ ] =\6 to D= on beginning of the song -- [ ] share notes between voices -- [ ] add string markers -- [ ] pestana over rests (measure 42) +- [X] =\6 to D= on beginning of the song +- [X] share notes between voices +- [X] add string markers +- [X] pestana over rests (measure 42) - [ ] handle optional sharp on measure 77 - [ ] add torrent for audio (and PDF?) ** TODO Generate =favicon.ico= from =favicon.svg= diff --git a/music/common.ly b/music/common.ly new file mode 100644 index 0000000..f2dddc2 --- /dev/null +++ b/music/common.ly @@ -0,0 +1,10 @@ +copyright = \markup { + \with-url #"https://creativecommons.org/licenses/by-sa/4.0/" \line { + CC BY-SA 4.0 + } +} +tagline = \markup { + \with-url #"https://euandre.org/music.html" \line { + euandre.org/music.html + } +} diff --git a/music/dengoso.ly b/music/dengoso.ly index f7fcf29..9b872cb 100644 --- a/music/dengoso.ly +++ b/music/dengoso.ly @@ -1,52 +1,17 @@ \version "2.20.0" \pointAndClickOff +\include "common.ly" +\include "guitar.ly" + + \header { title = "Dengoso" composer = "João Pernambuco" - copyright = \markup { - \with-url #"https://creativecommons.org/licenses/by-sa/4.0/" \line { - CC BY-SA 4.0 - } - } - tagline = \markup { - \with-url #"https://euandre.org/music.html" \line { - euandre.org/music.html - } - } -} - -cWithSlash = \markup { - \fontsize #-2 - \combine \roman C \translate #'(0.6 . -0.4) \draw-line #'(0 . 2.0) + copyright = \copyright + tagline = \tagline } -pestana = -#(define-music-function (barre location str music) (string? ly:music?) - (let ((elts (extract-named-music music '(NoteEvent EventChord)))) - (if (pair? elts) - (let ((first-element (first elts)) - (last-element (last elts))) - (set! (ly:music-property first-element 'articulations) - (cons (make-music 'TextSpanEvent 'span-direction -1) - (ly:music-property first-element 'articulations))) - (set! (ly:music-property last-element 'articulations) - (cons (make-music 'TextSpanEvent 'span-direction 1) - (ly:music-property last-element 'articulations)))))) - #{ - \once \override TextSpanner.font-shape = #'upright - \once \override TextSpanner.style = #'line - \once \override TextSpanner.bound-details = - #`((right - (text . ,#{ \markup { \draw-line #'( 0 . -.5) } #}) - (Y . 0)) - (left - (text . ,#{ \markup { \cWithSlash \fontsize #-2 #str } #}) - (Y . 0) - (attach-dir . -2))) - $music - #}) - globals = { \clef "treble_8" \key d \major @@ -59,49 +24,44 @@ upper = \relative c { \globals r16 8 16 8 16 | - 8. a16 8. g16 | - 8. fis16 8. 16 | + \corda "4" 8.\startTextSpan a16 8. g16 | + 8. fis16 8. 16\stopTextSpan | r2 | r16 d8 e16 fis e8 d16 | - a'8. a16 g8. g16 | - fis8. fis16 f8. e16 | + \corda "4" a'8.\startTextSpan a16 g8. g16 | + fis8. fis16 f8. e16\stopTextSpan | r2 | - 8 \pestana #"II" { fis' d16 } ~ | + 8 \pestanaSpan "II" \startTextSpan fis' d16\stopTextSpan ~ | e2 | - d8 \pestana #"II" { fis' d16 } e~ | + d8 \pestanaSpan "II" \startTextSpan fis' d16\stopTextSpan e~ | e2 | \repeat volta 2 { - \pestana #"V" { - a16 8 16 r16 8 16 | - a16 8 16 r16 | - } - 16 8 16^\markup { \cWithSlash \fontsize #-2 II } 8 a | - 16 8 16 \pestana #"II" { cis'8 } | + \pestanaSpan "V" a16\startTextSpan 8 16 r16 8 16 | + a16 8 16 r16 \stopTextSpan | + 16 8 \pestanaSingle "II" 16 8 a | + 16 8 16 \pestanaSpan "II" cis'8\startTextSpan \stopTextSpan | 16 8 16 8 | 16 8 16 r16 | 16 8 16 8 | - 16 8 16 8 | + 16 8 16 8 | - \pestana #"V" { - a'16 8 16 r16 8 16 | - a16 8 16 r16 | - } - 16 8 16^\markup { \cWithSlash \fontsize #-2 II } 8 a | - 16 8 16 \pestana #"II" { cis'8 } | + \pestanaSpan "V" a'16\startTextSpan 8 16 r16 8 16 | + a16 8 16 r16 \stopTextSpan | + 16 8 \pestanaSingle "II" 16 8 a | + 16 8 16 \pestanaSpan "II" cis'8\startTextSpan \stopTextSpan | d'16 8 16 dis'8 | 8 16 ( ) | } \alternative { - { d, \pestana #"II" { a'' d fis g fis g gis } | } - { r4 ^\markup { \cWithSlash \fontsize #-2 VII } | } + { d, \pestanaSpan "II" a''\startTextSpan d fis g fis g gis\stopTextSpan | } + { r4 \pestanaSingle "VII" | } } - \bar "||" \repeat volta 2 { \key d \minor @@ -113,47 +73,43 @@ upper = \relative c { ( ) c' a | ( ) ( ) | - ( ) ( ) | - ( ) | + ( ) ( ) | + ( ) | a a a a a | g g g g g | - \pestana #"III" { f, f f, f f f, } | - r \pestana #"II" { ( e')~ e4 } + \pestanaSpan "III" f,\startTextSpan f f, f f f,\stopTextSpan | + \pestanaSpan "II" r\startTextSpan ( e')~ e4\stopTextSpan - \pestana #"III" { 16( ) } | + \pestanaSpan "III" 16(\startTextSpan ) \stopTextSpan | ( ) ( ) | } \alternative { { r r | } - { r4 ^\markup { \cWithSlash \fontsize #-2 X } | } + { r4 \pestanaSingle "X" | } } \key d \major - \pestana #"V" { - a16 8 16 r16 g'8 fis16 | - a16 8 16 r16 cis fis cis | - } - 16 8 16^\markup { \cWithSlash \fontsize #-2 II } 8 a | - b16 8 16 \pestana #"II" { cis'8 } | + \pestanaSpan "V" a16\startTextSpan 8 16 r16 g'8 fis16 | + a16 8 16 r16 cis fis cis\stopTextSpan | + 16 8 \pestanaSingle "II" 16 8 a | + b16 8 16 \pestanaSpan "II" cis'8\startTextSpan \stopTextSpan | d'16 8 16 fis'8 | e'16 8 16 r16 g cis e | 16 8 16 8 | - e'16 8 16 8 | + e'16 8 16 8 | - \pestana #"V" { - a'16 8 16 r16 g'8 fis16 | - a16 8 16 r16 cis fis cis | - } - 16 8 16^\markup { \cWithSlash \fontsize #-2 II } 8 a | - b16 8 16 \pestana #"II" { cis'8 } | + \pestanaSpan "V" a'16\startTextSpan 8 16 r16 g'8 fis16 | + a16 8 16 r16 cis fis cis\stopTextSpan | + 16 8 \pestanaSingle "II" 16 8 a | + b16 8 16 \pestanaSpan "II" cis'8\startTextSpan \stopTextSpan | d'16 8 16 dis'8 | e'8 16 d'( b) g | fis d' a fis e cis' g e - r4 ^\markup { \cWithSlash \fontsize #-2 VII } | + r4 \pestanaSingle "VII" | \bar "||" \key d \minor @@ -163,55 +119,48 @@ upper = \relative c { 16 8 16 8 | 16 8 16 f'8 | - \pestana #"V" { - 16 8 16 a,8 | - 16 c, } b, | - \pestana #"V" { c, a c a' c, } | + \pestanaSpan "V" 16\startTextSpan 8 16 a,8 | + 16 c,\stopTextSpan b, | + \pestanaSpan "V" \startTextSpan c, a c a' c,\stopTextSpan | 8 16 f'8 | f'16 8 16 8 | - \pestana #"III" { - 16 8 16 g'8 | - g'16 8 16 } \pestana #"V" { 8 } | + \pestanaSpan "III" 16\startTextSpan 8 16 g'8 | + g'16 8 16\stopTextSpan \pestanaSpan "V" 8\startTextSpan \stopTextSpan | - \pestana #"V" { - 16 8 16 8 16 | - 8 16 8 16 | - 8 a16 a 8 16 | - 8 a16 a a8 a16 | - } + \pestanaSpan "V" 16\startTextSpan 8 16 8 16 | + 8 16 8 16 | + 8 a16 a 8 16 | + 8 a16 a a8 a16\stopTextSpan | \key d \major - \pestana #"V" { - a'16 8 16 r16 g'8 fis16 | - a16 8 16 r16 cis fis cis | - } - 16 8 16^\markup { \cWithSlash \fontsize #-2 II } 8 a | - b16 8 16 \pestana #"II" { cis'8 } | + \pestanaSpan "V" a'16\startTextSpan 8 16 r16 g'8 fis16 | + a16 8 16 r16 cis fis cis\stopTextSpan | + 16 8 \pestanaSingle "II" 16 8 a | + b16 8 16 \pestanaSpan "II" cis'8\startTextSpan \stopTextSpan | d'16 8 16 fis'8 | e'16 8 16 r16 g cis e | 16 8 16 8 | - e'16 8 16 8 | + e'16 8 16 8 | - \pestana #"V" { - a'16 8 16 r16 g'8 fis16 | - a16 8 16 r16 cis fis cis | - } - 16 8 16^\markup { \cWithSlash \fontsize #-2 II } 8 a | - b16 8 16 \pestana #"II" { cis'8 } | + \pestanaSpan "V" a'16\startTextSpan 8 16 r16 g'8 fis16 | + a16 8 16 r16 cis fis cis\stopTextSpan | + 16 8 \pestanaSingle "II" 16 8 a | + b16 8 16 \pestanaSpan "II" cis'8\startTextSpan \stopTextSpan | d'16 8 16 dis'8 | e'8 16 d'( b) g | fis d' a fis e cis' g e - r4 ^\markup { \cWithSlash \fontsize #-2 VII } | + r4 \pestanaSingle "VII" | \bar "|." } lower = \relative c { \globals + \set stringNumberOrientations = #'(down) - r2 | + r2_\markup { \circle 6 in D } | r8 a r a | r8 a r a | r16 8 16 8 16 | @@ -250,14 +199,12 @@ lower = \relative c { { d,2 | } { d8 a' d4 | } } - - \bar "||" - + \repeat volta 2 { \key d \minor - a'16 a8 a16 a a8 a16 | - g g8 g16 g g8 g16 | + a'16\4 a8 a16 a a8 a16 | + g\4 g8 g16 g g8 g16 | f f8 f16 f f8 f16 | e4 a, | @@ -269,7 +216,7 @@ lower = \relative c { a'16 a8 a16 a a8 a16 | g g8 g16 g g8 g16 | f, f8 f16 f f8 f16 | - e4 r16 | + e4 r16 ( ) | g4 r4 | d g' | diff --git a/music/guitar.ly b/music/guitar.ly new file mode 100644 index 0000000..76afb00 --- /dev/null +++ b/music/guitar.ly @@ -0,0 +1,33 @@ + +pestanaPrivate = \markup { + \fontsize #-2 + \combine + \roman C + \translate #'(0.6 . -0.4) \draw-line #'(0 . 2.0) +} + +pestanaSingle = + #(define-music-function (fret-number music) (string? ly:music?) + #{ + $music ^\markup { \pestanaPrivate \fontsize #-2 $fret-number } + #}) + +pestanaSpan = + #(define-music-function (fret-number) (string?) + #{ + \once \override TextSpanner.font-shape = #'upright + \once \override TextSpanner.style = #'solid + \once \override TextSpanner.bound-details.left.stencil-align-dir-y = #CENTER + \once \override TextSpanner.bound-details.right.text = \markup { \draw-line #'(0 . -.5) } + \once \override TextSpanner.bound-details.left.text = \markup { \pestanaPrivate \fontsize #-2 $fret-number } + #}) + +corda = + #(define-music-function (string-number) (string?) + #{ + \once \override TextSpanner.style = #'solid + \once \override TextSpanner.font-size = #-5 + \once \override TextSpanner.bound-details.left.stencil-align-dir-y = #CENTER + \once \override TextSpanner.bound-details.right.text = \markup { \draw-line #'( 0 . -.5) } + \once \override TextSpanner.bound-details.left.text = \markup { \circle \number $string-number } + #}) -- cgit v1.2.3