     ///
     public init(node: AKNode? = AudioKit.output,
                 file: AKAudioFile? = nil) throws {
-
         // AVAudioSession buffer setup
 
         guard let existingFile = file else {

        }

        guard let node = node else {
            AKLog("AKNodeRecorder Error: input node is not available")
            return
        }

        let recordingBufferLength: AVAudioFrameCount = AKSettings.recordingBufferLength.samplesCount
        isRecording = true

        AKLog("AKNodeRecorder: recording")
        node.avAudioUnitOrNode.installTap(
            onBus: 0,
            bufferSize: recordingBufferLength,
            format: internalAudioFile.processingFormat) { [weak self] (buffer: AVAudioPCMBuffer!, _) -> Void in
                guard let strongSelf = self else {
                    AKLog("Error: self is nil")
                    return
                }

                do {
                    strongSelf.recordBufferDuration = Double(buffer.frameLength) / AKSettings.sampleRate
                    try strongSelf.internalAudioFile.write(from: buffer)
                    //AKLog("AKNodeRecorder writing (file duration: \(strongSelf.internalAudioFile.duration) seconds)")

                    // allow an optional timed stop
                    if strongSelf.durationToRecord != 0 && strongSelf.internalAudioFile.duration >= strongSelf.durationToRecord {
                        strongSelf.stop()
                    }

                } catch let error as NSError {
                    AKLog("Write failed: error -> \(error.localizedDescription)")
                }
        }
    }



    /// Reset the AKAudioFile to clear previous recordings
    open func reset() throws {
        // Stop recording
        if isRecording == true {
            stop()
