[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How can I print only some parts of a score (staves, but no chords)?
From: |
Valentin Petzel |
Subject: |
Re: How can I print only some parts of a score (staves, but no chords)? |
Date: |
Sun, 30 Apr 2023 15:50:26 +0200 |
Hello Alessandro,
lilypond-book is for embedding Lilypond snippets into a document typeset by
LaTeX. If you simply want to combine multiple scores into one scorebook
lilypond can do that by itself.
Doing multiple
\score { ... }
blocks will already do the trick. You can even have multiple parts (using
\bookpart { ... } or even multiple separate books from the same source file
using \book { ... }).
Now, there are many ways of having selective content. Using tags certainly is
one of them. This is nice if you put the content of your \score into a
variable, for then you can simply do
\score { \removeWithTag #'chords \myMusic }
like this:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.24.1"
\language "italiano"
\paper {
% annotate-spacing = ##t
system-system-spacing.basic-distance = #20
}
\header {
title = "Ô toi l'au-delà de tout"
composer = "Taizé"
opus = "149"
}
removeVoice =
#(define-music-function (music) (ly:music?)
(music-map
(lambda (m)
(if (eqv? (ly:music-property m 'context-type) 'Voice)
(ly:music-set-property!
m
'property-operations
'((remove "Note_heads_engraver"))))
m)
music))
muteStaffWithTag =
#(define-music-function (tags music) (symbol-list-or-symbol? ly:music?)
(music-map
(lambda (m)
(if (not ((tags-remove-predicate tags) m))
(make-music
'ContextSpeccedMusic
'create-new #t
'property-operations '((accepts "Voice"))
'context-type 'Devnull
'element (removeVoice (ly:music-property m 'element)))
m))
music))
scoreMusic =
<<
\tag #'chords \chords {
\set chordChanges = ##t
\partial 8 s8 | re2.:m | re2.:m | fa4 sol2:m7 | do2:7 fa4 |
sol1:m7 fa2 | re2:m la:7 | re:m la:7
}
\tag #'music \new Staff \new Voice = "voice" \relative {
\clef "treble"
\key re \minor
\overrideTimeSignatureSettings
3/4 % timeSignatureFraction
1/8 % baseMomentFraction
2,2,2 % beatStructure
#'() % beamExceptions
\overrideTimeSignatureSettings
4/4 % timeSignatureFraction
1/8 % baseMomentFraction
2,2,2,2 % beatStructure
#'() % beamExceptions
\numericTimeSignature % to display 4/4 instead of C
\time 3/4
\partial 8 re'8\( \bar ".|:" re4 mi8 sol fa mi | re2\) fa8\( sol | la4 sib
sib8 la | sol2\) la8\( re |
re4 do sib8 la | sol4 la2\) | \time 4/4 la8\( re, mi fa sol4. la8 | fa4
sol8 fa mi4.\) re8 \bar ":|."
}
\tag #'lyrics \new Lyrics \lyricsto "voice" {
Ô Toi l'au -- de -- là de tout,
quel es -- prit peut Te sai -- sir?
Tous les ê -- tres Te cé -- lè -- brent,
le dé -- sir de tous a -- spi -- re vers Toi. Ô
}
>>
\markup "Everything"
\score{
\layout{}
\scoreMusic
}
\markup "No chords"
\score{
\layout{}
\removeWithTag #'chords \scoreMusic
}
\markup "No lyrics"
\score{
\layout{}
\removeWithTag #'lyrics \scoreMusic
}
\markup "No music"
\score{
\layout {
\context {
\Lyrics
\consists Bar_engraver
\override BarLine.bar-extent = #'(-1.5 . 1.5)
\override BarLine.self-alignment-Y = #-0.7
\override BarLine.Y-offset = #self-alignment-interface::y-aligned-on-self
%\override BarLine.extra-spacing-width = #'( . 1)
}
\context {
\Score
\override SpacingSpanner.strict-note-spacing = ##t
}
}
\muteStaffWithTag #'music \scoreMusic
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
There are many ways to achieve your goal, an the best way might depend on your
circumstances and preferences.
Cheers,
Valentin
Am Sonntag, 30. April 2023, 13:19:42 CEST schrieb Alessandro Bertulli:
> Hi all,
>
> I'm playing around a bit with Lilypond and I have copied some sheets I
> have purchased in order to build a custom songbook. Since I play rhythmic
> guitar, I have decorated the staves with chords at the top:
signature.asc
Description: This is a digitally signed message part.