I'm curious if it possible to make audio recording in iOS with unrecognisable speech.
The reason is only to estimate noise level. My assumption was that having low value for AVSampleRateKey in settings should do that, but after experimenting (e.g. 1 Hz) resulted recordings still have clear speech. It doesn't seems logical.
Is it possible somehow to apply low sample rate to audio recording in iOS? Values like 1Hz or 16Hz?
Here is the code snippet I've used for AVAudioRecorder declaration:
...
let settings = [
AVFormatIDKey: Int(kAudioFormatMPEG4AAC),
AVSampleRateKey: 16,
AVNumberOfChannelsKey: 1,
AVEncoderAudioQualityKey: AVAudioQuality.low.rawValue
]
audioRecorder = AVAudioRecorder(url: audioFilename, settings: settings)
...
The sample rate must be between 8kHz and 192kHz. When you pass values out of range, they're clamped back into the range (so you're recording at 8kHz).
You won't be able to use AVAudioRecorder for this. As the docs note:
Important
For more advanced recording capabilities, like applying signal processing to recorded audio, use AVAudioEngine instead.
You'll need to record the audio yourself with AVAudioEngine and an AVAudioSinkNode and downsample it with an AVAudioConverter.