3
로 PCM은이 코드가 있습니다로드합니다 AVAudioPCMBuffer
func loadSoundfont(_ pitch : String) {
let path: String = Bundle.main.path(forResource: "\(self.id)/\(pitch)", ofType: "f32")!
let url = URL(fileURLWithPath: path)
do {
let file = try AVAudioFile(forReading: url, commonFormat: AVAudioCommonFormat.pcmFormatFloat32, interleaved: true)
let format = file.processingFormat
let capacity = AVAudioFrameCount(file.length)
self.buffer = AVAudioPCMBuffer(pcmFormat: format, frameCapacity: capacity)
try file.read(into: self.buffer!)
} catch let error as NSError {
print("ERROR HERE", error.localizedDescription)
}
}
을 그리고 난 다음 오류 얻을 : 1954115647
입니다 : kAudioFileUnsupportedFileTypeError
내 A4.f32 파일은 PCM 플로트 (32)인가 포함이 내가 여기서 누락 된 것? 파일에 헤더가 없습니다. 문제가 될 수 있습니까? 코멘트에 리듬 Fistman에
오디오 파일이 원시 float32 데이터입니다? 나는'AVFoundation'이 그것을로드 할 것이라고 생각하지 않습니다. 직접로드하거나 머리글을 붙이십시오. –