这是我的代码,processingFormat始终是
`let documentDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
let audioURL = documentDirectory.appendingPathComponent("recording_\(UUID().uuidString).wav")
let int16Format = AVAudioFormat(commonFormat: .pcmFormatInt16, sampleRate: 16000, channels: 1, interleaved: true)!
do {
audioFile = try AVAudioFile(forWriting: audioURL, settings: int16Format.settings)
if let processingFormat = audioFile?.processingFormat {
print("Processing format: \(processingFormat)")
}
} catch {
print("Error creating audio file: \(error.localizedDescription)")
}
我明白了!应该是
init(forWriting:URL,设置:[String:Any],commonFormat:AVAudioCommonFormat,交错:Bool)