TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Apr 2015 |
SPMSupports SPM | ✗ |
Maintained by Johannes Gorset.
import UIKit
import Recorder
class ViewController: UIViewController, RecorderDelegate {
var recording: Recording!
override func viewDidLoad()
{
super.viewDidLoad()
recording = Recording(to: "recording.m4a")
recording.delegate = self
// Optionally, you can prepare the recording in the background to
// make it start recording faster when you hit `record()`.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
recording.prepare()
}
}
func start()
{
recording.record()
}
func stop()
{
recording.stop()
}
func play()
{
recording.play()
}
}
You can meter incoming audio levels by implementing audioMeterDidUpdate
:
func audioMeterDidUpdate(db: Float)
{
NSLog("db level: %f", db)
}
The following configurations may be made to the Recording
instance:
bitRate
(default 192000
)sampleRate
(default 41000.0
)channels
(default 1
)Recorder is available through CocoaPods. To install it, simply add the following line to your Podfile:
use_frameworks!
pod "Recorder"
Johannes Gorset, [email protected]
Recorder is available under the MIT license. See the LICENSE file for more info.