On Fri, 24 Jul 2015 17:18:09 -0500 Brother Gabriel-Marie <brgabr...@sspx.org> wrote:
> Mr. Schmaus, > > My problem was a coding issue, not a musical issue. > I wanted a coding solution to save keystrokes but everyone > wanted to talk music theory. > So I thought I would ask here where everyone knows both. > In the end, I've learned that there's no easy coding > solution and that I'm going to have to sharp all the > naturals myself in the code. I am used to programming > languages where you can wrap a string in a custom function > and have it do that for you; moving from regular programming > languages to a layout code like this requires one to think > differently. But you can play with it before lilypond sees it: # 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 BTW, I think that what confused the multitude was your terming chromatic signs accidentals. Then I went and made the same mistake in my first reply, but fortunately not consistently. Kindest regards, Rale -- Guitar teaching materials and original music for all styles and levels. Site: http://www.openguitar.com (()) eMail: d.raleigh.arn...@gmail.com Contact: http://www.openguitar.com/contact.html _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user