     mutating func standardTriangleWave() {
         values = [Float]()
         let slope = Float(4.0) / Float(size)
-        for i in 0..<size {
-            if i < size / 2 {
-                values.append(slope * Float(i) - 1.0)
-            } else {
-                values.append(slope * Float(-i) + 3.0)
+        let phsOffset = (Int)(phase*size)
+        for i in 0..<size {
+            if (i+phsOffset)%size < size / 2 {
+                values.append(slope * Float((i+phsOffset)%size) - 1.0)
+            } else {
+                values.append(slope * Float((-i-phsOffset)%size) + 3.0)
             }
         }
     }

    /// Instantiate the table as a square wave
    mutating func standardSquareWave() {
        values = [Float]()
        for i in 0..<size {
            if i < size / 2 {
                values.append(-1.0)
            } else {
                values.append(1.0)

        values = [Float]()
        let slope = Float(2.0) / Float(size)
        for i in 0..<size {
            let phsOffset = (Int)(phase*size)
            if (i+phsOffset)%size < size / 2 {
                values.append(slope * Float((i+phsOffset)%size))
            } else {
                values.append(slope * Float((-i-phsOffset)%size) + 2.0)
            }
        }
    }
