On Sun, Jun 17, 2012 at 6:22 PM, Joseph Rushton Wakeling
<address@hidden> wrote:
On 16/06/12 03:24, Jonghyun Kim wrote:
How can I use and hear(midi) 1/16 microtones?
I can write and hear {c cih cisih...} But I don't know more...
1/16-tone intervals are supported but not out-of-the-box, you will have to define your own note-names and map those to corresponding accidentals.
Keith O'Hara's suggestion to look at the Makam setup is a good one. If you're using Linux you should be able to find makam.ly in /usr/share/lilypond/[version-number]/ly/ -- I guess there will be a corresponding directory in the Program Files for Windows -- and going through this should give you a good idea of how to create your own custom accidental setup.
You can also look in scm/define-note-names.scm for the more standard pitch definitions used by default in LilyPond with different languages (Dutch, German, English, ...).
Let's go through this step by step:
(1) defining note alteration values
--------------------------------------
In makam.ly the file opens with some definitions of note alteration values:
#(define-public EKSIK-IKI 5/18)
#(define-public EKSIK-UC 6/18)
#(define-public KOMA 1/9)
#(define-public BAKIYE 4/9)
#(define-public KUCUK 5/9)
#(define-public BUYUKMUCENNEB 8/9)
This is just defining a variable with those names (KOMA, BAKIYE, KUCUK, etc.) to be equal to those values. So you'll want to do something like,
#(define-public SIXTEENTH-SHARP 1/16)
#(define-public EIGHTH-SHARP 1/8)
... and so on as required; bear in mind that Lilypond by default has defined SHARP (=1/2), SEMI-SHARP (=1/4), THREE-Q-SHARP (=3/4), and corresponding values for flats (FLAT = -1/2, SEMI-FLAT = -1/4, ...).
(2) defining note names
-------------------------
Once you've got all your alteration values defined, you can define note names. This is a mapping between the name of a pitch that you would write in a LilyPond source file (e.g. c, ces, ceh, ...) and a corresponding note name and alteration.
In makam.ly you see:
makamPitchNames = #`(
(c . ,(ly:make-pitch -1 0 NATURAL))
(d . ,(ly:make-pitch -1 1 NATURAL))
(e . ,(ly:make-pitch -1 2 NATURAL))
(f . ,(ly:make-pitch -1 3 NATURAL))
(g . ,(ly:make-pitch -1 4 NATURAL))
(a . ,(ly:make-pitch -1 5 NATURAL))
(b . ,(ly:make-pitch -1 6 NATURAL))
(cc . ,(ly:make-pitch -1 0 KOMA))
(dc . ,(ly:make-pitch -1 1 KOMA))
(ec . ,(ly:make-pitch -1 2 KOMA))
(fc . ,(ly:make-pitch -1 3 KOMA))
(gc . ,(ly:make-pitch -1 4 KOMA))
(ac . ,(ly:make-pitch -1 5 KOMA))
(bc . ,(ly:make-pitch -1 6 KOMA))
(cb . ,(ly:make-pitch -1 0 BAKIYE))
(db . ,(ly:make-pitch -1 1 BAKIYE))
(eb . ,(ly:make-pitch -1 2 BAKIYE))
(fb . ,(ly:make-pitch -1 3 BAKIYE))
(gb . ,(ly:make-pitch -1 4 BAKIYE))
(ab . ,(ly:make-pitch -1 5 BAKIYE))
(bb . ,(ly:make-pitch -1 6 BAKIYE))
... etc. ...
What this is doing is saying that a written c corresponds to a note in octave -1 (i.e. the octave below middle C), with note name 0 (i.e. staff position C) and NATURAL alteration (i.e. no alteration).
And by comparison, a written fc corresponds to a note in octave -1, with note name 3 (i.e. staff position F), and KOMA alteration, i.e. +1/9 of a tone.
So you'd want to define pitches something like
sixteenthPitchNames = #`(
(c . ,(ly:make-pitch -1 0 NATURAL))
(d . ,(ly:make-pitch -1 1 NATURAL))
(e . ,(ly:make-pitch -1 2 NATURAL))
(f . ,(ly:make-pitch -1 3 NATURAL))
(g . ,(ly:make-pitch -1 4 NATURAL))
(a . ,(ly:make-pitch -1 5 NATURAL))
(b . ,(ly:make-pitch -1 6 NATURAL))
(csixteenthsharp . ,(ly:make-pitch -1 0 SIXTEENTH-SHARP))
(dsixteenthsharp . ,(ly:make-pitch -1 1 SIXTEENTH-SHARP))
(esixteenthsharp . ,(ly:make-pitch -1 2 SIXTEENTH-SHARP))
(fsixteenthsharp . ,(ly:make-pitch -1 3 SIXTEENTH-SHARP))
(gsixteenthsharp . ,(ly:make-pitch -1 4 SIXTEENTH-SHARP))
(asixteenthsharp . ,(ly:make-pitch -1 5 SIXTEENTH-SHARP))
(bsixteenthsharp . ,(ly:make-pitch -1 6 SIXTEENTH-SHARP))
(ceighthsharp . ,(ly:make-pitch -1 0 EIGHTH-SHARP))
(deighthsharp . ,(ly:make-pitch -1 1 EIGHTH-SHARP))
(eeighthsharp . ,(ly:make-pitch -1 2 EIGHTH-SHARP))
(feighthsharp . ,(ly:make-pitch -1 3 EIGHTH-SHARP))
(geighthsharp . ,(ly:make-pitch -1 4 EIGHTH-SHARP))
(aeighthsharp . ,(ly:make-pitch -1 5 EIGHTH-SHARP))
(beighthsharp . ,(ly:make-pitch -1 6 EIGHTH-SHARP))
... and so on for 3/16, 1/4, and however many other accidental alterations you want both sharp and flat (unfortunately this is a bit of a drawn-out process the larger your spectrum of pitch alterations).
(3) defining accidentals
--------------------------
Finally, you need to map your pitch alterations to accidental symbols. You can see in makam.ly:
makamGlyphs = #`((1 . "accidentals.doublesharp")
(8/9 . "accidentals.sharp.slashslashslash.stemstem")
(5/9 . "accidentals.sharp.slashslashslash.stem")
(4/9 . "accidentals.sharp")
(1/9 . "accidentals.sharp.slashslash.stem")
(0 . "accidentals.natural")
(-1/9 . "accidentals.mirroredflat")
(-5/18 . ,(if eksikMirroredSlashedFlat
"accidentals.mirroredflat.backslash"
"accidentals.mirroredflat"))
(-6/18 . ,(if eksikMirroredSlashedFlat
"accidentals.mirroredflat.backslash"
"accidentals.mirroredflat"))
(-4/9 . "accidentals.flat.slash")
(-5/9 . "accidentals.flat")
(-8/9 . "accidentals.flat.slashslash")
(-1 . "accidentals.flatflat"))
So you'd need to do something corresponding for all the alterations you are interested in using (1, 15/16, 7/8, ....):
sixteenthGlyphs = #`((1 . "accidentals.doublesharp")
(1/2 . "accidentals.sharp")
...etc.
The above should give you an idea of _some_ of the accidental symbols defined in LilyPond. I'm not sure where in the documentation (if anywhere) a complete list of the available symbols can be found; you might have to define your own, which is a process I'm not familiar with. :-(
With all of that done you can then apply this to the score you're working on:
\layout {
\context {
\Score
\override KeySignature #'glyph-name-alist = \sixteenthGlyphs
\override Accidental #'glyph-name-alist = \sixteenthGlyphs
\override AccidentalCautionary #'glyph-name-alist = \sixteenthGlyphs
\override TrillPitchAccidental #'glyph-name-alist = \sixteenthGlyphs
\override AmbitusAccidental #'glyph-name-alist = \sixteenthGlyphs
}
}
I'd recommend to put all of this in a separate .ly file which you can include in your working scores:
\include "sixteenthtones.ly"
As you can see it's a bit of a long and laborious process defining each possible alteration, defining all the corresponding note-names and defining all the mappings to accidentals, but it is doable and will produce correct MIDI playback.
A couple of small caveats: (1) you may run into issues with transposition, if you are producing transposed scores; (2) MIDI output assigns one MIDI channel per staff, so if you have a chord <c gsixteenthflat> it will not produce correct output, as the MIDI alteration used to alter the pitch by -1/16 will apply to both notes. However you may be able to work around this somewhat: see http://www.lilypond.org/doc/v2.14/Documentation/notation/creating-midi-files for more details.