lilypond-user
[Top][All Lists]
Advanced

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

Re: Rehearsal marks and grace notes at the beginning of bars


From: Flaming Hakama by Elaine
Subject: Re: Rehearsal marks and grace notes at the beginning of bars
Date: Tue, 27 Jan 2015 15:11:37 -0800

> From: Cynthia Karl <address@hidden>
> Subject: Re: Rehearsal marks and grace notes at the beginning of bars
>
> > I am wondering if I am missing something about the character of
> > the problem and the solution that makes you recommend the grace
> > note rest approach, rather than tweaking the order of the grace
> > notes and rehearsal mark in the part that actually has them?
>
> Did you not notice what happened to the key signature in my third
> example?  Not pretty. 

I guess I paid insufficient attention to that.


> What I am recommending is simply what the Notation Manual recommends:
>
>        "This can be remedied by inserting grace skips of the corresponding durations in the other staves.
>
> I think that your solution will not always fix the problem satisfactorily.

Yes, a robust solution would be best.


> HTH.

Very much, thanks.



Accepting that this is an appropriate and expected task to do whenever writing grace notes (yikes!), this leads me to a more general question:  is there a way to apply such a fix programmatically? 

I'll use this as an opportunity to ask for guidance on how to approach this.  Here is how I would approach it, given my current  scheme/lilypond/scheme-in-lilypond (lack of) prowess.

Any suggestions or clarifications would be appreciated.


1) Define a procedure insertSegment, that inserts the specified segment in the specified music _expression_ at the specified location.

This relies on a few functions, which I suspect must already exist, but which I am unsure of, so I just made up names:
  musicSubString: A function that extracts a segment of a music from one specified location to another
  musicLength: A function for finding out the length of a musical segment
  musicConcatenate: A way to concatenate music expressions

insertSegment = #(define-music-function
  (parser location  originalPart  location      segment)
                   (ly:music?     % guessing about the data type of a musical duration
                                  ly:duration?  ly:music?)
  #{
      (define partOne (musicSubString $originalPart 0 $location))
      (define partTwo (musicSubString $originalPart $location (musicLength $originalPart)))
      (define fixedPart (musicConcatenate $partOne $segment $partTwo))

      % Returning the value
      $fixedPart
#})


2) Apply this procedure insertSegment to the various instruments

clarinet = \relative { ... }
trumpet = \relative { ... }
cello = \relative { ... }

graceUpdate = \relative{ \grace s8 }


% Can we include music variables in scheme lists like this?
(define instruments (\clarinet \trumpet \cello))

% Still not sure how to define the location within a music _expression_.
(define graceLocation 143)

% Apply the procedure to each instrument
(map
    (lambda (instrument)

        % Can I interweave scheme with use of music functions like this?

        % Is this procedure's argument variable local,
        % or is it a reference to the actual data being operated on?
        % Here, I'm assuming that it is a reference, so this assigment will "stick"

        instrument = \insertSegment instrument { \graceLocation } { \graceUpdate }
    )
    instruments
)



Thanks,

David Elaine Alt
415 . 341 .4954                                           "Confusion is highly underrated"
address@hidden
self-immolation.info
skype: flaming_hakama
Producer ~ Composer ~ Instrumentalist
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

reply via email to

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