From 1f7e785d25b62afbf2ed3119a9874010e79b9b12 Mon Sep 17 00:00:00 2001 From: Phil Holmes Date: Wed, 8 Jun 2016 12:08:14 +0100 Subject: [PATCH] LSR updates --- .../contemporary-notation.snippet-list | 1 + ...e-and-drumpitchtable-in-layout-and-midi.ly | 151 ++++++++++++++++++ Documentation/snippets/flat-ties.ly | 117 ++++++++++++++ Documentation/snippets/midi.snippet-list | 1 + ...g-2.12-lyrics-spacing-in-newer-versions.ly | 2 +- .../snippets/percussion.snippet-list | 1 + .../piano-template-with-centered-lyrics.ly | 13 +- Documentation/snippets/pitches.snippet-list | 1 + .../snippets/scheme-language.snippet-list | 1 + .../snippets/simultaneous-notes.snippet-list | 1 + .../snippets/specific-notation.snippet-list | 1 + .../snippets/staff-notation.snippet-list | 2 + .../tweaks-and-overrides.snippet-list | 1 + .../two--partcombine-pairs-on-one-staff.ly | 101 ++++++++++++ 14 files changed, 382 insertions(+), 12 deletions(-) create mode 100644 Documentation/snippets/customize-drumpitchnames,-drumstyletable-and-drumpitchtable-in-layout-and-midi.ly create mode 100644 Documentation/snippets/flat-ties.ly create mode 100644 Documentation/snippets/two--partcombine-pairs-on-one-staff.ly diff --git a/Documentation/snippets/contemporary-notation.snippet-list b/Documentation/snippets/contemporary-notation.snippet-list index 098532b961..b12e5980dd 100644 --- a/Documentation/snippets/contemporary-notation.snippet-list +++ b/Documentation/snippets/contemporary-notation.snippet-list @@ -4,6 +4,7 @@ clusters.ly contemporary-glissando.ly double-glissando.ly flat-flags-and-beam-nibs.ly +flat-ties.ly flute-slap-notation.ly heavily-customized-polymetric-time-signatures.ly laissez-vibrer-ties.ly diff --git a/Documentation/snippets/customize-drumpitchnames,-drumstyletable-and-drumpitchtable-in-layout-and-midi.ly b/Documentation/snippets/customize-drumpitchnames,-drumstyletable-and-drumpitchtable-in-layout-and-midi.ly new file mode 100644 index 0000000000..0d2a8cee6a --- /dev/null +++ b/Documentation/snippets/customize-drumpitchnames,-drumstyletable-and-drumpitchtable-in-layout-and-midi.ly @@ -0,0 +1,151 @@ +%% DO NOT EDIT this file manually; it is automatically +%% generated from LSR http://lsr.di.unimi.it +%% Make any changes in LSR itself, or in Documentation/snippets/new/ , +%% and then run scripts/auxiliar/makelsr.py +%% +%% This file is in the public domain. +\version "2.18.0" + +\header { + lsrtags = "midi, percussion, pitches, specific-notation" + + texidoc = " +If you want to use customized drum-pitch-names for an own drum-style +with proper output for layout and midi, follow the steps as +demonstrated in the code below. In short: + +* define the names * define the appearence * tell LilyPond to use it +for layout * assign pitches to the names * tell LilyPond to use them +for midi + +" + doctitle = "Customize drumPitchNames drumStyleTable and drumPitchTable in layout and midi" +} % begin verbatim + +%% This snippet tries to amend +%% NR 2.5.1 Common notation for percussion - Custom percussion staves +%% http://lilypond.org/doc/v2.18/Documentation/notation/common-notation-for-percussion#custom-percussion-staves + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% To use custom drum-pitch-names for your score and midi you need to follow +%% this route: +%% +%%%%%%%%%%%% +%% LAYOUT: +%%%%%%%%%%%% +%% +%% (1) Define a name and put it in `drumPitchNames' +%% This can be done at toplevel with +%% drumPitchNames #'my-name = #'my-name +%% or shorter: +%% drumPitchNames.my-name = #'my-name +%% It's possible to add an alias as well. +%% (2) Define how it should be printed +%% Therefore put them into a toplevel-list, where each entry should look: +%% (my-name +%% note-head-style-or-default +%% articulation-string-or-#f +%% staff-position) +%% Example: +%% #(define my-style +%% '( +%% (my-name default "tenuto" -1) +%% ; ... +%% )) +%% (3) Tell LilyPond to use this custom-definitions, with +%% drumStyleTable = #(alist->hash-table my-style) +%% in a \layout or \with +%% +%% Now we're done for layout, here a short, but complete example: +%% \new DrumStaff +%% \with { drumStyleTable = #(alist->hash-table my-style) } +%% \drummode { my-name } +%% +%%%%%%%%%%%% +%% MIDI: +%%%%%%%%%%%% +%% +%% (1) Again at toplvel, assign a pitch to your custom-note-name +%% midiDrumPitches #'my-name = #(ly:make-pitch -1 4 FLAT) +%% or shorter: +%% midiDrumPitches.my-name = ges +%% Note that you have to use the name, which is in drumPitchNames, no alias +%% (2) Tell LilyPond to use this pitch(es), with +%% drumPitchTable = #(alist->hash-table midiDrumPitches) +%% +%% Example: +%% \score { +%% \new DrumStaff +%% \with { +%% drumStyleTable = #(alist->hash-table my-style) +%% drumPitchTable = #(alist->hash-table midiDrumPitches) +%% } +%% \drummode { my-name4 } +%% \layout {} +%% \midi {} +%% } +%% +%%%%%%%%%%%% +%% TESTING +%%%%%%%%%%%% +%% +%% To test whether all is fine, run the following sequence in terminal: +%% lilypond my-file.ly +%% midi2ly my-file.midi +%% gedit my-file-midi.ly +%% +%% Which will do: +%% 1. create pdf and midi +%% 2. transform the midi back to a .ly-file +%% (note: midi2ly is not always good in correctly identifying enharmonic pitches) +%% 3. open this file in gedit (or use another editor) +%% Now watch what you've got. +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% FULL EXAMPLE +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +drumPitchNames.dbass = #'dbass +drumPitchNames.dba = #'dbass % 'db is in use already +drumPitchNames.dbassmute = #'dbassmute +drumPitchNames.dbm = #'dbassmute +drumPitchNames.do = #'dopen +drumPitchNames.dopenmute = #'dopenmute +drumPitchNames.dom = #'dopenmute +drumPitchNames.dslap = #'dslap +drumPitchNames.ds = #'dslap +drumPitchNames.dslapmute = #'dslapmute +drumPitchNames.dsm = #'dslapmute + +#(define djembe + '((dbass default #f -2) + (dbassmute default "stopped" -2) + (dopen default #f 0) + (dopenmute default "stopped" 0) + (dslap default #f 2) + (dslapmute default "stopped" 2))) + +midiDrumPitches.dbass = g +midiDrumPitches.dbassmute = fis +midiDrumPitches.dopen = a +midiDrumPitches.dopenmute = gis +midiDrumPitches.dslap = b +midiDrumPitches.dslapmute = ais + +one = \drummode { r4 dba4 do ds r dbm dom dsm } + +\score { + \new DrumStaff + \with { + \override StaffSymbol.line-count = #3 + instrumentName = #"Djembe " + drumStyleTable = #(alist->hash-table djembe) + drumPitchTable = #(alist->hash-table midiDrumPitches) + } + \one + \layout {} + \midi {} +} diff --git a/Documentation/snippets/flat-ties.ly b/Documentation/snippets/flat-ties.ly new file mode 100644 index 0000000000..db63fb42fb --- /dev/null +++ b/Documentation/snippets/flat-ties.ly @@ -0,0 +1,117 @@ +%% DO NOT EDIT this file manually; it is automatically +%% generated from LSR http://lsr.di.unimi.it +%% Make any changes in LSR itself, or in Documentation/snippets/new/ , +%% and then run scripts/auxiliar/makelsr.py +%% +%% This file is in the public domain. +\version "2.18.0" + +\header { + lsrtags = "contemporary-notation, scheme-language, staff-notation, tweaks-and-overrides" + + texidoc = " +The function takes the default @code{Tie.stencil} as an argument, +calculating the result relying on the extents of this default. Further +tweaking is possible by overriding @code{Tie.details.height-limit} or +with @code{\\shape}. It's also possible to change the custom-definition +on the fly. + +" + doctitle = "Flat Ties" +} % begin verbatim + +%% http://lsr.di.unimi.it/LSR/Item?id=1031 + +#(define ((flared-tie coords) grob) + + (define (pair-to-list pair) + (list (car pair) (cdr pair))) + + (define (normalize-coords goods x y dir) + (map + (lambda (coord) + ;(coord-scale coord (cons x (* y dir))) + (cons (* x (car coord)) (* y dir (cdr coord)))) + goods)) + + (define (my-c-p-s points thick) + (make-connected-path-stencil + points + thick + 1.0 + 1.0 + #f + #f)) + + ;; outer let to trigger suicide + (let ((sten (ly:tie::print grob))) + (if (grob::is-live? grob) + (let* ((layout (ly:grob-layout grob)) + (line-thickness (ly:output-def-lookup layout 'line-thickness)) + (thickness (ly:grob-property grob 'thickness 0.1)) + (used-thick (* line-thickness thickness)) + (dir (ly:grob-property grob 'direction)) + (xex (ly:stencil-extent sten X)) + (yex (ly:stencil-extent sten Y)) + (lenx (interval-length xex)) + (leny (interval-length yex)) + (xtrans (car xex)) + (ytrans (if (> dir 0)(car yex) (cdr yex))) + (uplist + (map pair-to-list + (normalize-coords coords lenx (* leny 2) dir)))) + + (ly:stencil-translate + (my-c-p-s uplist used-thick) + (cons xtrans ytrans))) + '()))) + +#(define flare-tie + (flared-tie '((0 . 0)(0.1 . 0.2) (0.9 . 0.2) (1.0 . 0.0)))) + +\layout { + \context { + \Voice + \override Tie.stencil = #flare-tie + } +} + +\paper { ragged-right = ##f } + +\relative c' { + a4~a + \override Tie.height-limit = 4 + a'4~a + a'4~a + ~ q + + \break + + a'4~a + \once \override Tie.details.height-limit = 14 + a4~a + + \break + + a4~a + \once \override Tie.details.height-limit = 0.5 + a4~a + + \break + + a4~a + \shape #'((0 . 0) (0 . 0.4) (0 . 0.4) (0 . 0)) Tie + a4~a + + \break + + a4~a + \once \override Tie.stencil = + #(flared-tie '((0 . 0)(0.1 . 0.4) (0.9 . 0.4) (1.0 . 0.0))) + a4~a + + a4~a + \once \override Tie.stencil = + #(flared-tie '((0 . 0)(0.06 . 0.1) (0.94 . 0.1) (1.0 . 0.0))) + a4~a +} diff --git a/Documentation/snippets/midi.snippet-list b/Documentation/snippets/midi.snippet-list index ecc73acb4e..243a5a03a0 100644 --- a/Documentation/snippets/midi.snippet-list +++ b/Documentation/snippets/midi.snippet-list @@ -1,5 +1,6 @@ changing-midi-output-to-one-channel-per-voice.ly changing-the-tempo-without-a-metronome-mark.ly creating-custom-dynamics-in-midi-output.ly +customize-drumpitchnames,-drumstyletable-and-drumpitchtable-in-layout-and-midi.ly demo-midiinstruments.ly replacing-default-midi-instrument-equalization.ly diff --git a/Documentation/snippets/obtaining-2.12-lyrics-spacing-in-newer-versions.ly b/Documentation/snippets/obtaining-2.12-lyrics-spacing-in-newer-versions.ly index 1b294569e3..de3e108a48 100644 --- a/Documentation/snippets/obtaining-2.12-lyrics-spacing-in-newer-versions.ly +++ b/Documentation/snippets/obtaining-2.12-lyrics-spacing-in-newer-versions.ly @@ -49,7 +49,7 @@ bassMusic = \relative c { } words = \lyricmode { - Great is Thy faith- ful- ness, + Great is Thy faith -- ful -- ness, } \score { diff --git a/Documentation/snippets/percussion.snippet-list b/Documentation/snippets/percussion.snippet-list index 5a29fb2c15..edef3b78e2 100644 --- a/Documentation/snippets/percussion.snippet-list +++ b/Documentation/snippets/percussion.snippet-list @@ -1,4 +1,5 @@ adding-drum-parts.ly +customize-drumpitchnames,-drumstyletable-and-drumpitchtable-in-layout-and-midi.ly heavily-customized-polymetric-time-signatures.ly jazz-combo-template.ly percussion-beaters.ly diff --git a/Documentation/snippets/piano-template-with-centered-lyrics.ly b/Documentation/snippets/piano-template-with-centered-lyrics.ly index d1f05af6dc..008535e304 100644 --- a/Documentation/snippets/piano-template-with-centered-lyrics.ly +++ b/Documentation/snippets/piano-template-with-centered-lyrics.ly @@ -38,20 +38,11 @@ text = \lyricmode { } \score { - \new GrandStaff << + \new PianoStaff << \new Staff = upper { \new Voice = "singer" \upper } \new Lyrics \lyricsto "singer" \text \new Staff = lower { \lower } >> - \layout { - \context { - \GrandStaff - \accepts "Lyrics" - } - \context { - \Lyrics - \consists "Bar_engraver" - } - } + \layout { } \midi { } } diff --git a/Documentation/snippets/pitches.snippet-list b/Documentation/snippets/pitches.snippet-list index 7410307eb5..ce27407d67 100644 --- a/Documentation/snippets/pitches.snippet-list +++ b/Documentation/snippets/pitches.snippet-list @@ -12,6 +12,7 @@ clefs-can-be-transposed-by-arbitrary-amounts.ly coloring-notes-depending-on-their-pitch.ly creating-a-sequence-of-notes-on-various-pitches.ly creating-custom-key-signatures.ly +customize-drumpitchnames,-drumstyletable-and-drumpitchtable-in-layout-and-midi.ly forcing-a-clef-symbol-to-be-displayed.ly generating-random-notes.ly hiding-accidentals-on-tied-notes-at-the-start-of-a-new-system.ly diff --git a/Documentation/snippets/scheme-language.snippet-list b/Documentation/snippets/scheme-language.snippet-list index 2513ba4682..a963aea6be 100644 --- a/Documentation/snippets/scheme-language.snippet-list +++ b/Documentation/snippets/scheme-language.snippet-list @@ -11,6 +11,7 @@ customizing-the-position-and-number-of-dots-in-repeat-sign-bar-lines.ly displaying-grob-ancestry.ly drawing-boxes-around-grobs.ly drawing-circles-around-various-objects.ly +flat-ties.ly generating-random-notes.ly generating-whole-scores-also-book-parts-in-scheme-without-using-the-parser.ly outputting-the-version-number.ly diff --git a/Documentation/snippets/simultaneous-notes.snippet-list b/Documentation/snippets/simultaneous-notes.snippet-list index c2be0bb2e3..cd3e01f1de 100644 --- a/Documentation/snippets/simultaneous-notes.snippet-list +++ b/Documentation/snippets/simultaneous-notes.snippet-list @@ -9,3 +9,4 @@ forcing-horizontal-shift-of-notes.ly making-an-object-invisible-with-the-transparent-property.ly moving-dotted-notes-in-polyphony.ly suppressing-warnings-for-clashing-note-columns.ly +two--partcombine-pairs-on-one-staff.ly diff --git a/Documentation/snippets/specific-notation.snippet-list b/Documentation/snippets/specific-notation.snippet-list index b372f9879f..bc43d7d3ba 100644 --- a/Documentation/snippets/specific-notation.snippet-list +++ b/Documentation/snippets/specific-notation.snippet-list @@ -15,6 +15,7 @@ contemporary-glissando.ly controlling-the-placement-of-chord-fingerings.ly creating-blank-staves.ly custodes.ly +customize-drumpitchnames,-drumstyletable-and-drumpitchtable-in-layout-and-midi.ly demo-midiinstruments.ly embedding-native-postscript-in-a--markup-block.ly engravers-one-by-one.ly diff --git a/Documentation/snippets/staff-notation.snippet-list b/Documentation/snippets/staff-notation.snippet-list index 0322a423b0..bfb3706161 100644 --- a/Documentation/snippets/staff-notation.snippet-list +++ b/Documentation/snippets/staff-notation.snippet-list @@ -16,6 +16,7 @@ cross-staff-stems.ly display-bracket-with-only-one-staff-in-a-system.ly extending-a-trillspanner.ly extending-glissandi-across-repeats.ly +flat-ties.ly forcing-measure-width-to-adapt-to-metronomemarks-width.ly glissandi-can-skip-grobs.ly how-to-print-two-rehearsal-marks-above-and-below-the-same-barline-method-1.ly @@ -43,6 +44,7 @@ tick-bar-lines.ly time-signature-in-parentheses---method-3.ly time-signature-in-parentheses.ly tweaking-clef-properties.ly +two--partcombine-pairs-on-one-staff.ly use-square-bracket-at-the-start-of-a-staff-group.ly using-autochange-with-more-than-one-voice.ly vertical-aligned-staffgroups-without-connecting-systemstartbar.ly diff --git a/Documentation/snippets/tweaks-and-overrides.snippet-list b/Documentation/snippets/tweaks-and-overrides.snippet-list index ed848f2c0a..b0bf51340d 100644 --- a/Documentation/snippets/tweaks-and-overrides.snippet-list +++ b/Documentation/snippets/tweaks-and-overrides.snippet-list @@ -42,6 +42,7 @@ dynamics-text-spanner-postfix.ly extending-a-trillspanner.ly extending-glissandi-across-repeats.ly fine-tuning-pedal-brackets.ly +flat-ties.ly forcing-horizontal-shift-of-notes.ly fret-diagrams-explained-and-developed.ly generating-custom-flags.ly diff --git a/Documentation/snippets/two--partcombine-pairs-on-one-staff.ly b/Documentation/snippets/two--partcombine-pairs-on-one-staff.ly new file mode 100644 index 0000000000..da3d7b3d44 --- /dev/null +++ b/Documentation/snippets/two--partcombine-pairs-on-one-staff.ly @@ -0,0 +1,101 @@ +%% DO NOT EDIT this file manually; it is automatically +%% generated from LSR http://lsr.di.unimi.it +%% Make any changes in LSR itself, or in Documentation/snippets/new/ , +%% and then run scripts/auxiliar/makelsr.py +%% +%% This file is in the public domain. +\version "2.19.22" + +\header { + lsrtags = "simultaneous-notes, staff-notation" + + texidoc = " +The @code{\\partcombine} function takes two music expressions each +containing a part, and distributes them among four @code{Voice}s named +@qq{two} @qq{one} @qq{solo} and @qq{chords} depending on when and how +the parts merged into a common voice. The voices output from +@code{\\partcombine} can have their layout properties adjusted in the +usual way. Here we define extensions of @code{\\partcombine} to make +it easier to put four voices on a staff. + +soprano = @{ d'4 | cis' b e' d'8 cis' | cis'2 b @} alto = @{ fis4 | +e8 fis gis ais b4 b | b ais fis2 @} tenor = @{ a8 b | cis' dis' e'4 b8 +cis' d'4 | gis cis' dis'2 @} bass = @{ fis8 gis | a4 gis g fis | eis +fis b,2 @} + +\\new Staff << + \\key b\\minor + \\clef alto + \\partial 4 + \\transpose b b' + \\partcombineUp \\soprano \\alto + \\partcombineDown \\tenor \\bass >> + +" + doctitle = "Two \\partcombine pairs on one staff" +} % begin verbatim + +\layout { + \context { + \Staff + \accepts "VoiceBox" + } + \context { + \name "VoiceBox" + \type "Engraver_group" + \defaultchild "Voice" + \accepts "Voice" + } +} + +partcombineUp = +#(define-music-function (partOne partTwo) + (ly:music? ly:music?) +"Take the music in @var{partOne} and @var{partTwo} and return +a @code{VoiceBox} named @q{Up} containing @code{Voice}s +that contain @var{partOne} and @var{partTwo} merged into one +voice where feasible. This variant sets the default voicing +in the output to use upward stems." +#{ + \new VoiceBox = "Up" << + \context Voice = "one" { \voiceOne } + \context Voice = "two" { \voiceThree } + \context Voice = "shared" { \voiceOne } + \context Voice = "solo" { \voiceOne } + \partcombine #partOne #partTwo + >> +#}) + +partcombineDown = # +(define-music-function (partOne partTwo) + (ly:music? ly:music?) +"Take the music in @var{partOne} and @var{partTwo} and return +a @code{VoiceBox} named @q{Down} containing @code{Voice}s +that contain @var{partOne} and @var{partTwo} merged into one +voice where feasible. This variant sets the default voicing +in the output to use downward stems." +#{ + \new VoiceBox = "Down" << + \set VoiceBox.soloText = #"Solo III" + \set VoiceBox.soloIIText = #"Solo IV" + \context Voice ="one" { \voiceFour } + \context Voice ="two" { \voiceTwo } + \context Voice ="shared" { \voiceFour } + \context Voice ="solo" { \voiceFour } + \partcombine #partOne #partTwo + >> +#}) + +soprano = { d'4 | cis' b e' d'8 cis' | cis'2 b } +alto = { fis4 | e8 fis gis ais b4 b | b ais fis2 } +tenor = { a8 b | cis' dis' e'4 b8 cis' d'4 | gis cis' dis'2 } +bass = { fis8 gis | a4 gis g fis | eis fis b,2 } + +\new Staff << + \key b\minor + \clef alto + \partial 4 + \transpose b b' + \partcombineUp \soprano \alto + \partcombineDown \tenor \bass +>> -- 2.39.2