使用AudioKit在iOS中录制音频时,是否还有其他人会听到爆裂的声音?我的录音机已经工作了一段时间,突然之间我突然冒出噪音,没有碰触我的代码。但是我确实升级了AudioKit版本,并且想知道这是否是AudioKit的错误吗?
我正在使用AudioKit 4.7版。不幸的是,我无法测试版本4.6.4来确定是否是问题所在。我的项目使用的是Swift 5.0编译器,因此4.6.4无法编译,而且我还没有时间创建示例项目。想知道这是否是已知问题。
这是我的录制代码(已经几个月没有更改了):
AKAudioFile.cleanTempDirectory()
// Session settings
AKSettings.bufferLength = .medium
AKSettings.defaultToSpeaker = true
// Patching
mic = AKMicrophone()
micMixer = AKMixer(mic)
micBooster = AKBooster(micMixer)
micBooster.gain = 0
//plot
let plot = AKNodeOutputPlot(self.mic, frame: self.plotView.bounds)
plot.plotType = .buffer
plot.shouldFill = false
plot.shouldMirror = true
plot.color = UIColor.black
self.plotView.addSubview(plot)
//end plot
micBooster!.gain = 0
recorder = try? AKNodeRecorder(node: micMixer)
if let file = recorder.audioFile {
player = try? AKAudioPlayer(file: file)
}
player?.looping = false
player?.completionHandler = playingEnded
mainMixer = AKMixer(player!, micBooster)
tracker = AKFrequencyTracker(micMixer)
silence = AKBooster(tracker, gain: 0)
AudioKit.output = mainMixer!
do {
try AudioKit.start()
} catch {
AKLog("AudioKit did not start!")
}