Tempo

public struct Tempo

The Tempo type consists of a beats-per-minute value, and a NoteValue instance to indicate what each of these beats is. It can be initialized with a BPM value alone, in which case the beat’s value defaults to a quarter note, or with both together. Additionally, it can be initialized with a description, e.g. Tempo(Andante). There is an internal soft limit that defaults to 400.0 and can be user-modified.

  • An internal soft limit that can be modified. Defaults to 400.0.

    Declaration

    Swift

    public static var softLimit: Double = 400.0
  • BPM

    The number of beats per minute.

    Declaration

    Swift

    public var BPM: Double = 120
  • The value of each beat.

    Declaration

    Swift

    public var value: NoteValue = .n_4
  • Initialize with a note value and a BPM value, e.g. Tempo(.d_4, 140).

    Declaration

    Swift

    public init(_ noteValue: NoteValue, _ initialBPM: Double)
  • Initialize with a BPM value alone, e.g. Tempo(116.5). Beat value defaults to .n_4, or a quarter-note.

    Declaration

    Swift

    public init(_ initialBPM: Double)
  • Initialize from a string describing the tempo, e.g. Tempo(Presto). Generates a random value within a range (e.g. 115 - 140 for Allegro).

    Declaration

    Swift

    public init?(description: String)