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:16:38 -0400

On Mon, 10 Aug 2015 14:36:42 +0200
David Kastrup <address@hidden> wrote:

> Thomas Morley <address@hidden> writes:
> 
> > 2015-08-10 13:47 GMT+02:00 David Kastrup <address@hidden>:
> >
> >> So it is pretty much established that the music-based
> >> approach comes with a healthy load of problems, and the
> >> input language based approach, while condensing most of the
> >> problems in one place, makes source code management a
> >> headache because each source code passage comes with its own
> >> associated input language.
> >
> > Well, I will not work on such a patch. I already had a hard
> > time to understand the thinking behind the proposal.
> 
> It's not all that hard to do.  Just let \key run through the
> current notename language and replace all single-character note
> names with the setting from the new key (Germans would likely
> be furious about what this does to b but then they are hardly
> the target for such a change).
> 
> Once you start arranging your input in variables (\global
> anyone?), work with multiple voices and transpositions, things
> will start to fall apart.
> 
> Even things like \transpose c f become ambiguous since they
> could mean \transpose cn fs when uttered in \key gn \major.
> 
> > Though, at a lower level one could start adding a snippet to
> > the LSR so that users can play around with it. Rale mentioned
> > some, but refused to post links...
> 
> s/refused/omitted/.  I cannot remember anybody asking for such
> links yet, so one can hardly accuse him of "refusing".
> 
Without \key, no \follow would make sense. I believe I sent my
little tool to this list some time ago, but here it is again. To
do it with other languages in my suggested crude fashion would
require a 14 or 15 item hash table for each language. Listing the
notes to be substituted would simplify implementation and
understanding of what \follow would do.

I was not insulted by calling it "crude" it certainly is, but it's
worked well for me. I hadn't had \follow suggested at the time. I hope
this version still works. 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

-- 
Guitar teaching materials and original music for all styles and
levels. Site: http://www.openguitar.com (()) eMail:
address@hidden Contact:
http://www.openguitar.com/contact.html





reply via email to

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