AMRAudioSwift is a useful tool to encode or decode audio between AMR and WAVE. It's written in Swift, and it supports Bitcode.
In addition, AMRAudioSwift contains an audio recorder/player, which can record voice and play AMR data.
At the bottom level, libopencore-amr
is applied for audio decoding.
Specify "AMRAudioSwift" in your Cartfile
:
github "teambition/AMRAudioSwift"
let audioRecorder = AMRAudioRecorder()
audioRecorder.volume = ...
audioRecorder.isProximityMonitoringEnabled = ...
audioRecorder.isScreenBrightWhenPlaying = ...
// assign delegate
audioRecorder.delegate = self
audioRecorder.startRecord()
audioRecorder.cancelRecord()
audioRecorder.stopRecord()
audioRecorder.play(waveData)
audioRecorder.playAmr(amrData)
audioRecorder.stopPlay()
func audioRecorderDidStartRecording(_ audioRecorder: AMRAudioRecorder) {
// do something
}
func audioRecorderDidCancelRecording(_ audioRecorder: AMRAudioRecorder) {
// do something
}
func audioRecorderDidStopRecording(_ audioRecorder: AMRAudioRecorder, withURL url: URL?) {
// do something
}
func audioRecorderEncodeErrorDidOccur(_ audioRecorder: AMRAudioRecorder, error: Error?) {
// do something
}
func audioRecorderDidFinishRecording(_ audioRecorder: AMRAudioRecorder, successfully flag: Bool) {
// do something
}
func audioRecorderDidStartPlaying(_ audioRecorder: AMRAudioRecorder) {
// do something
}
func audioRecorderDidStopPlaying(_ audioRecorder: AMRAudioRecorder) {
// do something
}
func audioRecorderDecodeErrorDidOccur(_ audioRecorder: AMRAudioRecorder, error: Error?) {
// do something
}
func audioRecorderDidFinishPlaying(_ audioRecorder: AMRAudioRecorder, successfully flag: Bool) {
// do something
}
iOS 10.0
AMRAudioSwift is released under the MIT license. See LICENSE for details.
Have a question? Please open an issue!