http://groups.google.com/group/microtools/web/canasta.ly
Here's the output:
http://groups.google.com/group/microtools/web/canasta.pdf
I've used existing accidentals, which aren't really suitable. But the
basic structure works.
I also have a basic tripod staff working but I'll keep that to myself
for now. There are problems with ledger lines and the Wilson 12 note
staves (also annoying with decimal). But you aren't restricted to 7
notes and you can draw the staff lines where you want.
Even MIDI output works, tuned to 72-equal:
http://groups.google.com/group/microtools/web/canasta.midi
Now, the hot news is that I've finally got Sagittal working! Here's
the proof of concept:
http://groups.google.com/group/microtools/web/sagittal_glyph.ly
And here's what it looks like:
http://groups.google.com/group/microtools/web/sagittal_glyph.pdf
It overrides the standard sans font. So you can't mix Sagittal and
sans (or Sagittal and whichever family you substituted it for) in the
same document. Maybe this can be fixed but it's not such a big deal.
I think everything else is programmable. So you can write a normal
Lilypond score, add the right include file, and it'll use Sagittal
accidentals. And it can do strings, not only one glyph like the
standard mechanism. I'll keep working at this.
Graham
Great to see your progress concerning Sagittal in Lilypond!
Best
Torsten
> Great to see your progress concerning Sagittal in Lilypond!
Thank you! Note the new file
http://groups.google.com/group/microtools/web/canasta_sagittal.ly
which does decimal notation right. The main problem is finding the
right character codes. I have a PDF that gives decimal and hex codes
for the characters. Neither are consistent with what FontForge shows.
Lilypond goes with the Unicode numbers FontForge gives. And Guile
encodes Unicode using UTF-8. So you have to go into FontForge, find
the Unicode numbers, and convert them to UTF-8. I do the last step in
Python like this:
>>> u"\u00fa".encode("utf-8")
'\xc3\xba'
Graham
> Perhaps it would be a good idea to create a single Lilypond file
> which binds all these Unicode numbers to variables with names
> corresponding to their Sagittal accidental. Here is a first sketch.
>
> saggitalThirteenDown = #"\x66"
> saggitalSevenCommaDown = #"\x7a"
> saggitalNatural = #"\xc3\xaa"
> sagittalSevenCommaUp = #"\xc3\xba"
> saggitalThirteenUp = #"\xe2\x88\x8f"
It should be possible to specify those names directly, because
Lilypond certainly does know them. What it seems to be doing behind
the scenes is looking up the glyph, storing it's name, and then
looking it up by name.
This does work in sagittal_glyph.ly
\once \override Accidental #'text = \markup{ a \lookup #"boathookandscrolldown"}
(Note the "a" that really does need to be there.) I don't know how to
do this in Scheme but let's not make any long term plans assuming it
won't work.
There's some more weirdness. It looks like the space allocated for
the glyph is determined by the original lookup table. So for now you
need to find glyphs in the Feta font that are about the same size as
the ones you want.
Graham
> I just had a second look at your sagittal_glyph.ly example: so you
> actually can have both the default Lilypond accidentals and Sagittal
> accidentals in the same file: you just overwrite the settings per
> note :)
Yes, but that's the ugly way. The big deal is that you can specify
what accidentals you want with what note names, and get them tuned
right! Provided the tuning is regular and pitch bends are adequate at
least.
Following the canasta example, you could have different voices using
different accidentals. That can include mixed vs pure Sagittal. What
you can't do is have different tunings for the nominals, or different
numbers of nominals, in the same file -- unless there's something even
more amazingly clever then I've found so far.
Oh, yes, another thing to check is the Arabic music support in the new
Lilypond. That uses a command to switch between different accidental
glyphs. We can do things like that as well. So if you want to have
mixed Sagittal in an otherwise pure voice, I see no reason why
cabs dabf fqalf \mixed gsalf djalf
shouldn't work. The most likely implementation is that the \mixed
command would give the following note the mixed text function. (I
don't think the proper Sagittal ASCII has a chance of working --
you'll have to use a pre-processor for that. What I mean there is "C
a bit sharp, D a bit flat, F quite a lot flat, G sharp a little
flatter with mixed symbols, D just a little flat".)
The same method could be used to distinguish spellings of the same
pitch and nominal, like "C quarter sharp" and "C sharp quarter flat".
> Still, I don't follow your explanation concerning the names of
> accidentals. I notice that in sagittal_glyph.ly you create the
> accidental with
>
> \markup{\override #'(font-family . sans) x}
>
> I played around with a few alternative letters, but could not
> understand the behaviour...
It prints whatever letter has the same code point in the Sagittal file
as x in ASCII.
> Are you saying it should be possible to access the accidentals via
> their names, only so far we don't know how?
I know how for the \once \override. I must have made more changes
than I remembered to the file I posted. Here are the full overrides I
have now:
\once \override Accidental #'stencil = #ly:text-interface::print
\once \override Accidental #'text = \markup{ a \lookup #"boathookandscrolldown"}
\once \override Accidental #'font-family = #'sans
\once \override Accidental #'font-size = #4
That should print the "boathookandscrolldown" accidental instead of
the a if Sagittal is your sans font. What I can't do is get it
working without the \once.
>> \once \override Accidental #'text = \markup{ a \lookup
>> #"boathookandscrolldown"}
>
> That shows an "a" as accidental in the score for me, did you intend
> that?
No. Probably you didn't set the font family.
Graham
> I fully understand that it is nice that one can specify new Lilypond
> note names and associate them with accidentals. Nevertheless, I feel
> using \override can come in handy too. For example, I don't know
> whether it would be feasible to define a new note name for *every*
> possibly Sagittal nominal + accidental(s) combination. Also, if the
> Lilypond file is created automatically anyway (as I do often), then
> there is no problem in creating such code blocks as well.
You don't need a name for every possible combination. Only those you
actually use. A preprocessor can handle this.
But another idea would be to have commands to add chains of accidentals. Like
\sharp \commasharp C
Maybe that can be done. There are snippets on diatonic transposition
so it must be possible to change pitches programmatically. Is anybody
planning to use Lilypond with such a large number of pitches?
> Yes, the Lilypond parser would choke on the special characters of
> Sagittal ASCII, only letters are allowed in Lilypond note names (and
> variables in general) it seems. So, some notation based solely on
> letters seems necessary (a program for translating Sagittal ASCII to
> this notation would be no big deal then, but you would need to define
> a parser for Sagittal ASCII).
A regular expression should do it, and some clues to tell it where to look.
It does? Sounds like a bug then. Did I accidentally pick the letter
to make the name work?
> Anyway, I also noticed that Lily only prints accidentals for those
> notes which it would notate with accidentals anyway. So, it is likely
> a good idea to use something like the following (cf. http://
> lilypond.org/doc/v2.12/Documentation/user/lilypond/Displaying-
> pitches#Automatic-accidentals)
>
> #(set-accidental-style 'dodecaphonic)
Yes, the logic for choosing to have an accidental comes before there's
an accidental to override. But why would you want an accidental for
an unaltered note? You can change the glyph shown for naturals or
give the note a small alteration.
Graham
> There is no immediate need for me, but eventually I would like to
> have at least the full Spartan symbol set available. I feel the whole
> point of the Sagittal notation is that you can actually notate all
> those pitches :)
Spartan isn't a big deal. Only 27 different symbols. They can be
implemented with new note names.
I'm not saying that macros for the Sagittal symbols are wrong. A
standard include for the Spartan set would be fine. But every include
file will also have a lookup of alterations to strings. That defines
the symbols as simply as using the names. There are other ways the
standard lookup table could be done. If you find yourself using the
same symbols for different notations it makes dense to define them in
one place. For now, I don't plan on copying out the whole Olympian
set though.
> Having convenient commands like \sevencommasharp would of course be
> great :) But I would even be happy if I always have to enter 3 lines
> of code to create an accidental.
The simpler it is, the easier to adapt the same score to different
notations. And the closer to the way Lilypond usually does things the
easier to get GUI editors working with it.
> Did \lookup ever work for you by itself (i.e. without preceeding it
> by any other text)? For me it appears it is simply ignored silently.
> Perhaps it supports only Lilypond's fetafont for whatever reason...
No, I must have been confused when I originally tested it. And, yes,
I seem to remember it silently ignores glyphs it can't find from
trying to get Sagittal to work that way.
\markup generally seems to be broken for accidentals. The examples
we've been given use it for text fonts but I've found it's redundant.
As strings do everything I think we need for plain accidentals.
(Vicentino-style dots above the note-head and AFMM cents shifts will
require a higher level of wizardry, but \markup won't help.)
> I was playing around with your example where you overwrite
> accidentals directly, without defining a special name for each
> possible pitch. I may want to notate, say, C/|, C/|\, C#. Using your
> approach I would use Lilypond pitch cis (C#) for each note and then
> just "override" the accidentals one by one. Without enforcing an
> accidental for every note, however, only the first accidental would
> be shown at all.
Why would you override the accidentals? You seem to be telling
Lilypond to write a pitch that's different to the one you told it.
It's more straightforward to tell Lilypond the pitch you want (or a
quantized equivalent) and then tell it what accidental to use. That
way transpositions and key signatures should work, the MIDI output
will work (within the limitations of pitch bends for now) and you have
a backup for when the Sagittal font isn't available.
I have found an example where Lilypond degrades gracefully to give the
standard glyphs: lilypond-book. If you give it the "fontload" option
you get Sagittal and if you don't you get standard Lilypond glyphs,
with no error messages.
Another example would be a hypothetical GUI editor. Maybe it won't
work with Sagittal but it can work with Lilypond's pitch system. So
you can edit your music with standard glyphs and then switch in
Sagittal for publication.
> The alternative approach is of course to first define every possibly
> pitch and give it a unique name. But that then might lead to a very
> large set of note names.
Try it and see when you have problems. The kind of numbers we're
talking about are not significant for a computer until you get to
open-ended JI notations. And you're talking about a name for every
different glyph which will also give a large set!
There is another way: transpositions. If you have a lot of chained
accidentals it's probably because the pitch has drifted. So instead
of raising every note by a comma you can transpose the whole passage
up a comma. That reduces the note-names but you still need every
possible alteration listed with the string it requires.
Maybe I should say more about what I've found by hacking Lilypond.
There are lots of clever things you can do. The alteration the
Accidental object uses doesn't have to be the same a the true pitch
alteration. There's a property of "Accidental" that duplicates the
alteration from the pitch of the relevant note. You can override this
with a function that returns a simpler alteration, or even hard-wires
it to a glyph that you don't plan to ever see but suppresses an error
message.
The alterations to glyphs lookup table can also be a function, or
dynamically assigned. So if you alter a note you can also supply it a
lookup table that only includes a glyph for the one alteration it
actually needs.
Overridden properties can see the older version. That's how chaining
accidentals could work. You can build up a string with a new
\override for each new accidental.
Graham
> I have found an example where Lilypond degrades gracefully to give the
> standard glyphs: lilypond-book. If you give it the "fontload" option
> you get Sagittal and if you don't you get standard Lilypond glyphs,
> with no error messages.
For the record, that's wrong. What lilypond-book does is cache the
results and not notice the dependencies have changed. So making any
change to the options causes it to re-compile that example.
Graham