             let frequency = self.toneSequence[i].frequency()
 
             for (var j:UInt32 = 0; j < length; j++) {
-                frequencyTable.append(frequency)
+                frequencies.append(frequency)
             }
         }
     }

        return sectionLength
    }

    private func renderFrequencyTable() {
        let sampleCount = UInt32(self.length * UInt64(SampleRate) / 1000)

        self.frequencyTable = Array<Float>()

        let sectionLength = lengthOfSections(sampleCount, sequence: self.toneSequence)



    func setVolumeSequence(sequence:Array<Float>) {
        self.volumeSequence = sequence
        self.renderVolumes()
    }

    func lengthOfSections(totalLength:UInt32, sequence: Array<Tone>) -> Array<UInt32> {
        return lengthOfSections(totalLength, sequence: sequence.map({ (tone) -> UInt32 in
            UInt32(tone.length)
        }))
    }

    func lengthOfSections(totalLength:UInt32, sequence: Array<UInt32>) -> Array<UInt32> {
        var sectionLength = Array<UInt32>()
        var sectionCount:UInt32 = 0

        for (var i = Int(0); i < sequence.count; i++) {
            sectionCount += sequence[i]
        }

        var currentLength:UInt32 = 0;

        for (var i = Int(0); i < sequence.count; i++) {
            sectionLength.append(UInt32(sequence[i]) * UInt32(totalLength / sectionCount))
            currentLength += sectionLength[i]
        }

        //spread rounding error
        var index = 0

        while (currentLength < totalLength) {
            sectionLength[index++ % sectionLength.count]++
            currentLength++
