 
         recording = true
 
-        node.avAudioNode.installTapOnBus(0, bufferSize: bufferSize, format: tape.processingFormat, block:
-            { (buffer: AVAudioPCMBuffer!, time: AVAudioTime!) -> Void in
-                do{
+        node.avAudioNode.installTapOnBus(0, bufferSize: bufferSize, format: tape.processingFormat, block: { (buffer: AVAudioPCMBuffer!, time: AVAudioTime!) -> Void in
+                do {
                     try self.tape.writeFromBuffer(buffer)
                     print("writing ( file duration:  \(self.tape.duration) seconds)")
-                }
-                catch let error as NSError{
+                } catch let error as NSError {
                     print("Write failed: error -> \(error.localizedDescription)")
                 }
         })

        if !permissionGranted {
            print("Permission to record not granted")
            throw NSError(domain: NSURLErrorDomain, code: NSURLErrorUnknown, userInfo: nil)
        } else  {
            print("Permission to record granted ! ")
        }


            throw error
        }

        mixer = AKDryWetMixer(node, internalPlayer, balance: idleBalance)
    }

    // used to balance the dry/wet mix (auto-input)
    private func internalCallback() {
        self.mixer.balance = idleBalance
        callBack?()
        print ("replay ended")
    }

    private func refreshTapeForReading() throws {
        // It seems that we have to reinstantiate the file to
        // get the correct data about length
        do {
