Basic Types
-
Periodic vibration in Hertz.
Example Usage
See morelet nice = Frequency(440.0) // => "a 440" let mean: Frequency = 440.0 // => "a 440"
Declaration
Swift
public struct Frequency : NewType, SignedNumeric
-
Floating point analog to the MIDI note number.
Similarly to the MIDI note number,
middle c
is represented as60
. Each octave is represented by a distance of12
, thus48
is thec below middle c
, and72
is thec above middle c
.Example Usage
See morelet warm = NoteNumber(60) let cold: NoteNumber = 60
Declaration
Swift
public struct NoteNumber: NewType, Comparable, SignedNumeric, ExpressibleByFloatLiteral, ExpressibleByIntegerLiteral
-
The quality of a sound governed by the rate of vibrations producing it.
A
Pitch
is represented by aNoteNumber
value. If offers an interface to represent thisNoteNumber
as aFrequency
given different tuning conventions.Example Usage
See morelet middle = Pitch(60) // => middle c let high = Pitch(84) // => two octaves above middle c let lower = Pitch(69) // => a 440
Declaration
Swift
public struct Pitch : NoteNumberRepresentable
-
Ordered sequence of pitch intervals.
A
Scale
may or may not be octave invariant, and it may or may not be infinitely protracting.Example Usage
See morelet cMajor: Scale = [0,2,4,5,7,9,11] let cSharpWholeTone = Scale(1, [2,2,2,2,2,2]) let gHarmonicMinor = Scale(7, .harmonicMinor)
Declaration
Swift
public struct Scale