         } catch let error as NSError {
             AKLog("Error: \(error) Cannot set AVAudioSession Category to \(category) with options: \(options)")
             throw error
+        }
+
+        // Core Haptics
+        do {
+            if #available(iOS 13.0, *) {
+                try session.setAllowHapticsAndSystemSoundsDuringRecording(allowHapticsAndSystemSoundsDuringRecording)
+            }
+        }  catch {
+            AKLog("Error: Cannot set allowHapticsAndSystemSoundsDuringRecording", error)
         }
 
         // Preferred IO Buffer Duration

            if AKSettings.defaultToSpeaker {
                options = options.union(.defaultToSpeaker)
            }
            #endif
        }


            #endif
        }
    }

    #if !os(macOS)
    /// Whether haptics and system sounds are muted while a microhpone is setup or recording is active
    @objc public static var allowHapticsAndSystemSoundsDuringRecording: Bool = false {
        didSet {
            if #available(iOS 13.0, *) {
                do {
                    print("allow them haptics")
                    try AVAudioSession.sharedInstance().setAllowHapticsAndSystemSoundsDuringRecording(allowHapticsAndSystemSoundsDuringRecording)
                } catch {
                    print(error)
                }
            }
        }
    }
    #endif

    /// Number of audio channels: 2 for stereo, 1 for mono
    @objc public static var channelCount: UInt32 = 2
