Jump to content

Non-traditional key signatures: Difference between revisions

From LilyPond wiki
m New category
Tags: Mobile edit Mobile web edit
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 3: Line 3:
To create non-standard key signatures, set this property directly. The format of this command is a list:
To create non-standard key signatures, set this property directly. The format of this command is a list:


<pre>\set Staff.keyAlterations =
\set Staff.keyAlterations =
  #`(((octave . step) . alter) ((octave . step) . alter) ...)</pre>
  #`(((<var>octave</var> . <var>step</var>) . <var>alter</var>) ((<var>octave</var> . <var>step</var>) . <var>alter</var>) ...)
where, for each element in the list, <code>octave</code> specifies the octave (0 being the octave from middle C to the B above), <code>step</code> specifies the note within the octave (0 means C and 6 means B), and <code>alter</code> is <code>,SHARP ,FLAT ,DOUBLE-SHARP</code> etc.


Alternatively, using the more concise format for each item in the list <code>(step . alter)</code> specifies the same alteration holds in all octaves.
where, for each element in the list, <var>octave</var> specifies the octave (0&nbsp;being the octave from middle&nbsp;C to the B above), <var>step</var> specifies the note within the octave (0&nbsp;means&nbsp;C and 6&nbsp;means&nbsp;B), and <var>alter</var> is one of <code>SHARP</code>, <code>FLAT</code>, <code>DOUBLE-SHARP</code>, etc., preceded by a comma.


For microtonal scales where a “sharp” is not 100 cents, <code>alter</code> refers to the alteration as a proportion of a 200-cent whole tone.
Alternatively, you can use the more concise format <code>(<var>step</var> . <var>alter</var>)</code> for each item in the list if the same alterations are used in all octaves.
 
For microtonal scales where a “sharp” is not 100 cents, <var>alter</var> refers to the alteration as a proportion of a 200-cent whole tone.


<lilypond version="2.24">
<lilypond version="2.24">
\include "arabic.ly"
\include "arabic.ly"
\relative do' {
\relative do' {
   \set Staff.keyAlterations = #`((0 . ,SEMI-FLAT)
   \set Staff.keyAlterations = #`((0 . ,SEMI-FLAT)
Line 19: Line 21:
                                 (5 . ,FLAT)
                                 (5 . ,FLAT)
                                 (6 . ,SEMI-FLAT))
                                 (6 . ,SEMI-FLAT))
%\set Staff.extraNatural = ##f
  % \set Staff.extraNatural = ##f
   re reb \dwn reb resd
   re reb \dwn reb resd
   dod dob dosd \dwn dob |
   dod dob dosd \dwn dob |
Line 28: Line 30:
[[Category:Contemporary notation]]
[[Category:Contemporary notation]]
[[Category:Pitches]]
[[Category:Pitches]]
[[Category:Contemporary notation]]
[[Category:Really cool]]
[[Category:Staff notation]]
[[Category:Staff notation]]
[[Category:Version-specific]]
[[Category:Really cool]]
[[Category:Included in the official documentation]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]
[[Category:Snippet]]

Latest revision as of 18:14, 10 December 2025

The commonly used \key command sets the keyAlterations property, in the Staff context.

To create non-standard key signatures, set this property directly. The format of this command is a list:

\set Staff.keyAlterations =
  #`(((octave . step) . alter) ((octave . step) . alter) ...)

where, for each element in the list, octave specifies the octave (0 being the octave from middle C to the B above), step specifies the note within the octave (0 means C and 6 means B), and alter is one of SHARP, FLAT, DOUBLE-SHARP, etc., preceded by a comma.

Alternatively, you can use the more concise format (step . alter) for each item in the list if the same alterations are used in all octaves.

For microtonal scales where a “sharp” is not 100 cents, alter refers to the alteration as a proportion of a 200-cent whole tone.

\version "2.24"

\include "arabic.ly"

\relative do' {
  \set Staff.keyAlterations = #`((0 . ,SEMI-FLAT)
                                 (1 . ,SEMI-FLAT)
                                 (2 . ,FLAT)
                                 (5 . ,FLAT)
                                 (6 . ,SEMI-FLAT))
  % \set Staff.extraNatural = ##f
  re reb \dwn reb resd
  dod dob dosd \dwn dob |
  dobsb dodsd do do |
}