         }
         self.node = node
     }
-
+    
     // MARK: - Methods
-
+    
     /// Start recording
     open func record() throws {
         if recording {
             print("AKNodeRecorder Warning: already recording !")
             return
         }
-
-
+        
+        
         #if os(iOS)
             // requestRecordPermission...
             var permissionGranted: Bool = false
-
+            
             AKSettings.session.requestRecordPermission() {
                 (granted: Bool)-> Void in
                 if granted {

            }
            node!.avAudioNode.removeTap(onBus: 0)
            print("Recording Stopped.")

        } else {
            print("AKNodeRecorder Error: input node is not available")
        }
    }


    /// Reset the AKAudioFile to clear previous recordings
    open func reset() throws {

        // Stop recording
        if recording {
            stop()
        }

        // Delete the physical recording file
        let fileManager = FileManager.default
        let settings = internalAudioFile.processingFormat.settings
        let url = internalAudioFile.url

        do {
            try fileManager.removeItem(atPath: audioFile!.url.absoluteString)
        } catch let error as NSError {
            print("AKNodeRecorder Error: cannot delete Recording file:  \(audioFile!.fileNamePlusExtension)")
            throw error
        }

        // Creates a blank new file
        do {
            internalAudioFile = try AKAudioFile(forWriting: url, settings: settings)

                }
            }
        #endif
        
        
        if  node != nil {
            
            let recordingBufferLength: AVAudioFrameCount = AKSettings.recordingBufferLength.samplesCount
            recording = true
            
            print("recording")
            node!.avAudioNode.installTap(onBus: 0, bufferSize: recordingBufferLength,
                                         format: internalAudioFile.processingFormat) {
                                            (buffer: AVAudioPCMBuffer!, time: AVAudioTime!) -> Void in
                                            do {
                                                self.recordBufferDuration = Double(buffer.frameLength) / AKSettings.sampleRate
                                                try self.internalAudioFile.write(from: buffer)
                                                print("writing ( file duration:  \(self.internalAudioFile.duration) seconds)")
                                                
                                                // allow an optional timed stop
                                                if self.durationToRecord != 0 && self.internalAudioFile.duration >= self.durationToRecord {
                                                    self.stop()
                                                }
                                                
                                            } catch let error as NSError {
                                                print("Write failed: error -> \(error.localizedDescription)")
                                            }
            }
        } else {
            print("AKNodeRecorder Error: input node is not available")
        }
    }
    
    /// Stop recording
    open func stop() {
        if !recording {
            print("AKNodeRecorder Warning: Cannot stop recording, already stopped !")
            return
        }
        
        recording = false
        if  node != nil {
            if AKSettings.fixTruncatedRecordings {
