From 19b5fe2d949127d331695b9df586678f6eb1d025 Mon Sep 17 00:00:00 2001 From: tux Date: Mon, 7 Aug 2023 16:24:43 +0200 Subject: [PATCH] transposeGlobal kann ganzen Song transponieren --- general_include.ly | 2 ++ inline_score.ly | 5 +++++ standalone_output.ly | 2 ++ transposition.ly | 13 +++++++++++++ verses_with_chords.ly | 2 +- 5 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 inline_score.ly create mode 100644 transposition.ly diff --git a/general_include.ly b/general_include.ly index 61a04c2..d0606b9 100644 --- a/general_include.ly +++ b/general_include.ly @@ -12,9 +12,11 @@ \include "footer_with_songinfo.ly" \include "auto_rest_merging.ly" \include "chord_settings.ly" +\include "transposition.ly" \include "verses_with_chords.ly" \include "arrows_in_scores.ly" \include "swing_style.ly" +\include "inline_score.ly" % reset important variables LAYOUT = \layout { \generalLayout } diff --git a/inline_score.ly b/inline_score.ly new file mode 100644 index 0000000..2619c8c --- /dev/null +++ b/inline_score.ly @@ -0,0 +1,5 @@ +inline-score = +#(define-music-function (music) (ly:music?) + #{ + \transposable #music + #}) diff --git a/standalone_output.ly b/standalone_output.ly index a79359f..8209a9a 100644 --- a/standalone_output.ly +++ b/standalone_output.ly @@ -1,6 +1,8 @@ % set the speed of the midi music #(define midiQuarterNoteSpeed (if (defined? 'midiQuarterNoteSpeed) midiQuarterNoteSpeed 90)) +MUSIC = { \transposable \MUSIC } + % nur Output wenn noStandaloneOutput auf false steht output = #(if (not noStandaloneOutput) #{ diff --git a/transposition.ly b/transposition.ly new file mode 100644 index 0000000..4e0f0a1 --- /dev/null +++ b/transposition.ly @@ -0,0 +1,13 @@ +TRANSPOSITION = ##f + +transposeGlobal = +#(define-void-function (from to) (ly:pitch? ly:pitch?) + (set! TRANSPOSITION (cons from to))) + +transposable = +#(define-music-function (music) (ly:music?) + (if TRANSPOSITION + #{ + \transpose #(car TRANSPOSITION) #(cdr TRANSPOSITION) #music + #} + music)) diff --git a/verses_with_chords.ly b/verses_with_chords.ly index 6a35a4d..957ecee 100644 --- a/verses_with_chords.ly +++ b/verses_with_chords.ly @@ -119,7 +119,7 @@ (regexp-substitute/global #f "\\(( *)([^,()]*)( *),([^)]*)\\)" (regexp-substitute/global #f "(([^ \n]*\\([^()]*\\)[^ \n]*)+)" verse 'pre " \\concat { " 1 " } " 'post) - 'pre "\\textup \\line { \"" 1 "\" " 2 " \"" 3 "\" } \\score { " transp " \\chords { s4 " 4 " } \\layout { \\verseChordLayout } }" 'post)) + 'pre "\\textup \\line { \"" 1 "\" " 2 " \"" 3 "\" } \\score { \\transposable " transp " \\chords { s4 " 4 " } \\layout { \\verseChordLayout } }" 'post)) )))) % Kompletter Vers aus dem Akkorde entfernt werden