English subtitles

← Understanding AVAudioEngine - Intro to iOS App Development with Swift

Get Embed Code
3 Languages

Showing Revision 4 created 05/25/2016 by Udacity Robot.

  1. So let's see what is going on with the code over here.
  2. The first thing to do, is to start using something called AVAudioEngine.
  3. Now this library, is packaged within the AVFoundation framework and
  4. what it does, is it allows us to manipulate audio.
  5. So, as step one in our code,
  6. what we are going to do, is create an object of AVAudioEngine.
  7. Once we have done that, we will create an instance or
  8. an object of something called AVAudioPlayerNode.
  9. You can think of this, as the thing that is connect to our mp3 file and
  10. will actually play the recorded sound.
  11. Okay, let's create an object of this.
  12. Once you have done that, I will attach this to the AV audio engine.
  13. Let me do that now.
  14. Like that.
  15. In the next step, we will create something called AVAudioUnitTimePitch.
  16. This is the class that actually allows us to change the pitch of our audio.
  17. So let's do that next.
  18. And then, I will attach this to AVAudioEngine also.
  19. Like that.
  20. Then, towards the end, I will connect these two nodes together.
  21. There.
  22. And then, finally, I will connect AVAudioUnitTimePitch,
  23. to some sort of an output, like the speakers, let me do that.
  24. There.
  25. Once all of this is done, we can play the audio.
  26. Oh, by the way, based on the value of the pitch in this effect.
  27. The recorded voice will sound like a chipmunk