         exportSession.timeRange = exportTimeRange
         exportSession.audioMix = exportAudioMix
         
-        NSLog("FDSoundActivatedRecorder audio export started")
+        print("FDSoundActivatedRecorder audio export started")
         exportSession.exportAsynchronously {
             DispatchQueue.main.async {
                 switch exportSession.status {
                 case .completed:
                     self.delegate?.soundActivatedRecorderDidFinishRecording(self, andSaved: trimmedAudioFileURL)
-                    NSLog("FDSoundActivatedRecorder audio export succeeded")
+                    print("FDSoundActivatedRecorder audio export succeeded")
                 case .failed:
                     // a failure may happen because of an event out of your control
                     // for example, an interruption like a phone call comming in
                     // make sure and handle this case appropriately
-                    NSLog("AVAssetExportSessionStatusFailed %@", exportSession.error!.localizedDescription)
+                    print("AVAssetExportSessionStatusFailed %@", exportSession.error!.localizedDescription)
                     self.delegate?.soundActivatedRecorderDidAbort(self)
                 default:
-                    NSLog("AVAssetExportSessionStatus was not expected")
+                    print("AVAssetExportSessionStatus was not expected")
                     self.delegate?.soundActivatedRecorderDidAbort(self)
                 }
             }

            _ = try? fileManager.removeItem(at: trimmedAudioFileURL)
        }
        
        //NSLog("FDSoundActivatedRecorder saving cleaned file to %@", trimmedAudioFileURL)
        
        // Create time ranges for trimming and fading
        let fadeInDoneTime = CMTimeAdd(recordingBeginTime, CMTimeMake(Int64(Double(RISE_TRIGGER_INTERVALS) * Double(INTERVAL_SECONDS) * Double(SAVING_SAMPLES_PER_SECOND)), Int32(SAVING_SAMPLES_PER_SECOND)))

        switch status {
        case .recording:
            let recordingAverageLevel = recordingIntervals.reduce(0.0, +) / Double(recordingIntervals.count)
            print("Recording avg %2.2f current %2.2f Intervals %d Triggers %d", recordingAverageLevel, currentLevel, recordingIntervals.count, triggerCount)
            if recordingIntervals.count >= RECORDING_MINIMUM_INTERVALS && currentLevel <= recordingAverageLevel - FALL_TRIGGER_DB {
                triggerCount = triggerCount + 1
            } else {
