                 print("AKNodeRecorder Error: Cannot create an empty audio file")
                 throw error
             }
-
+            
         } else {
-
+            
             do {
                 // We initialize AKAudioFile for writing (and check that we can write to)
                 self.internalAudioFile = try AKAudioFile(forWriting: file!.url,

        }
        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 {

                    permissionGranted = false
                }
            }
            
            if !permissionGranted {
                print("AKNodeRecorder Error: Permission to record not granted")
                throw NSError(domain: NSURLErrorDomain,
                              code: NSURLErrorUnknown,
                              userInfo: nil)
            }
            
            // Sets AVAudioSession Category to be Play and Record
            
            if (AKSettings.session.category != AKSettings.SessionCategory.playAndRecord.rawValue) {
                do {
                    try AKSettings.setSession(category: .playAndRecord)
