我已配置AVAudioRecorder
如下以录制 Flac 格式的音频
记录仪配置
let settings: [String: Any] = [
AVFormatIDKey: Int(kAudioFormatFLAC),
AVSampleRateKey: 16000,
AVNumberOfChannelsKey: 1,
AVLinearPCMBitDepthKey: 16,
AVEncoderAudioQualityKey: AVAudioQuality.high.rawValue,
AVLinearPCMIsBigEndianKey: false,
AVLinearPCMIsFloatKey: false,
]
录音会议
recordingSession.setCategory(AVAudioSessionCategoryPlayAndRecord, with: [.allowBluetooth,.defaultToSpeaker])
文件记录成功并在设备中播放良好,也成功上传到后端服务。
问题某些音频文件无法使用Google Speech API
---->来自 Google Speech API 的问题
- 文件不包含 FLAC 标头
- soxi FAIL 格式:无法打开输入文件“636737069431546112.flac”:解码元数据时出现 FLAC 错误