                 return Int(doubleSamples)
             } else {
                 AKLog("Warning: Samples exceeds the maximum number.")
-                return Int.max
+                return .max
             }
         }
         set {

    return copy
}

/// Add to a duration
///
/// - parameter lhs: Starting duration
/// - parameter rhs: Amount to add
///
public func += (lhs: inout AKDuration, rhs: AKDuration) {
    lhs.beats += rhs.beats
}

/// Subtract from a duration
///
/// - parameter lhs: Starting duration
/// - parameter rhs: Amount to subtract
///
public func -= (lhs: inout AKDuration, rhs: AKDuration) {
    lhs.beats -= rhs.beats
}

/// Duration equality
///
/// - parameter lhs: One duration
/// - parameter rhs: Another duration
///
public func == (lhs: AKDuration, rhs: AKDuration) -> Bool {
    return lhs.beats == rhs.beats
}

/// Duration inequality
///
/// - parameter lhs: One duration
/// - parameter rhs: Another duration
///
public func != (lhs: AKDuration, rhs: AKDuration) -> Bool {
    return lhs.beats != rhs.beats
}

/// Duration greater than or equal to
///
/// - parameter lhs: One duration
/// - parameter rhs: Another duration
///
public func >= (lhs: AKDuration, rhs: AKDuration) -> Bool {
    return lhs.beats >= rhs.beats
}

/// Duration less than or equal to
///
/// - parameter lhs: One duration
/// - parameter rhs: Another duration
///
public func <= (lhs: AKDuration, rhs: AKDuration) -> Bool {
    return lhs.beats <= rhs.beats
}

/// Duration less than
///
/// - parameter lhs: One duration
/// - parameter rhs: Another duration
///
public func < (lhs: AKDuration, rhs: AKDuration) -> Bool {
    return lhs.beats < rhs.beats
}

/// Duration greater than
///
/// - parameter lhs: One duration
/// - parameter rhs: Another duration
///
public func > (lhs: AKDuration, rhs: AKDuration) -> Bool {
    return lhs.beats > rhs.beats
}

/// Adding durations
///
/// - parameter lhs: One duration
/// - parameter rhs: Another duration
///
public func + (lhs: AKDuration, rhs: AKDuration) -> AKDuration {
    var newDuration = lhs
    newDuration.beats += rhs.beats
    return newDuration
}

/// Subtracting durations
///
/// - parameter lhs: One duration
/// - parameter rhs: Another duration
///
public func - (lhs: AKDuration, rhs: AKDuration) -> AKDuration {
    var newDuration = lhs
    newDuration.beats -= rhs.beats
    return newDuration
}

/// Modulus of the duration's beats
///
/// - parameter lhs: One duration
/// - parameter rhs: Another duration
///
public func % (lhs: AKDuration, rhs: AKDuration) -> AKDuration {
    var copy = lhs
    copy.beats = lhs.beats.truncatingRemainder(dividingBy: rhs.beats)
    return copy
}

public typealias BPM = Double

/// Container for the notion of time in sequencing
public struct AKDuration: CustomStringConvertible, Comparable {
    let secondsPerMinute = 60

    /// Duration in beats
