MusicKeySignature[alts]
returns a key signature with the specified altered pitch alts.
MusicKeySignature[…,properties]
returns a key signature with the specified property association properties.
MusicKeySignature
MusicKeySignature[alts]
returns a key signature with the specified altered pitch alts.
MusicKeySignature[…,properties]
returns a key signature with the specified property association properties.
Details
- MusicKeySignature is a function for specifying key signatures in symbolic music, enabling accurate pitch representation and notation.
- MusicKeySignature represents a musical key signature, indicating which pitches are altered.
- The pitch alterations alts can be specified using:
-
scale a named scale or MusicScale object int the major key with tonic n fifths away from "C" rules a list of rules specifying accidentals for pitch keys - The association properties can contain the following keys:
-
"Fifths" number of fifths away from "C" "AlterationRules" list of rules specifying accidentals on keys - For a key signature object obj, any of the above properties can be obtained using obj["prop"]. Use obj["PropertyAssociation"] to retrieve the values of all available properties.
Examples
open all close allBasic Examples (4)
Create an E minor key signature inferred from the pitch list in a MusicScale:
MusicKeySignature[MusicScale["EMinor"]]Create an E major key signature by specifying the number of fifth intervals away from "C":
MusicKeySignature[4]Create a key signature with custom accidentals, such as this one sometimes employed by Bela Bartok:
MusicKeySignature[{"F" -> 1, "B" -> -1}]Construct the key signature with properties specified in an Association:
MusicKeySignature[<|"Fifths" -> 1|>]Scope (4)
List all available properties:
MusicKeySignature[0]["Properties"]Retrieve all properties and their values:
%%["PropertyAssociation"]//DatasetRetrieve the "AlterationRules" property from a key signature:
MusicKeySignature[4]%["AlterationRules"]Retrieve the "Fifths" property from a key signature:
MusicKeySignature[{"F" -> 1}]%["Fifths"]The value may be Automatic if the key signature does not represent a diatonic major or minor scale:
MusicKeySignature[{"G" -> 1}]%["Fifths"]Create a MusicMeasure object with an E major key signature:
MusicMeasure[{"G#", "A"}, <|"KeySignature" -> MusicKeySignature[4]|>]Multiple measures in a voice can have different key signatures:
MusicVoice[{MusicMeasure[{"G#", "A"}, <|"KeySignature" -> MusicKeySignature[4]|>], MusicMeasure[{"A", "B"}, <|"KeySignature" -> MusicKeySignature[1]|>]}]Properties & Relations (2)
Use a key signature to respell accidentals with MusicTransform:
MusicTransform[MusicNote /@ {"D#", "G", "A#"}, {"NormalizeAccidentals", MusicKeySignature[-3]}]A key signature can be created from the pitch list in a MusicScale:
ks = MusicKeySignature[MusicScale["EMinor"]]Use MusicMeasurements to create a scale from a key signature:
MusicMeasurements[ks, "MajorScale"]Related Guides
History
Text
Wolfram Research (2026), MusicKeySignature, Wolfram Language function, https://reference.wolfram.com/language/ref/MusicKeySignature.html.
CMS
Wolfram Language. 2026. "MusicKeySignature." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MusicKeySignature.html.
APA
Wolfram Language. (2026). MusicKeySignature. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MusicKeySignature.html
BibTeX
@misc{reference.wolfram_2026_musickeysignature, author="Wolfram Research", title="{MusicKeySignature}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/MusicKeySignature.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_musickeysignature, organization={Wolfram Research}, title={MusicKeySignature}, year={2026}, url={https://reference.wolfram.com/language/ref/MusicKeySignature.html}, note=[Accessed: 12-June-2026]}