AKDuration

public struct AKDuration: CustomStringConvertible

Container for the notion of time in sequencing

  • Duration in beats

    Declaration

    Swift

    public var beats: Double
  • Samples per second

    Declaration

    Swift

    public var sampleRate: Double = 44100
  • Tempo in BPM (beats per minute)

    Declaration

    Swift

    public var tempo: BPM = 60.0
  • While samples is the most accurate, they blow up too fast, so using beat as standard

    Declaration

    Swift

    public var samples: Int
  • Regular time measurement

    Declaration

    Swift

    public var seconds: Double
  • Useful for math using tempo in BPM (beats per minute)

    Declaration

    Swift

    public var minutes: Double
  • Music time stamp for the duration in beats

    Declaration

    Swift

    public var musicTimeStamp: MusicTimeStamp
  • Pretty printout

    Declaration

    Swift

    public var description: String
  • Initialize with samples

    • Parameters:
      • samples: Number of samples
      • sampleRate: Sample rate in samples per second

    Declaration

    Swift

    public init(samples: Int, sampleRate: Double = 44100, tempo: BPM = 60)

    Parameters

    samples

    Number of samples

    sampleRate

    Sample rate in samples per second

  • Initialize from a beat perspective

    • Parameters:
      • beats: Duration in beats
      • tempo: AKDurations per minute

    Declaration

    Swift

    public init(beats: Double, tempo: BPM = 60)

    Parameters

    beats

    Duration in beats

    tempo

    AKDurations per minute

  • Initialize from a normal time perspective

    • Parameters:
      • seconds: Duration in seconds
      • sampleRate: Samples per second (Default: 44100)

    Declaration

    Swift

    public init(seconds: Double, sampleRate: Double = 44100, tempo: BPM = 60)

    Parameters

    seconds

    Duration in seconds

    sampleRate

    Samples per second (Default: 44100)