1

Is it possible to let lilypond print a sharp symbol when a flat in the key signature is canceled (and a flat to cancel a sharp) and a natural symbol othewise?

So for example in F major a B would be preceded by a sharp symbol, but from E-flat back to E it'd use a natural symbol. This was used in the 17th century and I can't find anything about it in the lilypond reference manuals.

  • You don't let LilyPond do anything: you tell it what to do. If you want to precede a new key sig with naturals, just write them in. – Carl Witthoft Sep 27 '16 at 11:39
  • 1
    @CarlWitthoft The question isn't about naturals before a key signature change; it's about how key signature sharps and flats are cancelled for accidentals. There doesn't seem to be an \accidentalStyle for the behaviour the questioner wants. – Dan Hulme Sep 27 '16 at 11:44
  • @DanHulme so isn't the answer the same: you need to either create a minimacro or just manually write the desired accidental? – Carl Witthoft Sep 27 '16 at 11:51
  • @CarlWitthoft I think that people who would be happy with overriding all the accidentals by hand are not the kind of people who use Lilypond. It might be possible to make a new \accidentalStyle to do it, but I don't know enough about the internals to know where to start. – Dan Hulme Sep 27 '16 at 12:50
  • @CarlWitthoft People come here for specific answers, not blanket "well there is a way to do it, go forth and figure it out". – Dave Sep 27 '16 at 12:50
3

Since playback is very low in Lilypond's priorities, the easiest way to do this is to actually create a "B sharp" in the score where you would conventionally see a "B natural". Presumably the only reason you want to do this is to reproduce exactly what was in some 17th century source, not for performance - either by computers or modern humans.

If you are creating a short musical example the simplest way would be just to enter the "B sharp" using the conventions of your chosen input language.

Alternatively, you could define a new language (or edit an existing one) in the file define-note-names.scm. For example, the definition of English note names in that file contains

        ...
        (bflatflat . ,(ly:make-pitch -1 6 DOUBLE-FLAT))
        (bflat . ,(ly:make-pitch -1 6 FLAT))
        (b . ,(ly:make-pitch -1 6 NATURAL))
        (bsharp . ,(ly:make-pitch -1 6 SHARP))
        (bsharpsharp . ,(ly:make-pitch -1 6 DOUBLE-SHARP))
        ...

It's should be fairly obvious how to change that to make "b" in the .ly input file create something that looks like a "B sharp" in the score.

If you define your own input language, you could get correct playback from the same .ly file by generating a MIDI file using the standard language definitions.

  • wow, thanks. I hadn't thought of diving into the config files. Do you know a way to conditionally pick a definition based on the current key signature? Can I just put a check in with the note definition, or does it have to go someplace else. – Erik Oct 7 '16 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.