2

My app plays audio files with AVAudioPlayer, and I've used most of its methods and properties to build a playback control interface with buttons to play/pause, seek, etc. Now I want to add a pitch-shift feature using the new AVAudioUnitTimePitch in iOS 8. I've found the sample code in this question and it works when I run it, but it uses AVAudioPlayerNode instead of AVAudioPlayer.

Is there any way to connect an AVAudioPlayer to an AVAudioEngine, instead of the AVAudioPlayerNode? Or is AVAudioPlayerNode completely different from AVAudioPlayer, despite their similar names?

I'm asking because if I have to replace AVAudioPlayer with AVAudioPlayerNode, I'll have to rework most of my control interface to use the different methods and properties available (or not available) in AVAudioPlayerNode.

Community
  • 1
  • 1
arlomedia
  • 8,534
  • 5
  • 60
  • 108
  • 1
    Yes they are completely different and yes you must rework your control interface (if you want to use AVAudioEngine). The alternative is to keep doing pitch-shift the way we did it before AVAudioEngine existed... – matt Nov 26 '14 at 03:27
  • I was not aware of a pre-iOS 8 way to do it. Can you share a link about that? – arlomedia Nov 26 '14 at 03:34
  • You'd want to learn about Core Audio and Audio Units. AVAudioEngine is merely a front end for this (a really nice front end). – matt Nov 26 '14 at 03:37
  • Okay, I guess you mean setting up an AUGraph and then applying the kAudioUnitSubType_NewTimePitch audio unit. I've used Core Audio to set up multi-channel mixers and apply DSP plug-ins in other apps and could probably figure that out, but for this app I think that would require reworking more code than the new AVAudioEngine would. – arlomedia Nov 26 '14 at 03:54

2 Answers2

3

I have been working with this for the past week or two. My goal was to create an AVAudioEngine player that mimics the functionality of AVAudioPlayer. It seems to work pretty well. Check it out and let me know if you find it of any help.

https://github.com/danielmj/AEAudioPlayer

Daniel J
  • 388
  • 1
  • 9
0

AVAudioPlayer and AVAudioEngine are different ways to work with audion on iOS. See following article for complete audio apis list with short descriptions: Audio APIs Owerview

Vitaliy A
  • 3,651
  • 1
  • 32
  • 34