returns the music interval spanning a distance d.
MusicInterval[…,properties]
returns a music interval with the specified property association properties.
MusicInterval[music,…]
returns a music interval with properties inherited from another music interval music.
MusicInterval
returns the music interval spanning a distance d.
MusicInterval[…,properties]
returns a music interval with the specified property association properties.
MusicInterval[music,…]
returns a music interval with properties inherited from another music interval music.
Details
- MusicInterval represents the distance between two musical pitches, describing intervals by size and quality.
- MusicInterval represents the distance between two musical pitches.
- The interval distance d can be specified using:
-
name a named diatonic music interval (e.g. "MajorThird") n the number of semitones spanned by the interval - Use MusicInterval["Names"] to list supported interval names.
- The association properties can contain the following keys:
-
"CentDeviation" cents difference from a whole number of semitones "CompoundOctaves" integer number of whole octaves in the interval "Name" common diatonic name of the interval "Semitones" number of chromatic steps in the interval - For a music interval 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)
Construct the chromatic music interval with the specified number of semitones:
MusicInterval[2]Construct the diatonic music interval with the specified name:
MusicInterval["MinorThird"]Construct the music interval with properties specified in an Association:
MusicInterval["MajorThird", <|"CentDeviation" -> -4|>]Construct the music interval with default properties inherited from another MusicInterval:
m = MusicInterval[4]MusicInterval[m, "MajorThird", <|"CentDeviation" -> -4|>]Scope (4)
MusicInterval[2]["Properties"]List properties and their values:
MusicInterval[2]["PropertyAssociation"]//DatasetList supported interval names:
MusicInterval["Names"]//ShortDefine an interval that includes a "CentDeviation":
MusicInterval[2, <|"CentDeviation" -> 17|>]Define an interval that spans a range bigger than an octave (a "compound", or non-"simple", interval):
MusicInterval["13th"]Retrieve the "CompoundOctaves" property:
%["CompoundOctaves"]Retrieve the default diatonic "Name" of an interval defined using "Semitones":
MusicInterval[7]%["Name"]Generalizations & Extensions (3)
i1 = MusicInterval[2];
i2 = MusicInterval[7];i1 + i2i1 - i2Reverse the direction on an interval:
-i1Take the absolute value of an interval, such that its direction is ascending, using Abs:
Abs[i1 - i2]Subtract two pitches to produce an interval:
MusicPitch["G"] - MusicPitch["E"]Add an interval to a MusicPitch to transpose the pitch:
MusicPitch["E"] + MusicInterval[3]Note that named intervals can behave differently than semitone-based intervals:
MusicPitch["Db"] + MusicInterval[1]MusicPitch["Db"] + MusicInterval["MinorSecond"]Transpose a MusicNote by adding or subtracting a MusicInterval:
MusicNote["C"] + MusicInterval[7]Transpose a MusicChord:
MusicChord["C major"] + MusicInterval[7]Adding an interval to a MusicRest is an identity operation:
MusicRest[1 / 4] + MusicInterval[7]Transpose a collection of events:
MusicScore[{#, # + MusicInterval[7]}&@MusicVoice[MusicMeasure[{"C", "D", "Eb", "F"}]]]Properties & Relations (4)
Compute the frequency distance of an interval from a given starting pitch using MusicMeasurements:
i = MusicInterval["PerfectFourth"]MusicMeasurements[i, {"FrequencyDistance", MusicPitch["A5"]}]Invert an interval using MusicTransform:
i = MusicInterval["PerfectFourth"]MusicTransform[i, "Inversion"]Construct a MusicScale using a series of intervals:
MusicScale[MusicInterval /@ {1, 3, 1, 2, 1, 3, 1}]Retrieve the interval list from a named scale:
MusicScale["Dorian"]
%["IntervalList"]Construct a MusicChord using a series of intervals:
MusicChord[MusicInterval /@ {4, 3, 3, 4}]Construct a chord using pitches obtained by stacking an interval:
cycle4 = Most@NestList[# + MusicInterval[4]&, MusicPitch["C"], LCM[12, 4] / 4];
MusicChord[cycle4]Retrieve the interval list from a named chord:
MusicChord["Half diminished seventh"]
%["IntervalList"]Related Guides
History
Text
Wolfram Research (2026), MusicInterval, Wolfram Language function, https://reference.wolfram.com/language/ref/MusicInterval.html.
CMS
Wolfram Language. 2026. "MusicInterval." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MusicInterval.html.
APA
Wolfram Language. (2026). MusicInterval. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MusicInterval.html
BibTeX
@misc{reference.wolfram_2026_musicinterval, author="Wolfram Research", title="{MusicInterval}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/MusicInterval.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_musicinterval, organization={Wolfram Research}, title={MusicInterval}, year={2026}, url={https://reference.wolfram.com/language/ref/MusicInterval.html}, note=[Accessed: 12-June-2026]}