This project allows you to make a recording, then apply one of several sound transformation effects to the audio.
- Start audio recording on button press.
- Save audio and load effects UI.
- Allow user to select one of six sound transform effects and replay audio.
An interesting aspect of the controllers came from the recordAudio function. In addition to saving the file, this included some of the many parameters available to the audioRecorder method.
@IBAction func recordAudio(_ sender: AnyObject) {
labelSetting(Bool1: true, Bool2: false, Text: "Recording in Progress")
let dirPath = NSSearchPathForDirectoriesInDomains(.documentDirectory,.userDomainMask, true)[0] as String
let recordingName = "recordedVoice.wav"
let pathArray = [dirPath, recordingName]
let filePath = URL(string: pathArray.joined(separator: "/"))
let session = AVAudioSession.sharedInstance()
try! session.setCategory(AVAudioSessionCategoryPlayAndRecord, with:.defaultToSpeaker)
try! audioRecorder = AVAudioRecorder(url: filePath!, settings: [:])
audioRecorder.delegate = self
audioRecorder.isMeteringEnabled = true
audioRecorder.prepareToRecord()
audioRecorder.record()
}
Some good articles for tips :