0

I’m receiving an AVAudioPCMBuffer from the microphone, and I would like to increase its volume (normalize it) before passing the buffer to a SFSpeechAudioBufferRecognitonRequest. What is the best way to do that? There are plenty of answers on how to measure the volume of an AVAudioPCMBuffer, but I couldn’t find one on how to modify its volume.

This question here play segment of AVAudioPCMBuffer provides a way to get a segment of an AVAudioPCMBuffer, but I’m not sure how to modify it to increase the volume.

My code:

inputNode.installTap(onBus: 0, bufferSize: 1024, format: recordingFormat) { (buffer: AVAudioPCMBuffer, when: AVAudioTime) in
   // Increase buffer volume here
   self.recognitionRequest?.append(buffer)
}

FriedPotato
  • 166
  • 1
  • 8

0 Answers0