I am facing an issue that has been described elsewhere in this forum, but I haven’t seen an iOS-native solution. I am using SwiftUI and the AVAudioRecorder
to capture audio. I have used various settings, such as the ones below:
private var settings: [String: Any] {
switch RecordingQuality(rawValue: quality) {
case .high:
return [
AVFormatIDKey: Int(kAudioFormatLinearPCM),
AVSampleRateKey: 44_100,
AVNumberOfChannelsKey: 1,
AVLinearPCMBitDepthKey: 16,
AVLinearPCMIsBigEndianKey: false,
AVLinearPCMIsFloatKey: false,
]
case .medium, .low, .none:
return [
AVFormatIDKey: Int(kAudioFormatMPEG4AAC),
AVSampleRateKey: 44_100,
AVNumberOfChannelsKey: 1,
AVEncoderAudioQualityKey: AVAudioQuality.high.rawValue,
]
}
}
I am using a 3rd party application to upload the recordings. No matter which setting I am using, I always end up with something along these lines
Invalid file format. Supported formats: ['flac', 'm4a', 'mp3', 'mp4', 'mpeg', 'mpga', 'oga', 'ogg', 'wav', 'webm']
Has anyone managed to configure settings for the AVAudioRecorder
that result in success when using the Whisper API? Thanks!