         let startNoteKey = "startnote"
         let endNoteKey = "endnote"
         let filenameKey = "filename"
+        let triggerModeKey = "triggerMode"
         var loadSoundsArr = Array<NSMutableDictionary>()
         var sampleZoneXML = ""
+        var layerXML = ""
         var sampleIDXML = ""
         var sampleIteration = 0
         let sampleNumStart = 268435457

                sampleIteration += 1
            }

            let startNote = soundDict.objectForKey(startNoteKey)! as! Int
            let endNote = soundDict.objectForKey(endNoteKey)! as! Int
            let rootNote = soundDict.objectForKey(rootNoteKey)! as! Int
            let tempSampleZoneXML: String = AKAUPresetBuilder.generateZone(i, rootNote: rootNote, startNote: startNote, endNote: endNote, wavRef: sampleNum)

            sampleZoneXML.appendContentsOf(tempSampleZoneXML)
            soundDict.setObject(sampleNum, forKey: "sampleNum")
            loadSoundsArr.append(soundDict)
        }

        let envelopesXML = AKAUPresetBuilder.generateEnvelope(0, delay: 0, attack: attack!, hold: 0, decay: 0, sustain: 1, release: release!)
        let str = AKAUPresetBuilder.buildInstrument(instrumentName, envelopes: envelopesXML, zones: sampleZoneXML, filerefs: sampleIDXML)

        //write to file
        do {

        return str
    }

    static func generateLayer(connections: String,
                              envelopes: String = "",
                              filter: String = "",
                              lfos: String = "",
