 
     /// Instantiate the table as a triangle wave
     mutating func standardTriangleWave() {
-        values = [Float](zeroes: size)
-        let slope = Float(4.0) / Float(size)
-        let phaseOffset = Int(phase * size)
-        for i in 0 ..< size {
-            if (i + phaseOffset) % size < size / 2 {
-                values[i] = slope * Float((i + phaseOffset) % size) - 1.0
-            } else {
-                values[i] = slope * Float((-i - phaseOffset) % size) + 3.0
+        values = [Float](zeroes: count)
+        let slope = Float(4.0) / Float(count)
+        let phaseOffset = Int(phase * count)
+        for i in indices {
+            if (i + phaseOffset) % count < count / 2 {
+                values[i] = slope * Float((i + phaseOffset) % count) - 1.0
+            } else {
+                values[i] = slope * Float((-i - phaseOffset) % count) + 3.0
             }
         }
     }
 
     /// Instantiate the table as a square wave
     mutating func standardSquareWave() {
-        values = [Float](zeroes: size)
-        let phaseOffset = Int(phase * size)
-        for i in 0 ..< size {
-            if (i + phaseOffset) % size < size / 2 {
+        values = [Float](zeroes: count)
+        let phaseOffset = Int(phase * count)
+        for i in indices {
+            if (i + phaseOffset) % count < count / 2 {
                 values[i] = -1.0
             } else {
                 values[i] = 1.0

    
    /// Number of values stored in the table
    var size = 4096

    /// Type of table
    var type: AKTableType


    /// Instantiate the table as a sawtooth wave
    mutating func positiveSawtoothWave() {
        values = [Float](zeroes: count)
        let phaseOffset = Int(phase * count)
        for i in indices {
            values[i] = Float((i + phaseOffset) % count) / Float(count)
        }
    }

    /// Instantiate the table as a reverse sawtooth wave
    mutating func positiveReverseSawtoothWave() {
        values = [Float](zeroes: count)
        let phaseOffset = Int(phase * count)
        for i in indices {
            values[i] = 1.0 - Float((i + phaseOffset) % count) / Float(count)
        }
    }

    /// Instantiate the table as a sine wave
    mutating func positiveSineWave() {
        values = [Float](zeroes: count)
        let phaseOffset = Int(phase * count)
        for i in indices {
            values[i] = 0.5 + 0.5 * sin(2 * 3.14159265 * Float(i + phaseOffset) / Float(count))
        }
    }
}
