     func lengthOfSections(totalLength:UInt32, sequence: Array<UInt32>) -> Array<UInt32> {
         var sectionLength = Array<UInt32>()
         var sectionCount:UInt32 = 0
+
+        if (sequence.count == 0) {
+            return Array<UInt32>()
+        }
 
         for (var i = Int(0); i < sequence.count; i++) {
             sectionCount += sequence[i]

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

    func lengthOfSections(totalLength:UInt32, sequence: Array<Tone>) -> Array<UInt32> {

    func setToneSequence(sequence:Array<Tone>) {
        self.toneSequence = sequence

        self.renderVolumes()
        self.renderFrequencies()
    }

