Re: Parenthensize a horizontal group?

2021-08-26 Thread Mark Probert
You wrote:
> parenthesizeMusic function

This is wonderful! Thank you! 

This is a slight error, which I don't have the skills to fix, in that 
there is no closing paren if music consists of a single note (a 
first/last problem?). Otherwise, straight into the library!

 .. mark.



Re: Parenthensize a horizontal group?

2021-08-26 Thread Ernie Braganza
Perfect! I thought it would be called padding. Appreciate the response.

On Thu, Aug 26, 2021 at 3:07 AM Aaron Hill  wrote:

> On 2021-08-25 7:36 am, Ernie Braganza wrote:
> > When I use the parenthesizeMusic function or the snippet in LSR-902
> > with a
> > winged repeat bar, the parenthesis collides with the bar. I have not
> > been
> > able to find a way to pad the bar or the parentheses in a way that
> > avoids
> > this.
> > [in this code I could simply reduce the font size, but that does not
> > fix
> > the issue in my score]
> >
> > \relative c''
> > {
> > \override ParenthesesItem.font-size = 7
> >   \override ParenthesesItem.extra-offset =
> >   #(lambda (grob) (cons 0 (* -1/2 (ly:grob-staff-position grob
> >   g2 r4
> >   \parenthesizeMusic {
> > d'8 bes8
> >   }
> >   \bar":|]"
> > }
>
> It is possible to add some padding to the BarLine:
>
> 
>\once \override Staff.BarLine.extra-spacing-width = #'(-2 . 0)
>\bar ":|]"
> 
>
>
> -- Aaron Hill
>


Re: Stanzas and refrain

2021-08-26 Thread JxStarks
Hi Carlos,

I do a lot of this sort of thing for my church. I usually use the following
format:

\header { }
global { }
chordNames \ chordmode { \global chord, chord, chord, etc.}
melody = \relative c '' { \global   music, music, music, etc }
verse = \lyricmode { \set stanza = "1. " words, words, words, etc, chorus }

\score {
  <<
\new ChordNames \chordNames
\new Staff { \melody }
\addlyrics { \verse }
\addlyrics { \set stanza = "2. " words, words, words, etc (no chorus) }
\addlyrics { \set stanza = "3. " words, words, words, etc (no chorus) }
  >>

Ths words for the chorus only need to be in Verse 1, unless they change
each time. Also, because I'm old, I add this after the '\set stanza' at the
beginning of each word section:
\override LyricText font-size = 3
That makes it a lot easier for these old eyes to read.

Good luck with your work!

Jerry

On Thu, Aug 26, 2021 at 8:06 AM Carlos R Martinez <
car...@newsoundmusicstudio.com> wrote:

> Hi,
>
> How do I setup a lead sheet with 3 stanzas and 1 chorus/refrain.
>
> I need the refrain/chorus in the middle of the page after the verses
>
> Thanks
>
> --
>
>
>


Re: Gracenote bug?

2021-08-26 Thread Helge Kruse

14 years, wow!

I thought GCC bug 1773 would be the oldest bug. But that had been closed
a decade ago.

Helge

Am 23.08.2021 um 20:49 schrieb Kees van den Doel:

A 14 year old bug must be some sort of record.
Workaround seems to put a grace note in all voices, but use 's' to
make unwanted ones invisible.

Cheers,
Kees

On Mon, Aug 23, 2021 at 11:41 AM Aaron Hill mailto:lilyp...@hillvisions.com>> wrote:

On 2021-08-23 11:30 am, Kees van den Doel wrote:
> Trying to shift a note away from the barline which it's touching by
> adding
> a \grace s16, but I ran into what appears a bug?
> [ . . . ]

One of the longest-standing bugs, in fact.  See [1].

[1]: https://gitlab.com/lilypond/lilypond/-/issues/34



-- Aaron Hill



Stanzas and refrain

2021-08-26 Thread Carlos R Martinez
Hi,

How do I setup a lead sheet with 3 stanzas and 1 chorus/refrain.

I need the refrain/chorus in the middle of the page after the verses

Thanks

--



Re: A challenging music transformation...

2021-08-26 Thread lilypond
Hello Gordon,

I’ve created a function for replacing arbitrary chords with other chords. Note 
that this requires the use of absolute notation, because to support relative 
notation I’d need to implement my own parser just to know what octave the 
notes are in.

Cheers,
Valentin\version "2.22"

% returns a string representation of a pitch
#(define (pitch->str p)
   (string-append "Po"
  (number->string (ly:pitch-octave p))
  "n"
  (number->string (ly:pitch-notename p

% returns a symbol representation of a list of pitches
#(define (signature pitches)
   (let
((sp (sort pitches ly:pitchsymbol (apply string-append (map pitch->str sp)

% takes a alist that maps symbol representations of chords to a list of pitches and some music
% and replaces all occurences of chords with the key pitches in the alist with chords with the
% pitches associated with that key
replaceChords =
#(define-music-function (replacements mus) (list? ly:music?)
   ; get a list of all notes in music
   (define (extract-notes music)
 (let
  ((name (ly:music-property music 'name))
   (elt (ly:music-property music 'element))
   (elts (ly:music-property music 'elements)))
  (if (eq? name 'NoteEvent)
  (let
   ((nelt (if (null? elt) elt (extract-notes elt)))
(nelts (apply append (map extract-notes elts
   (cons music (append nelt nelts)))
  (let
   ((nelt (if (null? elt) elt (extract-notes elt)))
(nelts (apply append (map extract-notes elts
   (append nelt nelts)
   ; get the duration of a chord from one of the notes in the chord
   (define (extract-duration notes)
 (if (null? notes) 0
 (ly:music-property (first notes) 'duration)))
   ; get pitch from a note
   (define (extract-one-pitch note)
 (ly:music-property note 'pitch))
   ; get list of pitches from a list of notes
   (define (extract-pitch notes)
 (map extract-one-pitch notes))
   ; check if argument is a note
   (define (is-note? music)
 (eq? (ly:music-property music 'name) 'NoteEvent))
   ; check if argument is not a note
   (define (is-not-note? music)
 (not (is-note? music)))
   ; remove all notes from 'elements
   (define (remove-notes music)
 (let
  ((elt (ly:music-property music 'element))
   (elts (ly:music-property music 'elements)))
  (if (not (null? elt))
  (if (is-note? elt)
  (ly:music-set-property! music 'element '())
  (remove-notes elt)))
  (ly:music-set-property! music 'elements
  (filter is-not-note? elts))
  (map remove-notes (ly:music-property music 'elements
   ; add specified notes to 'elements
   (define (add-notes music pitches dur)
 (define (add-note p)
   (if (not (null? p))
   (begin
(ly:music-set-property! music 'elements
(cons
 (make-music
   'NoteEvent
   'pitch
   (car p)
   'duration
   (ly:make-duration 2))
 (ly:music-property music 'elements)))
(add-note (cdr p)
 (add-note pitches))
   ; parse music tree
   (define (walk-music-tree music)
 (let
  ((name (ly:music-property music 'name))
   (elt (ly:music-property music 'element))
   (elts (ly:music-property music 'elements)))
  ; is music a chord?
  (if (eq? name 'EventChord)
  (let*
   ((note-raw (extract-notes music))
(duration (extract-duration note-raw))
(notes (sort (extract-pitch note-raw) ly:pitchpitches mus)
   (define (extract-notes music)
 (let
  ((name (ly:music-property music 'name))
   (elt (ly:music-property music 'element))
   (elts (ly:music-property music 'elements)))
  (if (eq? name 'NoteEvent)
  (let
   ((nelt (if (null? elt) elt (extract-notes elt)))
(nelts (apply append (map extract-notes elts
   (cons music (append nelt nelts)))
  (let
   ((nelt (if (null? elt) elt (extract-notes elt)))
(nelts (apply append (map extract-notes elts
   (append nelt nelts)
   (define (extract-one-pitch note)
 (ly:music-property note 'pitch))
   (define (extract-pitch notes)
 (map extract-one-pitch notes))
   ; is music a chord?
   (let
((note-raw (extract-notes mus)))
(sort (extract-pitch note-raw) ly:pitchpitches mus)))

% takes music of the form { a1 a2 b1 b2 ... } and returns a replacement alist
% for replacing a1 with a2, b1 with b2, ...
replistfrommusic=#(define-scheme-function (mus) (ly:music?)
   (define (walk-elts elts)
(if (or (null? elts) (null? (cdr elts)))
'()
(cons (cons (sigchord 

Re: Parenthensize a horizontal group?

2021-08-26 Thread Aaron Hill

On 2021-08-25 7:36 am, Ernie Braganza wrote:
When I use the parenthesizeMusic function or the snippet in LSR-902 
with a
winged repeat bar, the parenthesis collides with the bar. I have not 
been
able to find a way to pad the bar or the parentheses in a way that 
avoids

this.
[in this code I could simply reduce the font size, but that does not 
fix

the issue in my score]

\relative c''
{
\override ParenthesesItem.font-size = 7
  \override ParenthesesItem.extra-offset =
  #(lambda (grob) (cons 0 (* -1/2 (ly:grob-staff-position grob
  g2 r4
  \parenthesizeMusic {
d'8 bes8
  }
  \bar":|]"
}


It is possible to add some padding to the BarLine:


  \once \override Staff.BarLine.extra-spacing-width = #'(-2 . 0)
  \bar ":|]"



-- Aaron Hill