A recorder audio for iOS, simple to integrate, calculated percent of loudness.
pod 'HPRecorder'
Copy the HPRecorder
folder to your project.
// Time interval to get percent of loudness
open var timeInterVal: TimeInterval = 0.3
// File name of audio
open var audioFilename: URL!
// Audio input: default speaker, bluetooth
open var audioInput: AVAudioSessionPortDescription!
// Recorder did finish
open var recorderDidFinish: ((_ recocorder: AVAudioRecorder, _ url: URL, _ success: Bool) -> Void)?
// Recorder occur error
open var recorderOccurError: ((_ recocorder: AVAudioRecorder, _ error: Error) -> Void)?
// Percent of loudness
open var percentLoudness: ((_ percent: Float) -> Void)?
// Ask permssion to record audio
public func askPermission(completion: ((_ allowed: Bool) -> Void)?)
// Start recording
public func startRecording()
// End recording
public func endRecording()
// Pause recorinding
public func pauseRecording()
// Resume recording
public func resumeRecording()
Add import HPRecorder
in your file
In Info.plist
file of project, you MUST add Privacy - Microphone Usage Description
key to can use microphone permission.
Swift 5.0
iOS 10.0+
Xcode 10.2+
Forks, patches and other feedback are welcome.
HPRecorder is available under the MIT license. See the LICENSE file for more info.