lilypond-user
[Top][All Lists]
Advanced

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

Re: sharping naturals


From: David Raleigh Arnold
Subject: Re: sharping naturals
Date: Thu, 13 Aug 2015 18:22:04 -0400

On Mon, 10 Aug 2015 07:18:18 +0200
David Kastrup <address@hidden> wrote:

> David Raleigh Arnold <address@hidden> writes:
> 
> > On Thu, 23 Jul 2015 11:33:50 -0500
> > Brother Gabriel-Marie <address@hidden> wrote:
> >
> >> When you use key signatures like A major or B Major you end 
> >> up with a lot of naturals in the score for which you may 
> >> have to manually add sharps.
> >> 
> >> Is there a switch that will automatically sharp all the 
> >> naturals?
> >> I was looking at this:
> >> http://www.lilypond.org/doc/v2.19/Documentation/notation/displaying-pitches#automatic-accidentals
> >> 
> >> This was the closest I could see:
> >> \accidentalStyle modern
> >> 
> > The developers have resisted this from the beginning, because
> > they don't realize how easy it would be. There may be also a
> > certain contempt for the user or composer who is not expected
> > to know what key he's in.
> 
> Well, at some point of time you'll need to decide yourself
> whether LilyPond's semantics are due to stupidity or to
> malice.  It seems a bit greedy to claim both.
> 
> At any rate, it is more a certain contempt for the computer
> that is not expected to know what key it's in.  Instead, it
> uses accidental rules at the time of typesetting (not even
> iteration) in order to figure out the best graphical
> representation for the pitch.  That's not infallible as issues
> like
> <URL:https://code.google.com/p/lilypond/issues/detail?id=1134>
> show.
> 
> That reminder and cautionary accidentals are an integral part
> of music typesetting would tend to give some indication that
> humans share those problems.
> 
> At any rate, I cannot find a single commit in all of LilyPond's
> code base attributed to you.
> 
> Wouldn't it be more convincing if you were able to back up your
> better understanding of the involved matters with actual code?

It's not involved. It just saves typing. Kindest regards, Rale

# keys.sed 
# Writes chromatic signs according to key for _single letter_ notes
# within a range begun with, for examples: Key2#, Key3b, Keynn, and
# ended with: Key0 (0=zero). There is no transposition, but you can use
# a different key indication from lilypond's. Writes "english.ly" but
# you may enter "b" (or "f") for flat, "bb" (or "w") for double flat,
# and "#" (or "s") for sharp, but only x for double sharp. Use 'n' to
# protect an accidental natural. You may enter "h", "b", or "bn", but
# there is no "h#". These alternative language choices are both easier
# to read and quicker to write than lilypond input, but lilypond is not
# the only use for these alternatives.
# More shortcuts, etc., inside range:
# r=a4 will become a4\rest
# V3 = \voiceThree
# Outside range:
# %% <-- all lines starting thus will be deleted. NB space
# (c)2005 David Raleigh Arnold. -->GNU Enjoy! rev. 20100528

# comments: del from whole file
/^%% .*/d

# key range -- top 
/Key[1-7n][b#n]/,/Key0/{

# branch to fall off end--problem dumb mistake?
#/%.*/b 

####### Format:
# no tabs
s/\t/ /g

# space follows/precedes curly, pointer, to prettify.
s/[{<]/& /g
s/[}>]/ &/g

# put spaces at begin and end of line, double spaces inside
# to simplify process of note names
s/  */  /g
s/^ */ /
s/ *$/ /

####### Actions

# change # to s with notes
s/\( [a-g]\)#/\1s/g  

# make r=a4 into a4\rest. Work with R?
s/ r=\([a-g]\)\([^ ]*\) / \1n\2\\rest /g

# voices
s/V1/\\voiceOne/g
s/V2/\\voiceTwo/g
s/V3/\\voiceThree/g
s/V4/\\voiceFour/g
s/V0/\\oneVoice/g

# mark single letter notes only. Accidentals will
# be added as they fall into the right key.

s/\( [a-g]\)\([^wbfnxs#]\)/\1%flatORsharp%\2/g

# goto (branch) and fall through
/Key7b/,/Key0/b keycb
/Key6b/,/Key0/b keygb
/Key5b/,/Key0/b keydb
/Key4b/,/Key0/b keyab
/Key3b/,/Key0/b keyeb
/Key2b/,/Key0/b keybb
/Key1b/,/Key0/b keyfn
/Key7#/,/Key0/b keycs
/Key6#/,/Key0/b keyfs
/Key5#/,/Key0/b keybn
/Key4#/,/Key0/b keyen
/Key3#/,/Key0/b keyan
/Key2#/,/Key0/b keydn
/Key1#/,/Key0/b keygn 
/Keynn/,/Key0/b finish
:keycb
s/f%flatORsharp%/f%flat%/g
:keygb
s/c%flatORsharp%/c%flat%/g
:keydb
s/g%flatORsharp%/g%flat%/g
:keyab
s/d%flatORsharp%/d%flat%/g
:keyeb
s/a%flatORsharp%/a%flat%/g
:keybb
s/e%flatORsharp%/e%flat%/g
:keyfn
s/b%flatORsharp%/b%flat%/g
b finish

:keycs
s/b%flatORsharp%/b%sharp%/g
:keyfs
s/e%flatORsharp%/e%sharp%/g
:keybn 
s/a%flatORsharp%/a%sharp%/g
:keyen 
s/d%flatORsharp%/d%sharp%/g
:keyan 
s/g%flatORsharp%/g%sharp%/g
:keydn 
s/c%flatORsharp%/c%sharp%/g
:keygn 
s/f%flatORsharp%/f%sharp%/g

:finish
# could leave out next line for debugging;
s/%flatORsharp%//g
# output "english.ly". You can easily convert to
# any other language you want.  
# flat is f
s/%flat%/f/g
# conversions:
s/ h/ bn/g
s/\( [a-g]\)b/ \1f/g
s/\( [a-g]\)w/ \1ff/g
s/\( [a-g]\)bb/ \1ff/g
# sharp is s
s/%sharp%/s/g
# ss or x should not require action

# clean up. Getting rid of n's
s/\( [a-g]\)n/\1/g

# finger number in front of one note: use -hyphen
# 2? so it can't be done twice?. notes are done already
s/\( [a-g][^- \t]*\)-\([1-4]\)/ \\fol <\1>-\2/g
# include "lynn"
# reformat
s/{ */{ /g
s/< */< /g
s/ *>/ >/g
s/ *}/ }/g
s/{ *{/{{/g
s/{ *{/{{/g
s/} *}/}}/g
s/} *}/}}/g

# undo spaces at begin and end of line, double spaces
# restore polyphony construction.
s/^ *//
s/*$//
s/  */ /g
s/< *< *{/<<{/g
s/} *> *>/}>>/g
s/} *\\\\ *{/}\\\\{/g
# put back these tabs
s/^[|]/\t|/



# get rid of flags
/Key[0-7n][b#n]/d
/Key0/d

# quit
/QUIT/,${
d
}
} # end of range

-- 
For All Guitar Beginners: The pages of very easy solos missing
from all of the published guitar methods of others.
For All Guitarists: solos, duets, and peerless guitar exercises
David Raleigh Arnold               http://www.openguitar.com



reply via email to

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