bug-lilypond
[Top][All Lists]

Re: Define custom/new \accidentalStyles (dodecaphonic minus repeated not

 From: David Nalesnik Subject: Re: Define custom/new \accidentalStyles (dodecaphonic minus repeated notes) Date: Sun, 9 Feb 2014 17:28:39 -0600

```Hi Urs,

On Mon, Feb 3, 2014 at 3:16 AM, Urs Liska <address@hidden> wrote:

> Hi,
>
> searching the docs and the lilypond-user archive I couldn't find any
> relevant information.
>
> I am looking for a custom \accidentalStyle. Actually I think this is quite
> commonly used, so it would also seem like a useful addition to LilyPond
> proper.
>
> a)
> Every note gets an explicit accidental (including a natural),
> as in the 'dodecaphonic style,
> _except_ when a note is repeated immediately in the same voice.
>

I've seen it too, and I think it would be good to include it.

>
> When looking into music-functions.scm and its set-accidental-style I see
>
>  ((equal? style 'dodecaphonic)
>   (set-accidentals-properties #f
>                               `(Staff ,(lambda (c p bn mp) '(#f . #t)))
>                               '()
>                               context))
>
>
> So it seems the way to go to make a copy of that definition (e.g. with
> comparing against 'dodecaphonic-no-repeat) and modifying the definition.
>

Yes.  That's what I do in the attached file.

>
> Unfortunately I don't have a clue how to proceed. Any trials are simply
> anwered by errors, so I'd prefer not to _try_ but to do at least _informed
> guesses_ ;-)
>
> I assume that the
>     `(Staff
> expression returns the
>     context pitch barnumber measureposition
> arguments for
>     set-accidental-properties
> so this seems the place to define the right arguments.
>
> Unfortunately I haven't _fully_ understood lambda expressions and _barely_
> understood quoting and unquoting.
>
>
> a)
> create a differing but valid argument list at all and
> b)
> determining which '(#f . #t) combinations to use for my purpose.
>
>

I confess that I find what goes on in the source a bit confusing, but I did
come up with something that appears to work.  I make no claims about having
done this the right way :)

First of all, I looked at clauses other than that for dodecaphonic for
inspiration, since that one is only good for hit-it-with-a-hammer
situations, and you need some refinement here. You definitely want the
initial #f which prevents old-style cancellations--the extra natural when
flat follows double-flat, but you need some variability in your setting of
the cdr--that is, auto-accidentals.

I used neo-modern as a starting point, and wrote a
'dodecaphonic-no-repeat-rule'.

I had to copy other functions from scm/music-functions.scm since they're
not define-public.

The file includes the demonstration example from the NR.

--David
```

accidental-style.ly
Description: Text Data