[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
barcheck numberer
From: |
David Raleigh Arnold |
Subject: |
barcheck numberer |
Date: |
Thu, 10 Jun 2010 11:44:59 -0400 |
User-agent: |
KMail/1.13.3 (Linux/2.6.32-4-686-bigmem; KDE/4.4.3; i686; ; ) |
Fast bar numbering in your editor. A white line
is filled with a bar. Other lines _ending_
with "|" get numbers. No notice is taken of
"|" which does not end line. Begin any number,
step any number. b=1 and s=1 is the default.
-------------------------------------
To use, make cb.awk executable in path
examples:
$ cb.awk myfile.ly > (redirect output)
$ cat myfile.ly | cb.awk
$ cb.awk s=8 myfile.ly
$ cat myfile.ly | cb.awk b=1 s=1
$ lynn.sed myfile.ly | rbc.sed | cb.awk
in emacs, on selected text: C+u, 0, M+|, "cb.awk", <enter>
if you don't like the result, undo.
nedit similarly
----------------------
#!/usr/bin/awk -f
# cb.awk: count-bars: number bars
# arg form: b=startnum s=stepnum
BEGIN{i = 0; b = 1; s = 1}
# does not end with bar[+w] and is not empty
!/\|[ \t]*$,!^[ \t]*$/ {k=$0}
# is white
/^[ \t]*$/ {k="\t| %" (b + s*i++)}
# has bar only in
/^[ \t]*\|[ \t]*$/ {k="\t| %" (b + s*i++)}
# has text and bar
/^.*[^ \t].*\|[ \t]*$[ \t]*/ {k=$0 " %" (b + s*i++)}
{print k}
------------------------------
ly-neaten-notes: lynn.sed
\\{ and }>> are grouped, for
easier reading, etc.
------------------------
#!/bin/sed -f
# ly-neaten-notes: lynn.sed
# neatens ly notes
# spaces around all bars on
# lines without double quotes
/"/! s/ *| */ | /g
# singlespace all: no tabs
s/\t/ /g
s/ */ /g
# space inside curlies for notes
s/{ */{ /g
s/ *}/ }/g
# sequences of curlies, etc., nospaced.
s/< /</g
s/ >/>/g
s/></> </g
s/} *\\\\ *{/}\\\\{/g
# the same symbol requires evens and odds
s/{ {/{{/g
s/} }/}}/g
s/{ {/{{/g
s/} }/}}/g
s/} {/}{/g
# strip lines
s/^ *//
s/ *$//
# tab before bar at beginning of line
s/^|/\t|/
# tab before lone comment
s/^%$/\t%/
# two spaces before curly at beginning of line
# if not at end of line, and rest of line moved to next.
/}$/! s/^}/ }\n/
# lone curly, two spaces
s/^}/ }/
------------------------------
to undo bar numbering for fast renumbering:
----------------------
#!/bin/sed -f
# remove-bar-count: rbc.sed
# restores file to state before cb.awk
# strip end whitespace, which also cleans empties
s/[\t ]*$//
# strip bar-comment-number, each required,
# from end of line, replace bar.
s/|[\t ]*%[\t ]*[0-9][0-9]*$/|/
# erase bar from otherwise white line
s/^[\t ]*[|][\t ]*$//
-----------------------------
found minor bug working with this stuff:
\version "2.13.22"
\score {
\new Staff {
\clef "G_8"
\time 2/4
\repeat volta 2 {
% meas. 1 (and 5):
a b
| %2
c d
| %3
e f
}
\alternative{{ a b }
| % Problem: "|" here. _comment ok_.
{ a c }}
| %4 easy workaround: supply extra barchecks
| %5
| %6
a b
}
}
--
For beginners: very easy guitar music, solos, duets, exercises. Early
intermediate guitar solos. One best scale set for all guitarists.
http://www.openguitar.com/scalescomparison.html ::: plus new and
better chord and arpeggio exercises. http://www.openguitar.com
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- barcheck numberer,
David Raleigh Arnold <=