         self.tempo = tempo
         self.beats = tempo * (seconds / secondsPerMinute)
     }
+
+
+    /// Add to a duration
+    ///
+    /// - parameter lhs: Starting duration
+    /// - parameter rhs: Amount to add
+    ///
+    public static func += (lhs: inout AKDuration, rhs: AKDuration) {
+        lhs.beats += rhs.beats
+    }
+
+    /// Subtract from a duration
+    ///
+    /// - parameter lhs: Starting duration
+    /// - parameter rhs: Amount to subtract
+    ///
+    public static func -= (lhs: inout AKDuration, rhs: AKDuration) {
+        lhs.beats -= rhs.beats
+    }
+
+    /// Duration equality
+    ///
+    /// - parameter lhs: One duration
+    /// - parameter rhs: Another duration
+    ///
+    public static func ==(lhs: AKDuration, rhs: AKDuration) -> Bool {
+        return lhs.beats == rhs.beats
+    }
+
+    /// Duration less than
+    ///
+    /// - parameter lhs: One duration
+    /// - parameter rhs: Another duration
+    ///
+    public static func < (lhs: AKDuration, rhs: AKDuration) -> Bool {
+        return lhs.beats < rhs.beats
+    }
+
+    /// Adding durations
+    ///
+    /// - parameter lhs: One duration
+    /// - parameter rhs: Another duration
+    ///
+    public static 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 static 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 static func % (lhs: AKDuration, rhs: AKDuration) -> AKDuration {
+        var copy = lhs
+        copy.beats = lhs.beats.truncatingRemainder(dividingBy: rhs.beats)
+        return copy
+    }
 }
 
 /// Upper bound of a duration, in beats

    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
}

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