Closed Abir-crypto closed 2 years ago
Hi @Abir-crypto, AudioConverter.swift
this pcm
to mp3
coveter.
You are not decoding the M4A audio into raw audio data before sending it into LAME.
"PCM audio" means no compression.
Thanks!
@Abir-crypto Example how to record wav file
let fileURL: URL = {
let src = "sound.wav"
return FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0].appendingPathComponent(src)
}()
let recordSettings: [String : Any] = [AVFormatIDKey: Int(kAudioFormatLinearPCM),
AVSampleRateKey: 44100.0,
AVNumberOfChannelsKey: 1,
AVEncoderAudioQualityKey: AVAudioQuality.high.rawValue ]
do {
audioRecorder = try AVAudioRecorder(url: fileURL, settings: recordSettings)
audioRecorder?.prepareToRecord()
} catch {
print("Error creating audio Recorder. \(error)")
}
Hey after I convert the file from m4a to mp3, the file is only noise. Can't hear anything else. I've just copied everything from the example project as it is.