Abdelrahman Mohamedon Stack Overflow • Recommends
On “Using sound effects with AudioEngine”
Background - I saw a video titled "Putting it all together - Intro to iOS App Development with Swift" from the following list of videos published at Udacity to apply sound effects to an audio.
link to this video
After that, I was successfully able to change the pitch of an audio with the following code:
func playAudioWithVariablePith(pitch: Float){
audioPlayer.stop()
audioEngine.stop()
audioEngine.reset()
let audioPlayerNode = AVAudioPlayerNode()
audioEngine.attachNode(audioPlayerNode)
let changePitchEffect = AVAudioUnitTimePitch()
changePitchEffect.pitch = pitch
audioEngine.attachNode(changePitchEffect)
audioEngine.connect(audioPlayerNode, to: changePitchEffect, format: nil)
audi…