Pitch
public struct Pitch : NoteNumberRepresentable
The quality of a sound governed by the rate of vibrations producing it.
A Pitch
is represented by a NoteNumber
value. If offers an interface to represent this
NoteNumber
as a Frequency
given different tuning conventions.
Example Usage
let middle = Pitch(60) // => middle c
let high = Pitch(84) // => two octaves above middle c
let lower = Pitch(69) // => a 440
-
The
NoteNumber
representation of thisPitch
.Declaration
Swift
public let value: NoteNumber
-
Creates a
Pitch
with the givenNoteNumber
value.Declaration
Swift
public init(_ value: NoteNumber)
-
Creates a
Pitch
with the givenint
value.Declaration
Swift
public init(_ int: Int)
-
Declaration
Swift
public struct Class : NoteNumberRepresentable
-
Creates a
Pitch
with the givenPitch.Class
.Declaration
Swift
public init(_ pitchClass: Pitch.Class)
-
Declaration
Swift
public var `class`: Pitch.Class { get }
Return Value
The
mod 12
representation of thisPitch
.
-
The
Frequency
representation of thisPitch
, with the given tuningreferenceFrequency
at the givenreferenceNoteNumber
.Declaration
Swift
public func frequency(referenceFrequency: Frequency = 440, referenceNoteNumber: NoteNumber = 69) -> Frequency
-
Printable description of
Pitch
.Declaration
Swift
public var description: String { get }