lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wondering if there's a way to not just hide N.C symbols, but have th


From: Matthew Probst
Subject: Re: Wondering if there's a way to not just hide N.C symbols, but have them not erase "current" chord.
Date: Fri, 17 Feb 2023 16:54:42 -0600

That is perfect!  Yeah, I was all hung up on the fact that "skips" don't show as rests in the visible pitch-squashed staff, but totally failed to realize that that doesn't matter in the separate staff for chords.

Thanks for the rapid, very very useful anwer.  This will save me immeasurable time that would have been taken manually writing out parts in /notemode. 

On Fri, Feb 17, 2023 at 4:48 PM Jean Abou Samra <jean@abou-samra.fr> wrote:

Le vendredi 17 février 2023 à 16:39 -0600, Matthew Probst a écrit :

I'm working on charts/scores for a full rock/funk band performance, and I am wondering whether there's an easy way to do what I'm looking for.
I understand chordmode and nodemode, and I understand how to set up separate voices to show the chordnames and a pitch squashed rhythmic notation of hte chords.  This makes for a really nice way to notate rhythm and chor dnames of guitar chords from the same chordnames variable without having to tweak it separately for both.  The minimal Lilypond example looks like this (sorry about lack of attestation on the Scheme snippet to convert chords into just one note for the pitch squash staff, picked it up some time ago and lost track of it.)

\version "2.24.1"

VerseRhythmChords = {
    \chordmode {
        e16:9 r8 q16 r8 q16 r16 r16 q16 r8 q16 q16 r8
        e16:9 r8 q16 r8 q16 r16 r16 q16 r8 q16 q16 r8
        e16:9 r8 q16 r8 q16 r16 r16 q16 r8 q16 q16 r8
        bes16 q16 r16 q16 q4 g16 q16 r16 q16 q4
    }
}

firstNoteOfChord =
#(define-music-function (music) (ly:music?)
   (define (iter mus)
     (let ((elt (ly:music-property mus 'element))
           (elts (ly:music-property mus 'elements)))
       (map iter elts)
       (if (not (null? elt)) (iter elt))
       (if (and (music-is-of-type? mus 'event-chord) (not (null? elts)))
           (ly:music-set-property! mus 'elements (list (car elts))))))
   (iter music)
   music)

<<
    \new ChordNames {
        \set noChordSymbol = ""
        \set chordChanges = ##t
        \VerseRhythmChords
    }
    \new Voice \with {
        \consists "Pitch_squash_engraver"
    } {
        \improvisationOn
        \firstNoteOfChord \VerseRhythmChords
        \improvisationOff
    }

Attached find a .PNG of the output.  I tried to hide the noChordSymbol with the \set noChordSymbol = "".  That hides the chord symbols, as I want to specify the rhythm in the chord part and don't want to show N.C. on every little rest.  And I'd like to show just changes in the chord, not on every note.  That works in cases where there are no rests between chords.  But the hidden N.C. symbols still "cancel" whatever the last chord was, kinda flooding the page with lots of extraneous chords in this particular application.

I see how the default behavior is logical and valuable in most cases, but I'm wondering, in individual user-specified caess:

  • Is there a way to somehow turn off the N.C. handling entirely, without a lot of trouble, for a given stretch of /chordmode?  Not just hide the N.C. symbol, but cancel the fact that it determines those to be no-chord spots in the score.

  • Failing that, what's a good workflow for handling situations where I want to specify something more detailed than the "basic slash rhythm notation" in the manuals, and the chord names, without overly duplicating my work?

Workarounds are welcome for now.  What I find myself wanting is a way to combine the articulations possible in /notemode (posisbly using special markups, as the syntax conflicts some) in /chordmode, in a way that passes through to the pitch squash engraver, without having to overly repeat myself.  I have basic programming knowledge and a decent understanding of Scheme the language itself, but not lots of experience with the internals of Lilypond.

I get that I'm steering outside what lots of people do with this, just wondering what approaches make sense here.

Maybe just convert all rests to skips? Like

\version "2.24.1"

VerseRhythmChords = {
    \chordmode {
        e16:9 r8 q16 r8 q16 r16 r16 q16 r8 q16 q16 r8
        e16:9 r8 q16 r8 q16 r16 r16 q16 r8 q16 q16 r8
        e16:9 r8 q16 r8 q16 r16 r16 q16 r8 q16 q16 r8
        bes16 q16 r16 q16 q4 g16 q16 r16 q16 q4
    }
}

firstNoteOfChord =
#(define-music-function (music) (ly:music?)
   (define (iter mus)
     (let ((elt (ly:music-property mus 'element))
           (elts (ly:music-property mus 'elements)))
       (map iter elts)
       (if (not (null? elt)) (iter elt))
       (if (and (music-is-of-type? mus 'event-chord) (not (null? elts)))
           (ly:music-set-property! mus 'elements (list (car elts))))))
   (iter music)
   music)

restsToSkips =
#(define-music-function (music) (ly:music?)
   (music-map (lambda (m)
                (if (music-is-of-type? m 'general-rest-event)
                    (make-music 'SkipEvent m)
                    m))
              music))

<<
    \new ChordNames {
        \set noChordSymbol = ""
        \set chordChanges = ##t
        \restsToSkips \VerseRhythmChords
    }
    \new Voice \with {
        \consists "Pitch_squash_engraver"
    } {
        \improvisationOn
        \firstNoteOfChord \VerseRhythmChords
        \improvisationOff
    }
>>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]