XMLKey representation of a musical key for MusicXML files

Inherits from: Object

See also: XMLScore and XMLNote as well as MusicXMLOverview

Creation / Class Methods

*new (accidentals, mode)

accidentals - number of accidentals (positive is sharp, negative flat). e.g. -2 is two flats

mode - the mode of the key. \major or \minor. Default value is \major.

*major (key)

Use a symbol to describe a Major key (with UpperCase)

key - One of:

\C, \G, \D, \A, \E, \B, \Fs, \Cs, \F, \Bf, \Ef, \Af, \Df, \Gf, \Cf

*minor (key)

Use a symbol to describe a minor key (with lppercase)

key - One of:

\a, \e, \b, \fs, \cs, \gs, \ds, \as, \d, \g, \c, \f, \bf, \ef, \af

Examples

// simple example

(

// create an XMLScore

z = XMLScore.new;

// add a voice to the XMLScore

z.add(y = XMLVoice(meter: XMLMeter(4, 4), key: XMLKey.major(\Bf)));

// create a B-flat major scale in quarter notes

// uses XMLVoice's internal 'clock' to keep track of beats

[58, 60, 62, 63, 65, 67, 69, 70].do({arg keynum;

y.add(XMLNote(keynum, y.now, \e));

y.now_(y.now.ceil);

});

// output the XMLScore

z.output("~/Desktop/test.xml".standardizePath);

);